Class: ApiReference::NewPlanPhase

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

Overview

NewPlanPhase 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(order:, duration: SKIP, duration_unit: SKIP, align_billing_with_phase_start_date: false) ⇒ NewPlanPhase

Returns a new instance of NewPlanPhase.



60
61
62
63
64
65
66
67
68
69
# File 'lib/api_reference/models/new_plan_phase.rb', line 60

def initialize(order:, duration: SKIP, duration_unit: SKIP,
               align_billing_with_phase_start_date: false)
  @order = order
  @duration = duration unless duration == SKIP
  @duration_unit = duration_unit unless duration_unit == SKIP
  unless align_billing_with_phase_start_date == SKIP
    @align_billing_with_phase_start_date =
      align_billing_with_phase_start_date
  end
end

Instance Attribute Details

#align_billing_with_phase_start_dateTrueClass | FalseClass

Align billing cycle day with phase start date.

Returns:

  • (TrueClass | FalseClass)


29
30
31
# File 'lib/api_reference/models/new_plan_phase.rb', line 29

def align_billing_with_phase_start_date
  @align_billing_with_phase_start_date
end

#durationInteger

How many terms of length duration_unit this phase is active for. If null, this phase is evergreen and active indefinitely

Returns:

  • (Integer)


20
21
22
# File 'lib/api_reference/models/new_plan_phase.rb', line 20

def duration
  @duration
end

#duration_unitDurationUnit3

How many terms of length duration_unit this phase is active for. If null, this phase is evergreen and active indefinitely

Returns:



25
26
27
# File 'lib/api_reference/models/new_plan_phase.rb', line 25

def duration_unit
  @duration_unit
end

#orderInteger

Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.

Returns:

  • (Integer)


15
16
17
# File 'lib/api_reference/models/new_plan_phase.rb', line 15

def order
  @order
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/api_reference/models/new_plan_phase.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  order = hash.key?('order') ? hash['order'] : nil
  duration = hash.key?('duration') ? hash['duration'] : SKIP
  duration_unit = hash.key?('duration_unit') ? hash['duration_unit'] : SKIP
  align_billing_with_phase_start_date =
    hash['align_billing_with_phase_start_date'] ||= false

  # Create object from extracted values.
  NewPlanPhase.new(order: order,
                   duration: duration,
                   duration_unit: duration_unit,
                   align_billing_with_phase_start_date: align_billing_with_phase_start_date)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['order'] = 'order'
  @_hash['duration'] = 'duration'
  @_hash['duration_unit'] = 'duration_unit'
  @_hash['align_billing_with_phase_start_date'] =
    'align_billing_with_phase_start_date'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    duration
    duration_unit
    align_billing_with_phase_start_date
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    duration
    duration_unit
    align_billing_with_phase_start_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} order: #{@order.inspect}, duration: #{@duration.inspect}, duration_unit:"\
  " #{@duration_unit.inspect}, align_billing_with_phase_start_date:"\
  " #{@align_billing_with_phase_start_date.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



90
91
92
93
94
# File 'lib/api_reference/models/new_plan_phase.rb', line 90

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} order: #{@order}, duration: #{@duration}, duration_unit: #{@duration_unit},"\
  " align_billing_with_phase_start_date: #{@align_billing_with_phase_start_date}>"
end