Skip to content

Commit

Permalink
Update Bamboozled::API::Meta to match API responses from Bamboo
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmagic committed Jun 7, 2017
1 parent 96b837a commit bf26699
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions lib/bamboozled/api/meta.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,39 @@ module Bamboozled
module API
class Meta < Base

[:field, :table, :list, :user].each do |action|
define_method("#{action}s") do
result = request(:get, "meta/#{action}s")
result["#{action}s".to_sym][action]
end
# Public: Get a list of fields.
# See https://www.bamboohr.com/api/documentation/metadata.php#getFields
#
# Returns an Array.
def fields
request(:get, "meta/fields")
end

# Public: Get the details for "list" fields in an account.
# See https://www.bamboohr.com/api/documentation/metadata.php#getLists
#
# Returns an Array.
def lists
result = request(:get, "meta/lists")
result[:lists][:list]
end

# Public: Get a list of tabular fields.
# See https://www.bamboohr.com/api/documentation/metadata.php#getTables
#
# Returns an Array.
def tables
result = request(:get, "meta/tables")
result[:tables][:table]
end

# Public: Get a list of users.
# See https://www.bamboohr.com/api/documentation/metadata.php#getUsers
#
# Returns an Array.
def users
request(:get, "meta/users").values
end
end
end
end

0 comments on commit bf26699

Please sign in to comment.