Class: PaypalServerSdk::Frequency
- Defined in:
- lib/paypal_server_sdk/models/frequency.rb
Overview
The frequency of the billing cycle.
Instance Attribute Summary collapse
-
#interval_count ⇒ Integer
The number of intervals after which a subscriber is billed.
-
#interval_unit ⇒ IntervalUnit
The interval at which the subscription is charged or billed.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(interval_unit:, interval_count: 1) ⇒ Frequency
constructor
A new instance of Frequency.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(interval_unit:, interval_count: 1) ⇒ Frequency
Returns a new instance of Frequency.
44 45 46 47 |
# File 'lib/paypal_server_sdk/models/frequency.rb', line 44 def initialize(interval_unit:, interval_count: 1) @interval_unit = interval_unit @interval_count = interval_count unless interval_count == SKIP end |
Instance Attribute Details
#interval_count ⇒ Integer
The number of intervals after which a subscriber is billed. For example, if the ‘interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`: Interval unit Maximum interval count DAY 365 WEEK 52 MONTH 12 YEAR 1
22 23 24 |
# File 'lib/paypal_server_sdk/models/frequency.rb', line 22 def interval_count @interval_count end |
#interval_unit ⇒ IntervalUnit
The interval at which the subscription is charged or billed.
14 15 16 |
# File 'lib/paypal_server_sdk/models/frequency.rb', line 14 def interval_unit @interval_unit end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/paypal_server_sdk/models/frequency.rb', line 50 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : nil interval_count = hash['interval_count'] ||= 1 # Create object from extracted values. Frequency.new(interval_unit: interval_unit, interval_count: interval_count) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 |
# File 'lib/paypal_server_sdk/models/frequency.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['interval_unit'] = 'interval_unit' @_hash['interval_count'] = 'interval_count' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/paypal_server_sdk/models/frequency.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
33 34 35 36 37 |
# File 'lib/paypal_server_sdk/models/frequency.rb', line 33 def self.optionals %w[ interval_count ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
69 70 71 72 73 |
# File 'lib/paypal_server_sdk/models/frequency.rb', line 69 def inspect class_name = self.class.name.split('::').last "<#{class_name} interval_unit: #{@interval_unit.inspect}, interval_count:"\ " #{@interval_count.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
63 64 65 66 |
# File 'lib/paypal_server_sdk/models/frequency.rb', line 63 def to_s class_name = self.class.name.split('::').last "<#{class_name} interval_unit: #{@interval_unit}, interval_count: #{@interval_count}>" end |