Class: Io::Flow::V0::Models::TrackingLabelSummary

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 = {}) ⇒ TrackingLabelSummary

Returns a new instance of TrackingLabelSummary.



54774
54775
54776
54777
54778
54779
54780
54781
54782
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54774

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :tracking, :status, :carrier, :tracking_number], 'TrackingLabelSummary')
  @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

#carrierObject (readonly)

Returns the value of attribute carrier.



54772
54773
54774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54772

def carrier
  @carrier
end

#idObject (readonly)

Returns the value of attribute id.



54772
54773
54774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54772

def id
  @id
end

#statusObject (readonly)

Returns the value of attribute status.



54772
54773
54774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54772

def status
  @status
end

#trackingObject (readonly)

Returns the value of attribute tracking.



54772
54773
54774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54772

def tracking
  @tracking
end

#tracking_numberObject (readonly)

Returns the value of attribute tracking_number.



54772
54773
54774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54772

def tracking_number
  @tracking_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



54788
54789
54790
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54788

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

#to_hashObject



54792
54793
54794
54795
54796
54797
54798
54799
54800
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54792

def to_hash
  {
    :id => id,
    :tracking => tracking.to_hash,
    :status => status.value,
    :carrier => carrier,
    :tracking_number => tracking_number
  }
end

#to_jsonObject



54784
54785
54786
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54784

def to_json
  JSON.dump(to_hash)
end