Class: Io::Flow::V0::Models::PriceBookForm

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

Overview

Represents a price book for a specific currency that can override any subset of item prices within an experience.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PriceBookForm

Returns a new instance of PriceBookForm.



27326
27327
27328
27329
27330
27331
27332
27333
27334
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27326

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:currency, :name, :includes], 'PriceBookForm')
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @includes = (x = opts.delete(:includes); x.is_a?(::Io::Flow::V0::Models::IncludedLevies) ? x : ::Io::Flow::V0::Models::IncludedLevies.new(x))
  @status = (x = (x = opts.delete(:status); x.nil? ? "draft" : x); x.is_a?(::Io::Flow::V0::Models::PriceBookStatus) ? x : ::Io::Flow::V0::Models::PriceBookStatus.apply(x))
end

Instance Attribute Details

#currencyObject (readonly)

Returns the value of attribute currency.



27324
27325
27326
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27324

def currency
  @currency
end

#includesObject (readonly)

Returns the value of attribute includes.



27324
27325
27326
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27324

def includes
  @includes
end

#keyObject (readonly)

Returns the value of attribute key.



27324
27325
27326
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27324

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



27324
27325
27326
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27324

def name
  @name
end

#statusObject (readonly)

Returns the value of attribute status.



27324
27325
27326
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27324

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27340
27341
27342
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27340

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

#to_hashObject



27344
27345
27346
27347
27348
27349
27350
27351
27352
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27344

def to_hash
  {
    :currency => currency,
    :name => name,
    :key => key,
    :includes => includes.to_hash,
    :status => status.value
  }
end

#to_jsonObject



27336
27337
27338
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27336

def to_json
  JSON.dump(to_hash)
end