Class: Verizon::RatePlanGroup

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

Overview

RatePlanGroup Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(rate_plan_group_description = SKIP, rate_plan_type = SKIP, rate_plan = SKIP, description = SKIP, size_kb = SKIP, carrier_rate_plan_code = SKIP, zero_dollar_billing = SKIP, promotion_offered = SKIP, promotion_days = SKIP, account = SKIP) ⇒ RatePlanGroup

Returns a new instance of RatePlanGroup.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/verizon/models/rate_plan_group.rb', line 89

def initialize(rate_plan_group_description = SKIP, rate_plan_type = SKIP,
               rate_plan = SKIP, description = SKIP, size_kb = SKIP,
               carrier_rate_plan_code = SKIP, zero_dollar_billing = SKIP,
               promotion_offered = SKIP, promotion_days = SKIP,
                = SKIP)
  unless rate_plan_group_description == SKIP
    @rate_plan_group_description =
      rate_plan_group_description
  end
  @rate_plan_type = rate_plan_type unless rate_plan_type == SKIP
  @rate_plan = rate_plan unless rate_plan == SKIP
  @description = description unless description == SKIP
  @size_kb = size_kb unless size_kb == SKIP
  @carrier_rate_plan_code = carrier_rate_plan_code unless carrier_rate_plan_code == SKIP
  @zero_dollar_billing = zero_dollar_billing unless zero_dollar_billing == SKIP
  @promotion_offered = promotion_offered unless promotion_offered == SKIP
  @promotion_days = promotion_days unless promotion_days == SKIP
  @account =  unless  == SKIP
end

Instance Attribute Details

#accountArray[Accountid]

Account information

Returns:



50
51
52
# File 'lib/verizon/models/rate_plan_group.rb', line 50

def 
  @account
end

#carrier_rate_plan_codeString

An array of rateplan names

Returns:

  • (String)


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

def carrier_rate_plan_code
  @carrier_rate_plan_code
end

#descriptionString

An array of rateplan names

Returns:

  • (String)


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

def description
  @description
end

#promotion_daysInteger

An array of rateplan names

Returns:

  • (Integer)


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

def promotion_days
  @promotion_days
end

#promotion_offeredTrueClass | FalseClass

An array of rateplan names

Returns:

  • (TrueClass | FalseClass)


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

def promotion_offered
  @promotion_offered
end

#rate_planArray[Rateplantype2]

An array of rateplan names

Returns:



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

def rate_plan
  @rate_plan
end

#rate_plan_group_descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def rate_plan_group_description
  @rate_plan_group_description
end

#rate_plan_typeObject

TODO: Write general description for this method

Returns:

  • (Object)


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

def rate_plan_type
  @rate_plan_type
end

#size_kbString

An array of rateplan names

Returns:

  • (String)


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

def size_kb
  @size_kb
end

#zero_dollar_billingTrueClass | FalseClass

An array of rateplan names

Returns:

  • (TrueClass | FalseClass)


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

def zero_dollar_billing
  @zero_dollar_billing
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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
157
158
# File 'lib/verizon/models/rate_plan_group.rb', line 110

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  rate_plan_group_description =
    hash.key?('ratePlanGroupDescription') ? hash['ratePlanGroupDescription'] : SKIP
  rate_plan_type = hash.key?('ratePlanType') ? hash['ratePlanType'] : SKIP
  # Parameter is an array, so we need to iterate through it
  rate_plan = nil
  unless hash['ratePlan'].nil?
    rate_plan = []
    hash['ratePlan'].each do |structure|
      rate_plan << (Rateplantype2.from_hash(structure) if structure)
    end
  end

  rate_plan = SKIP unless hash.key?('ratePlan')
  description = hash.key?('description') ? hash['description'] : SKIP
  size_kb = hash.key?('sizeKb') ? hash['sizeKb'] : SKIP
  carrier_rate_plan_code =
    hash.key?('carrierRatePlanCode') ? hash['carrierRatePlanCode'] : SKIP
  zero_dollar_billing =
    hash.key?('zeroDollarBilling') ? hash['zeroDollarBilling'] : SKIP
  promotion_offered =
    hash.key?('promotionOffered') ? hash['promotionOffered'] : SKIP
  promotion_days = hash.key?('promotionDays') ? hash['promotionDays'] : SKIP
  # Parameter is an array, so we need to iterate through it
   = nil
  unless hash['account'].nil?
     = []
    hash['account'].each do |structure|
       << (Accountid.from_hash(structure) if structure)
    end
  end

   = SKIP unless hash.key?('account')

  # Create object from extracted values.
  RatePlanGroup.new(rate_plan_group_description,
                    rate_plan_type,
                    rate_plan,
                    description,
                    size_kb,
                    carrier_rate_plan_code,
                    zero_dollar_billing,
                    promotion_offered,
                    promotion_days,
                    )
end

.namesObject

A mapping from model property names to API property names.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/verizon/models/rate_plan_group.rb', line 53

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['rate_plan_group_description'] = 'ratePlanGroupDescription'
  @_hash['rate_plan_type'] = 'ratePlanType'
  @_hash['rate_plan'] = 'ratePlan'
  @_hash['description'] = 'description'
  @_hash['size_kb'] = 'sizeKb'
  @_hash['carrier_rate_plan_code'] = 'carrierRatePlanCode'
  @_hash['zero_dollar_billing'] = 'zeroDollarBilling'
  @_hash['promotion_offered'] = 'promotionOffered'
  @_hash['promotion_days'] = 'promotionDays'
  @_hash['account'] = 'account'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
# File 'lib/verizon/models/rate_plan_group.rb', line 85

def self.nullables
  []
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/verizon/models/rate_plan_group.rb', line 69

def self.optionals
  %w[
    rate_plan_group_description
    rate_plan_type
    rate_plan
    description
    size_kb
    carrier_rate_plan_code
    zero_dollar_billing
    promotion_offered
    promotion_days
    account
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



171
172
173
174
175
176
177
178
179
# File 'lib/verizon/models/rate_plan_group.rb', line 171

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} rate_plan_group_description: #{@rate_plan_group_description.inspect},"\
  " rate_plan_type: #{@rate_plan_type.inspect}, rate_plan: #{@rate_plan.inspect}, description:"\
  " #{@description.inspect}, size_kb: #{@size_kb.inspect}, carrier_rate_plan_code:"\
  " #{@carrier_rate_plan_code.inspect}, zero_dollar_billing: #{@zero_dollar_billing.inspect},"\
  " promotion_offered: #{@promotion_offered.inspect}, promotion_days:"\
  " #{@promotion_days.inspect}, account: #{@account.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



161
162
163
164
165
166
167
168
# File 'lib/verizon/models/rate_plan_group.rb', line 161

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} rate_plan_group_description: #{@rate_plan_group_description},"\
  " rate_plan_type: #{@rate_plan_type}, rate_plan: #{@rate_plan}, description:"\
  " #{@description}, size_kb: #{@size_kb}, carrier_rate_plan_code: #{@carrier_rate_plan_code},"\
  " zero_dollar_billing: #{@zero_dollar_billing}, promotion_offered: #{@promotion_offered},"\
  " promotion_days: #{@promotion_days}, account: #{@account}>"
end