Class: Io::Flow::V0::Models::ReturnForm

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

Returns a new instance of ReturnForm.



47903
47904
47905
47906
47907
47908
47909
47910
47911
47912
47913
47914
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47903

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:items], 'ReturnForm')
  @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ReturnLineItem) ? x : ::Io::Flow::V0::Models::ReturnLineItem.new(x)) }
  @tier_id = (x = opts.delete(:tier_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('tier_id', x, String))
  @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String))
  @service = (x = opts.delete(:service); x.nil? ? nil : HttpClient::Preconditions.assert_class('service', x, String))
  @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)))
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @origin = (x = opts.delete(:origin); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)))
  @center_key = (x = opts.delete(:center_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('center_key', x, String))
end

Instance Attribute Details

#center_keyObject (readonly)

Returns the value of attribute center_key.



47901
47902
47903
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47901

def center_key
  @center_key
end

#destinationObject (readonly)

Returns the value of attribute destination.



47901
47902
47903
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47901

def destination
  @destination
end

#itemsObject (readonly)

Returns the value of attribute items.



47901
47902
47903
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47901

def items
  @items
end

#keyObject (readonly)

Returns the value of attribute key.



47901
47902
47903
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47901

def key
  @key
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



47901
47902
47903
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47901

def order_number
  @order_number
end

#originObject (readonly)

Returns the value of attribute origin.



47901
47902
47903
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47901

def origin
  @origin
end

#serviceObject (readonly)

Returns the value of attribute service.



47901
47902
47903
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47901

def service
  @service
end

#tier_idObject (readonly)

Returns the value of attribute tier_id.



47901
47902
47903
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47901

def tier_id
  @tier_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47920
47921
47922
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47920

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

#to_hashObject



47924
47925
47926
47927
47928
47929
47930
47931
47932
47933
47934
47935
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47924

def to_hash
  {
    :items => items.map { |o| o.to_hash },
    :tier_id => tier_id,
    :order_number => order_number,
    :service => service,
    :destination => destination.nil? ? nil : destination.to_hash,
    :key => key,
    :origin => origin.nil? ? nil : origin.to_hash,
    :center_key => center_key
  }
end

#to_jsonObject



47916
47917
47918
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47916

def to_json
  JSON.dump(to_hash)
end