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.
27268 27269 27270 27271 27272 27273 27274 27275 27276 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27268 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)) = 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.
27266 27267 27268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27266 def address @address end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
27266 27267 27268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27266 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
27266 27267 27268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27266 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
27266 27267 27268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27266 def status @status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
27266 27267 27268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27266 def end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
27282 27283 27284 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27282 def copy(incoming={}) TrackingEvent.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
27286 27287 27288 27289 27290 27291 27292 27293 27294 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27286 def to_hash { :id => id, :address => address.to_hash, :status => status.value, :timestamp => , :description => description } end |
#to_json ⇒ Object
27278 27279 27280 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27278 def to_json JSON.dump(to_hash) end |