Class: Io::Flow::V0::Models::ItemMarginPostForm

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

Returns a new instance of ItemMarginPostForm.



25402
25403
25404
25405
25406
25407
25408
25409
25410
25411
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25402

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name, :q], 'ItemMarginPostForm')
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String)
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, 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.



25400
25401
25402
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25400

def fixed
  @fixed
end

#keyObject (readonly)

Returns the value of attribute key.



25400
25401
25402
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25400

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



25400
25401
25402
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25400

def name
  @name
end

#percentObject (readonly)

Returns the value of attribute percent.



25400
25401
25402
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25400

def percent
  @percent
end

#positionObject (readonly)

Returns the value of attribute position.



25400
25401
25402
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25400

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



25400
25401
25402
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25400

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25417
25418
25419
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25417

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

#to_hashObject



25421
25422
25423
25424
25425
25426
25427
25428
25429
25430
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25421

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

#to_jsonObject



25413
25414
25415
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25413

def to_json
  JSON.dump(to_hash)
end