Class: Io::Flow::V0::Models::LabelForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LabelForm
- 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.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#tracking_id ⇒ Object
readonly
Returns the value of attribute tracking_id.
-
#tracking_number ⇒ Object
readonly
Returns the value of attribute tracking_number.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ LabelForm
constructor
A new instance of LabelForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ LabelForm
Returns a new instance of LabelForm.
10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10636 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:tracking_id, :carrier, :tracking_number], 'LabelForm') @tracking_id = HttpClient::Preconditions.assert_class('tracking_id', opts.delete(:tracking_id), String) @status = (x = (x = opts.delete(:status); x.nil? ? "pending" : x); 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) @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)) = (x = opts.delete(:timestamp); x.nil? ? nil : HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end |
Instance Attribute Details
#carrier ⇒ Object (readonly)
Returns the value of attribute carrier.
10634 10635 10636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10634 def carrier @carrier end |
#delivery_estimate ⇒ Object (readonly)
Returns the value of attribute delivery_estimate.
10634 10635 10636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10634 def delivery_estimate @delivery_estimate end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
10634 10635 10636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10634 def description @description end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10634 10635 10636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10634 def status @status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
10634 10635 10636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10634 def end |
#tracking_id ⇒ Object (readonly)
Returns the value of attribute tracking_id.
10634 10635 10636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10634 def tracking_id @tracking_id end |
#tracking_number ⇒ Object (readonly)
Returns the value of attribute tracking_number.
10634 10635 10636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10634 def tracking_number @tracking_number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
10652 10653 10654 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10652 def copy(incoming={}) LabelForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10656 def to_hash { :tracking_id => tracking_id, :status => status.value, :carrier => carrier, :tracking_number => tracking_number, :delivery_estimate => delivery_estimate, :description => description, :timestamp => } end |
#to_json ⇒ Object
10648 10649 10650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10648 def to_json JSON.dump(to_hash) end |