Class: ApiReference::EvaluatePriceResourceForMultiplePrice

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb

Overview

EvaluatePriceResourceForMultiplePrice Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(price_groups:, currency:, price_id: SKIP, external_price_id: SKIP, inline_price_index: SKIP, additional_properties: nil) ⇒ EvaluatePriceResourceForMultiplePrice

Returns a new instance of EvaluatePriceResourceForMultiplePrice.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 61

def initialize(price_groups:, currency:, price_id: SKIP,
               external_price_id: SKIP, inline_price_index: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @price_groups = price_groups
  @currency = currency
  @price_id = price_id unless price_id == SKIP
  @external_price_id = external_price_id unless external_price_id == SKIP
  @inline_price_index = inline_price_index unless inline_price_index == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#currencyString

The currency of the price

Returns:

  • (String)


18
19
20
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 18

def currency
  @currency
end

#external_price_idString

The external ID of the price

Returns:

  • (String)


26
27
28
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 26

def external_price_id
  @external_price_id
end

#inline_price_indexInteger

The index of the inline price

Returns:

  • (Integer)


30
31
32
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 30

def inline_price_index
  @inline_price_index
end

#price_groupsArray[EvaluatePriceGroup]

The computed price groups associated with input price.

Returns:



14
15
16
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 14

def price_groups
  @price_groups
end

#price_idString

The ID of the price

Returns:

  • (String)


22
23
24
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 22

def price_id
  @price_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  price_groups = nil
  unless hash['price_groups'].nil?
    price_groups = []
    hash['price_groups'].each do |structure|
      price_groups << (EvaluatePriceGroup.from_hash(structure) if structure)
    end
  end

  price_groups = nil unless hash.key?('price_groups')
  currency = hash.key?('currency') ? hash['currency'] : nil
  price_id = hash.key?('price_id') ? hash['price_id'] : SKIP
  external_price_id =
    hash.key?('external_price_id') ? hash['external_price_id'] : SKIP
  inline_price_index =
    hash.key?('inline_price_index') ? hash['inline_price_index'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  EvaluatePriceResourceForMultiplePrice.new(price_groups: price_groups,
                                            currency: currency,
                                            price_id: price_id,
                                            external_price_id: external_price_id,
                                            inline_price_index: inline_price_index,
                                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['price_groups'] = 'price_groups'
  @_hash['currency'] = 'currency'
  @_hash['price_id'] = 'price_id'
  @_hash['external_price_id'] = 'external_price_id'
  @_hash['inline_price_index'] = 'inline_price_index'
  @_hash
end

.nullablesObject

An array for nullable fields



53
54
55
56
57
58
59
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 53

def self.nullables
  %w[
    price_id
    external_price_id
    inline_price_index
  ]
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 44

def self.optionals
  %w[
    price_id
    external_price_id
    inline_price_index
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
128
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} price_groups: #{@price_groups.inspect}, currency: #{@currency.inspect},"\
  " price_id: #{@price_id.inspect}, external_price_id: #{@external_price_id.inspect},"\
  " inline_price_index: #{@inline_price_index.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



114
115
116
117
118
119
# File 'lib/api_reference/models/evaluate_price_resource_for_multiple_price.rb', line 114

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} price_groups: #{@price_groups}, currency: #{@currency}, price_id:"\
  " #{@price_id}, external_price_id: #{@external_price_id}, inline_price_index:"\
  " #{@inline_price_index}, additional_properties: #{@additional_properties}>"
end