Class: Paymongo::ApiResource
- Inherits:
-
Object
- Object
- Paymongo::ApiResource
- Defined in:
- lib/paymongo/api_resource.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#has_more ⇒ Object
readonly
Returns the value of attribute has_more.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(response) ⇒ ApiResource
constructor
A new instance of ApiResource.
Constructor Details
#initialize(response) ⇒ ApiResource
Returns a new instance of ApiResource.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/paymongo/api_resource.rb', line 8 def initialize(response) @data = response['data'] || response if @data.respond_to?(:has_key?) && @data.has_key?('attributes') @id = @data['id'] @attributes = @data['attributes'] end @has_more = response['has_more'] end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/paymongo/api_resource.rb', line 3 def attributes @attributes end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/paymongo/api_resource.rb', line 3 def data @data end |
#has_more ⇒ Object (readonly)
Returns the value of attribute has_more.
3 4 5 |
# File 'lib/paymongo/api_resource.rb', line 3 def has_more @has_more end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/paymongo/api_resource.rb', line 3 def id @id end |