Class: ApiReference::ReplacePlanPriceParams

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

Overview

ReplacePlanPriceParams 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(replaces_price_id:, price: SKIP, allocation_price: SKIP, license_allocation_price: SKIP, plan_phase_order: SKIP) ⇒ ReplacePlanPriceParams

Returns a new instance of ReplacePlanPriceParams.



63
64
65
66
67
68
69
70
# File 'lib/api_reference/models/replace_plan_price_params.rb', line 63

def initialize(replaces_price_id:, price: SKIP, allocation_price: SKIP,
               license_allocation_price: SKIP, plan_phase_order: SKIP)
  @price = price unless price == SKIP
  @allocation_price = allocation_price unless allocation_price == SKIP
  @license_allocation_price = license_allocation_price unless license_allocation_price == SKIP
  @replaces_price_id = replaces_price_id
  @plan_phase_order = plan_phase_order unless plan_phase_order == SKIP
end

Instance Attribute Details

#allocation_priceNewAllocationPrice

The allocation price to add to the plan.

Returns:



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

def allocation_price
  @allocation_price
end

#license_allocation_priceNewLicenseAllocationUnitPrice

The license allocation price to add to the plan.



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

def license_allocation_price
  @license_allocation_price
end

#plan_phase_orderInteger

The phase to replace this price from.

Returns:

  • (Integer)


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

def plan_phase_order
  @plan_phase_order
end

#priceObject

The price to add to the plan

Returns:

  • (Object)


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

def price
  @price
end

#replaces_price_idString

The id of the price on the plan to replace in the plan.

Returns:

  • (String)


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

def replaces_price_id
  @replaces_price_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/api_reference/models/replace_plan_price_params.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  replaces_price_id =
    hash.key?('replaces_price_id') ? hash['replaces_price_id'] : nil
  price = hash.key?('price') ? hash['price'] : SKIP
  allocation_price = NewAllocationPrice.from_hash(hash['allocation_price']) if
    hash['allocation_price']
  if hash['license_allocation_price']
    license_allocation_price = NewLicenseAllocationUnitPrice.from_hash(hash['license_allocation_price'])
  end
  plan_phase_order =
    hash.key?('plan_phase_order') ? hash['plan_phase_order'] : SKIP

  # Create object from extracted values.
  ReplacePlanPriceParams.new(replaces_price_id: replaces_price_id,
                             price: price,
                             allocation_price: allocation_price,
                             license_allocation_price: license_allocation_price,
                             plan_phase_order: plan_phase_order)
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/replace_plan_price_params.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['price'] = 'price'
  @_hash['allocation_price'] = 'allocation_price'
  @_hash['license_allocation_price'] = 'license_allocation_price'
  @_hash['replaces_price_id'] = 'replaces_price_id'
  @_hash['plan_phase_order'] = 'plan_phase_order'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
57
58
59
60
61
# File 'lib/api_reference/models/replace_plan_price_params.rb', line 54

def self.nullables
  %w[
    price
    allocation_price
    license_allocation_price
    plan_phase_order
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    price
    allocation_price
    license_allocation_price
    plan_phase_order
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



105
106
107
108
109
110
# File 'lib/api_reference/models/replace_plan_price_params.rb', line 105

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} price: #{@price.inspect}, allocation_price: #{@allocation_price.inspect},"\
  " license_allocation_price: #{@license_allocation_price.inspect}, replaces_price_id:"\
  " #{@replaces_price_id.inspect}, plan_phase_order: #{@plan_phase_order.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



97
98
99
100
101
102
# File 'lib/api_reference/models/replace_plan_price_params.rb', line 97

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} price: #{@price}, allocation_price: #{@allocation_price},"\
  " license_allocation_price: #{@license_allocation_price}, replaces_price_id:"\
  " #{@replaces_price_id}, plan_phase_order: #{@plan_phase_order}>"
end