Class: PaypalServerSdk::CycleExecution

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/cycle_execution.rb

Overview

The regular and trial execution details for a billing cycle.

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(tenure_type:, sequence:, cycles_completed:, cycles_remaining: SKIP, current_pricing_scheme_version: SKIP, total_cycles: SKIP) ⇒ CycleExecution

Returns a new instance of CycleExecution.



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 68

def initialize(tenure_type:, sequence:, cycles_completed:,
               cycles_remaining: SKIP, current_pricing_scheme_version: SKIP,
               total_cycles: SKIP)
  @tenure_type = tenure_type
  @sequence = sequence
  @cycles_completed = cycles_completed
  @cycles_remaining = cycles_remaining unless cycles_remaining == SKIP
  unless current_pricing_scheme_version == SKIP
    @current_pricing_scheme_version =
      current_pricing_scheme_version
  end
  @total_cycles = total_cycles unless total_cycles == SKIP
end

Instance Attribute Details

#current_pricing_scheme_versionInteger

The active pricing scheme version for the billing cycle.

Returns:

  • (Integer)


31
32
33
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 31

def current_pricing_scheme_version
  @current_pricing_scheme_version
end

#cycles_completedInteger

The number of billing cycles that have completed.

Returns:

  • (Integer)


22
23
24
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 22

def cycles_completed
  @cycles_completed
end

#cycles_remainingInteger

For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0.

Returns:

  • (Integer)


27
28
29
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 27

def cycles_remaining
  @cycles_remaining
end

#sequenceInteger

The order in which to run this cycle among other billing cycles.

Returns:

  • (Integer)


18
19
20
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 18

def sequence
  @sequence
end

#tenure_typeTenureType

The type of the billing cycle.

Returns:



14
15
16
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 14

def tenure_type
  @tenure_type
end

#total_cyclesInteger

The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles).

Returns:

  • (Integer)


39
40
41
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 39

def total_cycles
  @total_cycles
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  tenure_type = hash.key?('tenure_type') ? hash['tenure_type'] : nil
  sequence = hash.key?('sequence') ? hash['sequence'] : nil
  cycles_completed =
    hash.key?('cycles_completed') ? hash['cycles_completed'] : nil
  cycles_remaining =
    hash.key?('cycles_remaining') ? hash['cycles_remaining'] : SKIP
  current_pricing_scheme_version =
    hash.key?('current_pricing_scheme_version') ? hash['current_pricing_scheme_version'] : SKIP
  total_cycles = hash.key?('total_cycles') ? hash['total_cycles'] : SKIP

  # Create object from extracted values.

  CycleExecution.new(tenure_type: tenure_type,
                     sequence: sequence,
                     cycles_completed: cycles_completed,
                     cycles_remaining: cycles_remaining,
                     current_pricing_scheme_version: current_pricing_scheme_version,
                     total_cycles: total_cycles)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['tenure_type'] = 'tenure_type'
  @_hash['sequence'] = 'sequence'
  @_hash['cycles_completed'] = 'cycles_completed'
  @_hash['cycles_remaining'] = 'cycles_remaining'
  @_hash['current_pricing_scheme_version'] =
    'current_pricing_scheme_version'
  @_hash['total_cycles'] = 'total_cycles'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 55

def self.optionals
  %w[
    cycles_remaining
    current_pricing_scheme_version
    total_cycles
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
122
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} tenure_type: #{@tenure_type.inspect}, sequence: #{@sequence.inspect},"\
  " cycles_completed: #{@cycles_completed.inspect}, cycles_remaining:"\
  " #{@cycles_remaining.inspect}, current_pricing_scheme_version:"\
  " #{@current_pricing_scheme_version.inspect}, total_cycles: #{@total_cycles.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
113
# File 'lib/paypal_server_sdk/models/cycle_execution.rb', line 107

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} tenure_type: #{@tenure_type}, sequence: #{@sequence}, cycles_completed:"\
  " #{@cycles_completed}, cycles_remaining: #{@cycles_remaining},"\
  " current_pricing_scheme_version: #{@current_pricing_scheme_version}, total_cycles:"\
  " #{@total_cycles}>"
end