Class: Io::Flow::V0::Models::ReturnLineItem

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

Returns a new instance of ReturnLineItem.



25469
25470
25471
25472
25473
25474
25475
25476
25477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25469

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))
end

Instance Attribute Details

#item_numberObject (readonly)

Returns the value of attribute item_number.



25467
25468
25469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25467

def item_number
  @item_number
end

#notesObject (readonly)

Returns the value of attribute notes.



25467
25468
25469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25467

def notes
  @notes
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



25467
25468
25469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25467

def order_number
  @order_number
end

#quantityObject (readonly)

Returns the value of attribute quantity.



25467
25468
25469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25467

def quantity
  @quantity
end

#reasonObject (readonly)

Returns the value of attribute reason.



25467
25468
25469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25467

def reason
  @reason
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25483
25484
25485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25483

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

#to_hashObject



25487
25488
25489
25490
25491
25492
25493
25494
25495
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25487

def to_hash
  {
    :item_number => item_number,
    :order_number => order_number,
    :quantity => quantity,
    :reason => reason.nil? ? nil : reason.to_hash,
    :notes => notes
  }
end

#to_jsonObject



25479
25480
25481
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25479

def to_json
  JSON.dump(to_hash)
end