Class: Io::Flow::V0::Models::TrackingLabelForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TrackingLabelForm
- 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.
-
#carrier_tracking_number ⇒ Object
readonly
Returns the value of attribute carrier_tracking_number.
-
#delivery_estimate ⇒ Object
readonly
Returns the value of attribute delivery_estimate.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#parent_id ⇒ Object
readonly
Returns the value of attribute parent_id.
-
#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.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TrackingLabelForm
constructor
A new instance of TrackingLabelForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TrackingLabelForm
Returns a new instance of TrackingLabelForm.
24330 24331 24332 24333 24334 24335 24336 24337 24338 24339 24340 24341 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24330 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:tracking_id, :carrier, :carrier_tracking_number], 'TrackingLabelForm') @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) @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_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)) @parent_id = (x = opts.delete(:parent_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('parent_id', x, String)) end |
Instance Attribute Details
#carrier ⇒ Object (readonly)
Returns the value of attribute carrier.
24328 24329 24330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24328 def carrier @carrier end |
#carrier_tracking_number ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number.
24328 24329 24330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24328 def carrier_tracking_number @carrier_tracking_number end |
#delivery_estimate ⇒ Object (readonly)
Returns the value of attribute delivery_estimate.
24328 24329 24330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24328 def delivery_estimate @delivery_estimate end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
24328 24329 24330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24328 def description @description end |
#parent_id ⇒ Object (readonly)
Returns the value of attribute parent_id.
24328 24329 24330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24328 def parent_id @parent_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
24328 24329 24330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24328 def status @status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
24328 24329 24330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24328 def end |
#tracking_id ⇒ Object (readonly)
Returns the value of attribute tracking_id.
24328 24329 24330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24328 def tracking_id @tracking_id end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
24347 24348 24349 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24347 def copy(incoming={}) TrackingLabelForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
24351 24352 24353 24354 24355 24356 24357 24358 24359 24360 24361 24362 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24351 def to_hash { :tracking_id => tracking_id, :status => status.value, :carrier => carrier, :carrier_tracking_number => carrier_tracking_number, :delivery_estimate => delivery_estimate, :description => description, :timestamp => , :parent_id => parent_id } end |
#to_json ⇒ Object
24343 24344 24345 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24343 def to_json JSON.dump(to_hash) end |