Class: Io::Flow::V0::Models::LandedCostItem

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

Overview

Tuple of item number, origin (from) country and destination (to) country

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LandedCostItem

Returns a new instance of LandedCostItem.



44882
44883
44884
44885
44886
44887
44888
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44882

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:number, :origin, :destination], 'LandedCostItem')
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @origin = HttpClient::Preconditions.assert_class('origin', opts.delete(:origin), String)
  @destination = HttpClient::Preconditions.assert_class('destination', opts.delete(:destination), String)
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



44880
44881
44882
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44880

def destination
  @destination
end

#numberObject (readonly)

Returns the value of attribute number.



44880
44881
44882
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44880

def number
  @number
end

#originObject (readonly)

Returns the value of attribute origin.



44880
44881
44882
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44880

def origin
  @origin
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44894
44895
44896
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44894

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

#to_hashObject



44898
44899
44900
44901
44902
44903
44904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44898

def to_hash
  {
    :number => number,
    :origin => origin,
    :destination => destination
  }
end

#to_jsonObject



44890
44891
44892
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44890

def to_json
  JSON.dump(to_hash)
end