Class: Io::Flow::V0::Models::PriceBook

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

Overview

Represents a list of target prices in 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 = {}) ⇒ PriceBook

Returns a new instance of PriceBook.



39253
39254
39255
39256
39257
39258
39259
39260
39261
39262
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39253

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :key, :currency, :name, :includes, :status], 'PriceBook')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @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::IncludedLevies) ? x : ::Io::Flow::V0::Models::IncludedLevies.new(x))
  @status = (x = opts.delete(:status); 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.



39251
39252
39253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39251

def currency
  @currency
end

#idObject (readonly)

Returns the value of attribute id.



39251
39252
39253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39251

def id
  @id
end

#includesObject (readonly)

Returns the value of attribute includes.



39251
39252
39253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39251

def includes
  @includes
end

#keyObject (readonly)

Returns the value of attribute key.



39251
39252
39253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39251

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



39251
39252
39253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39251

def name
  @name
end

#statusObject (readonly)

Returns the value of attribute status.



39251
39252
39253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39251

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39268
39269
39270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39268

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

#to_hashObject



39272
39273
39274
39275
39276
39277
39278
39279
39280
39281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39272

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

#to_jsonObject



39264
39265
39266
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39264

def to_json
  JSON.dump(to_hash)
end