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.
11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11747 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.
11745 11746 11747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11745 def address @address end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
11745 11746 11747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11745 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
11745 11746 11747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11745 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
11745 11746 11747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11745 def label @label end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
11745 11746 11747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11745 def status @status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
11745 11746 11747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11745 def @timestamp end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
11762 11763 11764 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11762 def copy(incoming={}) LabelEvent.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11766 def to_hash { :id => id, :label => label.to_hash, :address => address.to_hash, :status => status.value, :timestamp => , :description => description } end |
#to_json ⇒ Object
11758 11759 11760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11758 def to_json JSON.dump(to_hash) end |