Method: TinyClient::Resource#as_json

Defined in:
lib/tiny_client/resource.rb

#as_json(options = {}) ⇒ Hash Also known as: to_h

Parameters:

  • options (Hash) (defaults to: {})

    for the hash transformation

  • [Array] (Hash)

    a customizable set of options

Returns:

  • (Hash)

    a json ready representation of this resource



219
220
221
222
223
# File 'lib/tiny_client/resource.rb', line 219

def as_json(options = {})
  self.class.fields.each_with_object({}) do |field, h|
    h[field] = send(field)
  end.as_json(options)
end