Class: TrueTrial::Types::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/truetrial/types/order.rb

Overview

Represents an order returned from the TrueTrial API.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Order

Returns a new instance of Order.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/truetrial/types/order.rb', line 11

def initialize(attributes = {})
  @id = attributes["id"]
  @tenant_id = attributes["tenant_id"]
  @consumer_id = attributes["consumer_id"]
  @external_order_id = attributes["external_order_id"]
  @status = attributes["status"]
  @product_type = attributes["product_type"]
  @total_cents = attributes["total_cents"]
  @currency = attributes["currency"]
  @metadata = attributes["metadata"]
  @created_at = attributes["created_at"]
  @updated_at = attributes["updated_at"]
end

Instance Attribute Details

#consumer_idObject (readonly)

Returns the value of attribute consumer_id.



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

def consumer_id
  @consumer_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



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

def currency
  @currency
end

#external_order_idObject (readonly)

Returns the value of attribute external_order_id.



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

def external_order_id
  @external_order_id
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



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

def 
  @metadata
end

#product_typeObject (readonly)

Returns the value of attribute product_type.



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

def product_type
  @product_type
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#tenant_idObject (readonly)

Returns the value of attribute tenant_id.



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

def tenant_id
  @tenant_id
end

#total_centsObject (readonly)

Returns the value of attribute total_cents.



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

def total_cents
  @total_cents
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Order

Builds an Order from an API response hash.

Parameters:

  • hash (Hash)

    raw API response data

Returns:



29
30
31
# File 'lib/truetrial/types/order.rb', line 29

def self.from_hash(hash)
  new(hash)
end