Class: AdvancedBilling::DunningStepData

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/dunning_step_data.rb

Overview

DunningStepData Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(day_threshold = nil, action = nil, send_email = nil, send_bcc_email = nil, send_sms = nil, email_body = SKIP, email_subject = SKIP, sms_body = SKIP) ⇒ 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 = nil,
               action = nil,
               send_email = nil,
               send_bcc_email = nil,
               send_sms = nil,
               email_body = SKIP,
               email_subject = SKIP,
               sms_body = SKIP)
  @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
end

Instance Attribute Details

#actionString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 18

def action
  @action
end

#day_thresholdInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 14

def day_threshold
  @day_threshold
end

#email_bodyString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 22

def email_body
  @email_body
end

#email_subjectString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 26

def email_subject
  @email_subject
end

#send_bcc_emailTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 34

def send_bcc_email
  @send_bcc_email
end

#send_emailTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 30

def send_email
  @send_email
end

#send_smsTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


38
39
40
# File 'lib/advanced_billing/models/dunning_step_data.rb', line 38

def send_sms
  @send_sms
end

#sms_bodyString

TODO: Write general description for this method

Returns:

  • (String)


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
# 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

  # Create object from extracted values.
  DunningStepData.new(day_threshold,
                      action,
                      send_email,
                      send_bcc_email,
                      send_sms,
                      email_body,
                      email_subject,
                      sms_body)
end

.namesObject

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

.nullablesObject

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

.optionalsObject

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