Class: Io::Flow::V0::Models::Label
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Label
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a specific label being tracked as part of the tracking bucket
Instance Attribute Summary collapse
-
#carrier ⇒ Object
readonly
Returns the value of attribute carrier.
-
#delivery_estimate ⇒ Object
readonly
Returns the value of attribute delivery_estimate.
-
#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.
-
#tracking ⇒ Object
readonly
Returns the value of attribute tracking.
-
#tracking_number ⇒ Object
readonly
Returns the value of attribute tracking_number.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Label
constructor
A new instance of Label.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Label
Returns a new instance of Label.
10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10463 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :tracking, :status, :carrier, :tracking_number, :timestamp], 'Label') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @tracking = (x = opts.delete(:tracking); x.is_a?(::Io::Flow::V0::Models::TrackingSummary) ? x : ::Io::Flow::V0::Models::TrackingSummary.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::TrackingStatus) ? x : ::Io::Flow::V0::Models::TrackingStatus.apply(x)) @carrier = HttpClient::Preconditions.assert_class('carrier', opts.delete(:carrier), String) @tracking_number = HttpClient::Preconditions.assert_class('tracking_number', opts.delete(:tracking_number), String) = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime) @delivery_estimate = (x = opts.delete(:delivery_estimate); x.nil? ? nil : HttpClient::Preconditions.assert_class('delivery_estimate', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) end |
Instance Attribute Details
#carrier ⇒ Object (readonly)
Returns the value of attribute carrier.
10461 10462 10463 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10461 def carrier @carrier end |
#delivery_estimate ⇒ Object (readonly)
Returns the value of attribute delivery_estimate.
10461 10462 10463 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10461 def delivery_estimate @delivery_estimate end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
10461 10462 10463 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10461 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10461 10462 10463 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10461 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10461 10462 10463 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10461 def status @status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
10461 10462 10463 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10461 def end |
#tracking ⇒ Object (readonly)
Returns the value of attribute tracking.
10461 10462 10463 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10461 def tracking @tracking end |
#tracking_number ⇒ Object (readonly)
Returns the value of attribute tracking_number.
10461 10462 10463 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10461 def tracking_number @tracking_number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
10480 10481 10482 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10480 def copy(incoming={}) Label.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10484 def to_hash { :id => id, :tracking => tracking.to_hash, :status => status.value, :carrier => carrier, :tracking_number => tracking_number, :timestamp => , :delivery_estimate => delivery_estimate, :description => description } end |
#to_json ⇒ Object
10476 10477 10478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10476 def to_json JSON.dump(to_hash) end |