Class: AdvancedBilling::DunningStepData
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::DunningStepData
- Defined in:
- lib/advanced_billing/models/dunning_step_data.rb
Overview
DunningStepData Model.
Instance Attribute Summary collapse
-
#action ⇒ String
TODO: Write general description for this method.
-
#day_threshold ⇒ Integer
TODO: Write general description for this method.
-
#email_body ⇒ String
TODO: Write general description for this method.
-
#email_subject ⇒ String
TODO: Write general description for this method.
-
#send_bcc_email ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#send_email ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#send_sms ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#sms_body ⇒ String
TODO: Write general description for this method.
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(day_threshold:, action:, send_email:, send_bcc_email:, send_sms:, email_body: SKIP, email_subject: SKIP, sms_body: SKIP, additional_properties: {}) ⇒ DunningStepData
constructor
A new instance of DunningStepData.
Methods inherited from BaseModel
Constructor Details
#initialize(day_threshold:, action:, send_email:, send_bcc_email:, send_sms:, email_body: SKIP, email_subject: SKIP, sms_body: SKIP, additional_properties: {}) ⇒ DunningStepData
Returns a new instance of DunningStepData.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 76 def initialize(day_threshold:, action:, send_email:, send_bcc_email:, send_sms:, email_body: SKIP, email_subject: SKIP, sms_body: SKIP, additional_properties: {}) @day_threshold = day_threshold @action = action @email_body = email_body unless email_body == SKIP @email_subject = email_subject unless email_subject == SKIP @send_email = send_email @send_bcc_email = send_bcc_email @send_sms = send_sms @sms_body = sms_body unless sms_body == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#action ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 18 def action @action end |
#day_threshold ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 14 def day_threshold @day_threshold end |
#email_body ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 22 def email_body @email_body end |
#email_subject ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 26 def email_subject @email_subject end |
#send_bcc_email ⇒ TrueClass | FalseClass
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 34 def send_bcc_email @send_bcc_email end |
#send_email ⇒ TrueClass | FalseClass
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 30 def send_email @send_email end |
#send_sms ⇒ TrueClass | FalseClass
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 38 def send_sms @send_sms end |
#sms_body ⇒ String
TODO: Write general description for this method
42 43 44 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 42 def sms_body @sms_body end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 95 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. day_threshold = hash.key?('day_threshold') ? hash['day_threshold'] : nil action = hash.key?('action') ? hash['action'] : nil send_email = hash.key?('send_email') ? hash['send_email'] : nil send_bcc_email = hash.key?('send_bcc_email') ? hash['send_bcc_email'] : nil send_sms = hash.key?('send_sms') ? hash['send_sms'] : nil email_body = hash.key?('email_body') ? hash['email_body'] : SKIP email_subject = hash.key?('email_subject') ? hash['email_subject'] : SKIP sms_body = hash.key?('sms_body') ? hash['sms_body'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. DunningStepData.new(day_threshold: day_threshold, action: action, send_email: send_email, send_bcc_email: send_bcc_email, send_sms: send_sms, email_body: email_body, email_subject: email_subject, sms_body: sms_body, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['day_threshold'] = 'day_threshold' @_hash['action'] = 'action' @_hash['email_body'] = 'email_body' @_hash['email_subject'] = 'email_subject' @_hash['send_email'] = 'send_email' @_hash['send_bcc_email'] = 'send_bcc_email' @_hash['send_sms'] = 'send_sms' @_hash['sms_body'] = 'sms_body' @_hash end |
.nullables ⇒ Object
An array for nullable fields
68 69 70 71 72 73 74 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 68 def self.nullables %w[ email_body email_subject sms_body ] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 65 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 59 def self.optionals %w[ email_body email_subject sms_body ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 126 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.day_threshold, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.action, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.send_email, ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and APIHelper.valid_type?(value.send_bcc_email, ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and APIHelper.valid_type?(value.send_sms, ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['day_threshold'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['action'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['send_email'], ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and APIHelper.valid_type?(value['send_bcc_email'], ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and APIHelper.valid_type?(value['send_sms'], ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) ) end |