Class: Io::Flow::V0::Models::ItemMarginPostForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ItemMarginPostForm
- 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
-
#fixed ⇒ Object
readonly
Returns the value of attribute fixed.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#percent ⇒ Object
readonly
Returns the value of attribute percent.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#q ⇒ Object
readonly
Returns the value of attribute q.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ItemMarginPostForm
constructor
A new instance of ItemMarginPostForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ItemMarginPostForm
Returns a new instance of ItemMarginPostForm.
36419 36420 36421 36422 36423 36424 36425 36426 36427 36428 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36419 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
#fixed ⇒ Object (readonly)
Returns the value of attribute fixed.
36417 36418 36419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36417 def fixed @fixed end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
36417 36418 36419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36417 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
36417 36418 36419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36417 def name @name end |
#percent ⇒ Object (readonly)
Returns the value of attribute percent.
36417 36418 36419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36417 def percent @percent end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
36417 36418 36419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36417 def position @position end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
36417 36418 36419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36417 def q @q end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36434 36435 36436 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36434 def copy(incoming={}) ItemMarginPostForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
36438 36439 36440 36441 36442 36443 36444 36445 36446 36447 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36438 def to_hash { :name => name, :q => q, :key => key, :fixed => fixed.to_f.to_s, :percent => percent.to_f.to_s, :position => position } end |
#to_json ⇒ Object
36430 36431 36432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36430 def to_json JSON.dump(to_hash) end |