Class: CoinbaseCommerceClient::APIResources::Base::APIResource

Inherits:
APIObject
  • Object
show all
Defined in:
lib/coinbase_commerce_client/api_resources/base/api_resource.rb

Direct Known Subclasses

Charge, Checkout, Event

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIObject

#[], #[]=, create_from, #each, #initialize, #initialize_from, #inspect, #keys, #method_missing, #respond_to_missing?, #serialize_params, #serialize_params_value, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from CoinbaseCommerceClient::APIResources::Base::APIObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CoinbaseCommerceClient::APIResources::Base::APIObject

Class Attribute Details

.clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/coinbase_commerce_client/api_resources/base/api_resource.rb', line 6

def client
  @client
end

Class Method Details

.retrieve(id, params = {}) ⇒ Object



11
12
13
14
# File 'lib/coinbase_commerce_client/api_resources/base/api_resource.rb', line 11

def self.retrieve(id, params = {})
  resp = @client.request(:get, "#{self::RESOURCE_PATH}/#{id}", params)
  Util.convert_to_api_object(resp.data, @client, self)
end

Instance Method Details

#refresh(params = {}) ⇒ Object



16
17
18
19
# File 'lib/coinbase_commerce_client/api_resources/base/api_resource.rb', line 16

def refresh(params = {})
  resp = @client.request(:get, "#{self.class::RESOURCE_PATH}/#{self[:id]}", params)
  initialize_from(resp.data)
end