class Io::Flow::V0::Models::ReturnLineItem

Attributes

attributes[R]
item_number[R]
notes[R]
order_number[R]
quantity[R]
reason[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 64088
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:item_number, :quantity], 'ReturnLineItem')
  @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String)
  @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String))
  @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
  @reason = (x = opts.delete(:reason); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ReturnReason) ? x : ::Io::Flow::V0::Models::ReturnReason.new(x)))
  @notes = (x = opts.delete(:notes); x.nil? ? nil : HttpClient::Preconditions.assert_class('notes', x, String))
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 64103
def copy(incoming={})
  ReturnLineItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 64107
def to_hash
  {
    :item_number => item_number,
    :order_number => order_number,
    :quantity => quantity,
    :reason => reason.nil? ? nil : reason.to_hash,
    :notes => notes,
    :attributes => attributes.nil? ? nil : attributes
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 64099
def to_json
  JSON.dump(to_hash)
end