-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
🚀 Fetch all fields from API instead of hardcoding #67
Comments
The alternative mentioned above seems easy to implement. For example, I think this implementation supports the following scenarios
--- a/lib/bamboozled/api/field_collection.rb
+++ b/lib/bamboozled/api/field_collection.rb
@@ -2,8 +2,17 @@ module Bamboozled
module API
class FieldCollection
def self.wrap(fields)
- fields = all_names if fields == :all
- fields = fields.split(",") if fields.is_a?(String)
+ if fields == :all
+ fields = all_names
+ elsif fields.is_a?(String)
+ fields = fields.split(",").map { |item| item.strip }
+ end
+
+ if fields.include?(:all) || fields.include?(":all")
+ fields -= [:all, ":all"]
+ fields += all_names
+ end
+
new(fields)
end @splybon Does this make sense? :) |
Hi @balasankarc thanks for the issue! Yes that makes total sense. I will play around with this myself as well to try and investigate some other methods, but I think I like your alternative solution. My only hesitation with the In the mean time a workaround for you could be something like
|
@splybon and I discussed a documentation based and an API based approach to this issue, but haven't decided which is our preferred method of moving forward. Possible solutions: Documentation
API
|
What problem does this solve?
The list of fields that is returned by custom report is hardcoded in the FieldCollection class.
Because of this, a custom report when passed
:all
will not include custom fields, but only the hardcoded ones.Describe the solution you'd like
BambooHR returns the list of all fields via api, which is accessible using
client.meta.fields
method. Can we populate that while initializing a client and generate the list of fields from that information instead of hardcoding it?Possible alternatives
Support something like
client.report.custom([:all, customField1, customField2], 'JSON')
which will let users specify the additional fields they like (in addition to the ones returned by:all
).The text was updated successfully, but these errors were encountered: