module Api::Extensions::Fields
Public Instance Methods
parse_fields(fields_string)
click to toggle source
Parse a string for the fields functional extension
- Add the required fields if not present
# File lib/api/extensions/fields.rb, line 20 def parse_fields(fields_string) required_fields + fields_string.split(',') end
process_fields(keys, response, full_link = nil)
click to toggle source
Process the fields functional extension
# File lib/api/extensions/fields.rb, line 10 def process_fields(keys, response, full_link = nil) fields = parse_fields keys response.reject! { |k, v| !fields.include? k } if fields.length > 0 response['links']['full'] = { 'href' => full_link } unless full_link.nil? response end
required_fields()
click to toggle source
Get the required fields for any response
# File lib/api/extensions/fields.rb, line 25 def required_fields ['links'] end