Class: AdvancedBilling::CalendarBilling
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CalendarBilling
- Defined in:
- lib/advanced_billing/models/calendar_billing.rb
Overview
(Optional). Cannot be used when also specifying next_billing_at
Instance Attribute Summary collapse
-
#calendar_billing_first_charge ⇒ FirstChargeType
A day of month that subscription will be processed on.
-
#snap_day ⇒ Object
A day of month that subscription will be processed on.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(snap_day: SKIP, calendar_billing_first_charge: SKIP, additional_properties: {}) ⇒ CalendarBilling
constructor
A new instance of CalendarBilling.
Methods inherited from BaseModel
Constructor Details
#initialize(snap_day: SKIP, calendar_billing_first_charge: SKIP, additional_properties: {}) ⇒ CalendarBilling
Returns a new instance of CalendarBilling.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/advanced_billing/models/calendar_billing.rb', line 44 def initialize(snap_day: SKIP, calendar_billing_first_charge: SKIP, additional_properties: {}) @snap_day = snap_day unless snap_day == SKIP unless calendar_billing_first_charge == SKIP @calendar_billing_first_charge = calendar_billing_first_charge end # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#calendar_billing_first_charge ⇒ FirstChargeType
A day of month that subscription will be processed on. Can be 1 up to 28 or ‘end’.
20 21 22 |
# File 'lib/advanced_billing/models/calendar_billing.rb', line 20 def calendar_billing_first_charge @calendar_billing_first_charge end |
#snap_day ⇒ Object
A day of month that subscription will be processed on. Can be 1 up to 28 or ‘end’.
15 16 17 |
# File 'lib/advanced_billing/models/calendar_billing.rb', line 15 def snap_day @snap_day end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/advanced_billing/models/calendar_billing.rb', line 59 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. snap_day = hash.key?('snap_day') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CalendarBillingSnapDay), hash['snap_day'] ) : SKIP calendar_billing_first_charge = hash.key?('calendar_billing_first_charge') ? hash['calendar_billing_first_charge'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. CalendarBilling.new(snap_day: snap_day, calendar_billing_first_charge: calendar_billing_first_charge, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
23 24 25 26 27 28 29 |
# File 'lib/advanced_billing/models/calendar_billing.rb', line 23 def self.names @_hash = {} if @_hash.nil? @_hash['snap_day'] = 'snap_day' @_hash['calendar_billing_first_charge'] = 'calendar_billing_first_charge' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/advanced_billing/models/calendar_billing.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
32 33 34 35 36 37 |
# File 'lib/advanced_billing/models/calendar_billing.rb', line 32 def self.optionals %w[ snap_day calendar_billing_first_charge ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
80 81 82 83 84 85 86 |
# File 'lib/advanced_billing/models/calendar_billing.rb', line 80 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |