Class: Io::Flow::V0::Models::LabelSummary
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LabelSummary
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#carrier ⇒ Object
readonly
Returns the value of attribute carrier.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#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 = {}) ⇒ LabelSummary
constructor
A new instance of LabelSummary.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ LabelSummary
Returns a new instance of LabelSummary.
11946 11947 11948 11949 11950 11951 11952 11953 11954 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11946 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :tracking, :status, :carrier, :tracking_number], 'LabelSummary') @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) end |
Instance Attribute Details
#carrier ⇒ Object (readonly)
Returns the value of attribute carrier.
11944 11945 11946 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11944 def carrier @carrier end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
11944 11945 11946 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11944 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
11944 11945 11946 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11944 def status @status end |
#tracking ⇒ Object (readonly)
Returns the value of attribute tracking.
11944 11945 11946 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11944 def tracking @tracking end |
#tracking_number ⇒ Object (readonly)
Returns the value of attribute tracking_number.
11944 11945 11946 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11944 def tracking_number @tracking_number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
11960 11961 11962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11960 def copy(incoming={}) LabelSummary.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
11964 11965 11966 11967 11968 11969 11970 11971 11972 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11964 def to_hash { :id => id, :tracking => tracking.to_hash, :status => status.value, :carrier => carrier, :tracking_number => tracking_number } end |
#to_json ⇒ Object
11956 11957 11958 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11956 def to_json JSON.dump(to_hash) end |