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.



43494
43495
43496
43497
43498
43499
43500
43501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43494

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)
  @includes = (x = opts.delete(:includes); x.is_a?(::Io::Flow::V0::Models::IncludedLevyKey) ? x : ::Io::Flow::V0::Models::IncludedLevyKey.apply(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.



43492
43493
43494
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43492

def currency
  @currency
end

#includesObject (readonly)

Returns the value of attribute includes.



43492
43493
43494
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43492

def includes
  @includes
end

#nameObject (readonly)

Returns the value of attribute name.



43492
43493
43494
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43492

def name
  @name
end

#statusObject (readonly)

Returns the value of attribute status.



43492
43493
43494
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43492

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



43507
43508
43509
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43507

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

#to_hashObject



43511
43512
43513
43514
43515
43516
43517
43518
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43511

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

#to_jsonObject



43503
43504
43505
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43503

def to_json
  JSON.dump(to_hash)
end