Class: Paid::Order

Inherits:
APIResource show all
Defined in:
lib/paid/order.rb

Instance Attribute Summary collapse

Attributes inherited from APIResource

#api_method, #json

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResource

add_api_attribute, api_attribute_names, #api_attributes, api_subclass_fetch, api_subclasses, #changed_api_attributes, #clear_api_attributes, determine_api_attribute_value, #determine_api_attribute_value, #initialize, #inspect, #inspect_api_attributes, #inspect_nested, #refresh_from, register_api_subclass, #to_json

Constructor Details

This class inherits a constructor from Paid::APIResource

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



5
6
7
# File 'lib/paid/order.rb', line 5

def amount
  @amount
end

#charge_nowObject

Returns the value of attribute charge_now.



6
7
8
# File 'lib/paid/order.rb', line 6

def charge_now
  @charge_now
end

#customerObject

Returns the value of attribute customer.



7
8
9
# File 'lib/paid/order.rb', line 7

def customer
  @customer
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/paid/order.rb', line 3

def id
  @id
end

#metadataObject

Returns the value of attribute metadata.



8
9
10
# File 'lib/paid/order.rb', line 8

def 
  @metadata
end

#objectObject (readonly)

Returns the value of attribute object.



4
5
6
# File 'lib/paid/order.rb', line 4

def object
  @object
end

#subscriptionObject

Returns the value of attribute subscription.



9
10
11
# File 'lib/paid/order.rb', line 9

def subscription
  @subscription
end

Class Method Details

.all(params = {}, headers = {}) ⇒ Object



12
13
14
15
# File 'lib/paid/order.rb', line 12

def self.all(params={}, headers={})
  method = APIMethod.new(:get, "/orders", params, headers, self)
  APIList.new(self, method.execute, method)
end

.create(params = {}, headers = {}) ⇒ Object



25
26
27
28
# File 'lib/paid/order.rb', line 25

def self.create(params={}, headers={})
  method = APIMethod.new(:post, "/orders", params, headers, self)
  self.new(method.execute, method)
end

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



17
18
19
20
21
22
23
# File 'lib/paid/order.rb', line 17

def self.retrieve(id, params={}, headers={})
  params = ParamsBuilder.merge(params, {
    :id => id
  })
  method = APIMethod.new(:get, "/orders/:id", params, headers, self)
  self.new(method.execute, method)
end

Instance Method Details

#refresh(params = {}, headers = {}) ⇒ Object



30
31
32
33
# File 'lib/paid/order.rb', line 30

def refresh(params={}, headers={})
  method = APIMethod.new(:get, "/orders/:id", params, headers, self)
  self.refresh_from(method.execute, method)
end

#save(params = {}, headers = {}) ⇒ Object



35
36
37
38
39
# File 'lib/paid/order.rb', line 35

def save(params={}, headers={})
  params = ParamsBuilder.merge(params, changed_api_attributes)
  method = APIMethod.new(:put, "/orders/:id", params, headers, self)
  self.refresh_from(method.execute, method)
end