Class: Paymongo::ApiResource

Inherits:
Object
  • Object
show all
Defined in:
lib/paymongo/api_resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/paymongo/api_resource.rb', line 3

def attributes
  @attributes
end

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/paymongo/api_resource.rb', line 3

def data
  @data
end

#has_moreObject (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

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/paymongo/api_resource.rb', line 3

def id
  @id
end