Class: TrueTrial::Types::Shipment

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

Overview

Represents a shipment returned from the TrueTrial API.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Shipment

Returns a new instance of Shipment.



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

def initialize(attributes = {})
  @id = attributes["id"]
  @order_id = attributes["order_id"]
  @carrier = attributes["carrier"]
  @tracking_number = attributes["tracking_number"]
  @status = attributes["status"]
  @shipped_at = attributes["shipped_at"]
  @delivered_at = attributes["delivered_at"]
  @delivery_source = attributes["delivery_source"]
  @created_at = attributes["created_at"]
  @updated_at = attributes["updated_at"]
end

Instance Attribute Details

#carrierObject (readonly)

Returns the value of attribute carrier.



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

def carrier
  @carrier
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#delivered_atObject (readonly)

Returns the value of attribute delivered_at.



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

def delivered_at
  @delivered_at
end

#delivery_sourceObject (readonly)

Returns the value of attribute delivery_source.



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

def delivery_source
  @delivery_source
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#order_idObject (readonly)

Returns the value of attribute order_id.



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

def order_id
  @order_id
end

#shipped_atObject (readonly)

Returns the value of attribute shipped_at.



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

def shipped_at
  @shipped_at
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#tracking_numberObject (readonly)

Returns the value of attribute tracking_number.



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

def tracking_number
  @tracking_number
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Shipment

Builds a Shipment from an API response hash.

Parameters:

  • hash (Hash)

    raw API response data

Returns:



28
29
30
# File 'lib/truetrial/types/shipment.rb', line 28

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