Class: Io::Flow::V0::Models::TrackingEvent
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TrackingEvent
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TrackingEvent
constructor
A new instance of TrackingEvent.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TrackingEvent
Returns a new instance of TrackingEvent.
66170 66171 66172 66173 66174 66175 66176 66177 66178 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66170 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :address, :status, :timestamp], 'TrackingEvent') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::TrackingStatus) ? x : ::Io::Flow::V0::Models::TrackingStatus.apply(x)) @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime) @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
66168 66169 66170 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66168 def address @address end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
66168 66169 66170 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66168 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
66168 66169 66170 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66168 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
66168 66169 66170 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66168 def status @status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
66168 66169 66170 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66168 def @timestamp end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
66184 66185 66186 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66184 def copy(incoming={}) TrackingEvent.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
66188 66189 66190 66191 66192 66193 66194 66195 66196 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66188 def to_hash { :id => id, :address => address.to_hash, :status => status.value, :timestamp => , :description => description } end |
#to_json ⇒ Object
66180 66181 66182 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66180 def to_json JSON.dump(to_hash) end |