Class: Io::Flow::V0::Models::LabelTrackingSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LabelTrackingSummary

Returns a new instance of LabelTrackingSummary.



48132
48133
48134
48135
48136
48137
48138
48139
48140
48141
48142
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48132

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :carrier_service, :carrier_tracking_number, :in_transit], 'LabelTrackingSummary')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @carrier_service = (x = opts.delete(:carrier_service); x.is_a?(::Io::Flow::V0::Models::LabelTrackingCarrierService) ? x : ::Io::Flow::V0::Models::LabelTrackingCarrierService.new(x))
  @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_tracking_number), String)
  @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String))
  @label = (x = opts.delete(:label); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LabelReference) ? x : ::Io::Flow::V0::Models::LabelReference.new(x)))
  @in_transit = (x = opts.delete(:in_transit); x.is_a?(::Io::Flow::V0::Models::LabelTrackingSummaryUpdate) ? x : ::Io::Flow::V0::Models::LabelTrackingSummaryUpdate.new(x))
  @delivered = (x = opts.delete(:delivered); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LabelTrackingSummaryUpdate) ? x : ::Io::Flow::V0::Models::LabelTrackingSummaryUpdate.new(x)))
end

Instance Attribute Details

#carrier_serviceObject (readonly)

Returns the value of attribute carrier_service.



48130
48131
48132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48130

def carrier_service
  @carrier_service
end

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



48130
48131
48132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48130

def carrier_tracking_number
  @carrier_tracking_number
end

#deliveredObject (readonly)

Returns the value of attribute delivered.



48130
48131
48132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48130

def delivered
  @delivered
end

#idObject (readonly)

Returns the value of attribute id.



48130
48131
48132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48130

def id
  @id
end

#in_transitObject (readonly)

Returns the value of attribute in_transit.



48130
48131
48132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48130

def in_transit
  @in_transit
end

#labelObject (readonly)

Returns the value of attribute label.



48130
48131
48132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48130

def label
  @label
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



48130
48131
48132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48130

def order_number
  @order_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48148
48149
48150
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48148

def copy(incoming={})
  LabelTrackingSummary.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



48152
48153
48154
48155
48156
48157
48158
48159
48160
48161
48162
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48152

def to_hash
  {
    :id => id,
    :carrier_service => carrier_service.to_hash,
    :carrier_tracking_number => carrier_tracking_number,
    :order_number => order_number,
    :label => label.nil? ? nil : label.to_hash,
    :in_transit => in_transit.to_hash,
    :delivered => delivered.nil? ? nil : delivered.to_hash
  }
end

#to_jsonObject



48144
48145
48146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48144

def to_json
  JSON.dump(to_hash)
end