Class: Io::Flow::V0::Models::LabelEvent
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LabelEvent
- 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.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#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 = {}) ⇒ LabelEvent
constructor
A new instance of LabelEvent.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ LabelEvent
Returns a new instance of LabelEvent.
10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10503 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :label, :address, :status, :timestamp], 'LabelEvent') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @label = (x = opts.delete(:label); x.is_a?(::Io::Flow::V0::Models::LabelSummary) ? x : ::Io::Flow::V0::Models::LabelSummary.new(x)) @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.
10501 10502 10503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10501 def address @address end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
10501 10502 10503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10501 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10501 10502 10503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10501 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
10501 10502 10503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10501 def label @label end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10501 10502 10503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10501 def status @status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
10501 10502 10503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10501 def @timestamp end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
10518 10519 10520 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10518 def copy(incoming={}) LabelEvent.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10522 def to_hash { :id => id, :label => label.to_hash, :address => address.to_hash, :status => status.value, :timestamp => , :description => description } end |
#to_json ⇒ Object
10514 10515 10516 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10514 def to_json JSON.dump(to_hash) end |