Class: Io::Flow::V0::Models::ItemMarginPutForm

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

Overview

A percent and/or fixed margin to apply to items based on query.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ItemMarginPutForm

Returns a new instance of ItemMarginPutForm.



27454
27455
27456
27457
27458
27459
27460
27461
27462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27454

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name, :q], 'ItemMarginPutForm')
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String)
  @fixed = (x = opts.delete(:fixed); x.nil? ? nil : HttpClient::Preconditions.assert_class('fixed', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @percent = (x = opts.delete(:percent); x.nil? ? nil : HttpClient::Preconditions.assert_class('percent', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @position = (x = opts.delete(:position); x.nil? ? nil : HttpClient::Preconditions.assert_class('position', x, Integer))
end

Instance Attribute Details

#fixedObject (readonly)

Returns the value of attribute fixed.



27452
27453
27454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27452

def fixed
  @fixed
end

#nameObject (readonly)

Returns the value of attribute name.



27452
27453
27454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27452

def name
  @name
end

#percentObject (readonly)

Returns the value of attribute percent.



27452
27453
27454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27452

def percent
  @percent
end

#positionObject (readonly)

Returns the value of attribute position.



27452
27453
27454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27452

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



27452
27453
27454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27452

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27468
27469
27470
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27468

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

#to_hashObject



27472
27473
27474
27475
27476
27477
27478
27479
27480
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27472

def to_hash
  {
    :name => name,
    :q => q,
    :fixed => fixed,
    :percent => percent,
    :position => position
  }
end

#to_jsonObject



27464
27465
27466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27464

def to_json
  JSON.dump(to_hash)
end