Class: Verizon::Keyschunk2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/keyschunk2.rb

Overview

Keyschunk2 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(data_percentage50 = SKIP, data_percentage75 = SKIP, data_percentage90 = SKIP, data_percentage100 = SKIP, sms_percentage50 = SKIP, sms_percentage75 = SKIP, sms_percentage90 = SKIP, sms_percentage100 = SKIP, no_of_days_b4_promo_exp = SKIP) ⇒ Keyschunk2

Returns a new instance of Keyschunk2.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/verizon/models/keyschunk2.rb', line 83

def initialize(data_percentage50 = SKIP, data_percentage75 = SKIP,
               data_percentage90 = SKIP, data_percentage100 = SKIP,
               sms_percentage50 = SKIP, sms_percentage75 = SKIP,
               sms_percentage90 = SKIP, sms_percentage100 = SKIP,
               no_of_days_b4_promo_exp = SKIP)
  @data_percentage50 = data_percentage50 unless data_percentage50 == SKIP
  @data_percentage75 = data_percentage75 unless data_percentage75 == SKIP
  @data_percentage90 = data_percentage90 unless data_percentage90 == SKIP
  @data_percentage100 = data_percentage100 unless data_percentage100 == SKIP
  @sms_percentage50 = sms_percentage50 unless sms_percentage50 == SKIP
  @sms_percentage75 = sms_percentage75 unless sms_percentage75 == SKIP
  @sms_percentage90 = sms_percentage90 unless sms_percentage90 == SKIP
  @sms_percentage100 = sms_percentage100 unless sms_percentage100 == SKIP
  @no_of_days_b4_promo_exp = no_of_days_b4_promo_exp unless no_of_days_b4_promo_exp == SKIP
end

Instance Attribute Details

#data_percentage100TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/verizon/models/keyschunk2.rb', line 26

def data_percentage100
  @data_percentage100
end

#data_percentage50TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/verizon/models/keyschunk2.rb', line 14

def data_percentage50
  @data_percentage50
end

#data_percentage75TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/verizon/models/keyschunk2.rb', line 18

def data_percentage75
  @data_percentage75
end

#data_percentage90TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


22
23
24
# File 'lib/verizon/models/keyschunk2.rb', line 22

def data_percentage90
  @data_percentage90
end

#no_of_days_b4_promo_expInteger

TODO: Write general description for this method

Returns:

  • (Integer)


46
47
48
# File 'lib/verizon/models/keyschunk2.rb', line 46

def no_of_days_b4_promo_exp
  @no_of_days_b4_promo_exp
end

#sms_percentage100TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


42
43
44
# File 'lib/verizon/models/keyschunk2.rb', line 42

def sms_percentage100
  @sms_percentage100
end

#sms_percentage50TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/verizon/models/keyschunk2.rb', line 30

def sms_percentage50
  @sms_percentage50
end

#sms_percentage75TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/verizon/models/keyschunk2.rb', line 34

def sms_percentage75
  @sms_percentage75
end

#sms_percentage90TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


38
39
40
# File 'lib/verizon/models/keyschunk2.rb', line 38

def sms_percentage90
  @sms_percentage90
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/verizon/models/keyschunk2.rb', line 100

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  data_percentage50 =
    hash.key?('dataPercentage50') ? hash['dataPercentage50'] : SKIP
  data_percentage75 =
    hash.key?('dataPercentage75') ? hash['dataPercentage75'] : SKIP
  data_percentage90 =
    hash.key?('dataPercentage90') ? hash['dataPercentage90'] : SKIP
  data_percentage100 =
    hash.key?('dataPercentage100') ? hash['dataPercentage100'] : SKIP
  sms_percentage50 =
    hash.key?('smsPercentage50') ? hash['smsPercentage50'] : SKIP
  sms_percentage75 =
    hash.key?('smsPercentage75') ? hash['smsPercentage75'] : SKIP
  sms_percentage90 =
    hash.key?('smsPercentage90') ? hash['smsPercentage90'] : SKIP
  sms_percentage100 =
    hash.key?('smsPercentage100') ? hash['smsPercentage100'] : SKIP
  no_of_days_b4_promo_exp =
    hash.key?('NoOfDaysB4PromoExp') ? hash['NoOfDaysB4PromoExp'] : SKIP

  # Create object from extracted values.
  Keyschunk2.new(data_percentage50,
                 data_percentage75,
                 data_percentage90,
                 data_percentage100,
                 sms_percentage50,
                 sms_percentage75,
                 sms_percentage90,
                 sms_percentage100,
                 no_of_days_b4_promo_exp)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/verizon/models/keyschunk2.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['data_percentage50'] = 'dataPercentage50'
  @_hash['data_percentage75'] = 'dataPercentage75'
  @_hash['data_percentage90'] = 'dataPercentage90'
  @_hash['data_percentage100'] = 'dataPercentage100'
  @_hash['sms_percentage50'] = 'smsPercentage50'
  @_hash['sms_percentage75'] = 'smsPercentage75'
  @_hash['sms_percentage90'] = 'smsPercentage90'
  @_hash['sms_percentage100'] = 'smsPercentage100'
  @_hash['no_of_days_b4_promo_exp'] = 'NoOfDaysB4PromoExp'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/verizon/models/keyschunk2.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/verizon/models/keyschunk2.rb', line 64

def self.optionals
  %w[
    data_percentage50
    data_percentage75
    data_percentage90
    data_percentage100
    sms_percentage50
    sms_percentage75
    sms_percentage90
    sms_percentage100
    no_of_days_b4_promo_exp
  ]
end