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.



48056
48057
48058
48059
48060
48061
48062
48063
48064
48065
48066
48067
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48056

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.



48054
48055
48056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48054

def center_key
  @center_key
end

#destinationObject (readonly)

Returns the value of attribute destination.



48054
48055
48056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48054

def destination
  @destination
end

#itemsObject (readonly)

Returns the value of attribute items.



48054
48055
48056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48054

def items
  @items
end

#keyObject (readonly)

Returns the value of attribute key.



48054
48055
48056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48054

def key
  @key
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



48054
48055
48056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48054

def order_number
  @order_number
end

#originObject (readonly)

Returns the value of attribute origin.



48054
48055
48056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48054

def origin
  @origin
end

#serviceObject (readonly)

Returns the value of attribute service.



48054
48055
48056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48054

def service
  @service
end

#tier_idObject (readonly)

Returns the value of attribute tier_id.



48054
48055
48056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48054

def tier_id
  @tier_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48073
48074
48075
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48073

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

#to_hashObject



48077
48078
48079
48080
48081
48082
48083
48084
48085
48086
48087
48088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48077

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



48069
48070
48071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48069

def to_json
  JSON.dump(to_hash)
end