Class: Io::Flow::V0::Models::ItemMarginPutForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ItemMarginPutForm
- 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.
-
#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 = {}) ⇒ ItemMarginPutForm
constructor
A new instance of ItemMarginPutForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ItemMarginPutForm
Returns a new instance of ItemMarginPutForm.
47232 47233 47234 47235 47236 47237 47238 47239 47240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47232 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
#fixed ⇒ Object (readonly)
Returns the value of attribute fixed.
47230 47231 47232 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47230 def fixed @fixed end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
47230 47231 47232 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47230 def name @name end |
#percent ⇒ Object (readonly)
Returns the value of attribute percent.
47230 47231 47232 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47230 def percent @percent end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
47230 47231 47232 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47230 def position @position end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
47230 47231 47232 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47230 def q @q end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
47246 47247 47248 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47246 def copy(incoming={}) ItemMarginPutForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
47250 47251 47252 47253 47254 47255 47256 47257 47258 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47250 def to_hash { :name => name, :q => q, :fixed => fixed.to_f.to_s, :percent => percent.to_f.to_s, :position => position } end |
#to_json ⇒ Object
47242 47243 47244 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47242 def to_json JSON.dump(to_hash) end |