Class: Verizon::Rateplantype2

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

Overview

Rateplantype2 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(description = SKIP, size_kb = SKIP, carrier_rate_plan_code = SKIP, zero_dollar_billing = SKIP, promotion_offered = SKIP, promotion_days = SKIP, rate_plan_type = SKIP, account = SKIP) ⇒ Rateplantype2

Returns a new instance of Rateplantype2.



77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/verizon/models/rateplantype2.rb', line 77

def initialize(description = SKIP, size_kb = SKIP,
               carrier_rate_plan_code = SKIP, zero_dollar_billing = SKIP,
               promotion_offered = SKIP, promotion_days = SKIP,
               rate_plan_type = SKIP,  = 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
  @rate_plan_type = rate_plan_type unless rate_plan_type == SKIP
  @account =  unless  == SKIP
end

Instance Attribute Details

#accountArray[Accountid]

Account information

Returns:



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

def 
  @account
end

#carrier_rate_plan_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def carrier_rate_plan_code
  @carrier_rate_plan_code
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#promotion_daysInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def promotion_days
  @promotion_days
end

#promotion_offeredTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def promotion_offered
  @promotion_offered
end

#rate_plan_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def rate_plan_type
  @rate_plan_type
end

#size_kbString

TODO: Write general description for this method

Returns:

  • (String)


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

def size_kb
  @size_kb
end

#zero_dollar_billingTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def zero_dollar_billing
  @zero_dollar_billing
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



92
93
94
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
123
124
125
126
# File 'lib/verizon/models/rateplantype2.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  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
  rate_plan_type = hash.key?('ratePlanType') ? hash['ratePlanType'] : 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.
  Rateplantype2.new(description,
                    size_kb,
                    carrier_rate_plan_code,
                    zero_dollar_billing,
                    promotion_offered,
                    promotion_days,
                    rate_plan_type,
                    )
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/verizon/models/rateplantype2.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_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['rate_plan_type'] = 'ratePlanType'
  @_hash['account'] = 'account'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/verizon/models/rateplantype2.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/verizon/models/rateplantype2.rb', line 59

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

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (Rateplantype2 | Hash)

    value against the validation is performed.



130
131
132
133
134
135
136
# File 'lib/verizon/models/rateplantype2.rb', line 130

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
155
# File 'lib/verizon/models/rateplantype2.rb', line 148

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} 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}, rate_plan_type: #{@rate_plan_type.inspect},"\
  " account: #{@account.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



139
140
141
142
143
144
145
# File 'lib/verizon/models/rateplantype2.rb', line 139

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} 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},"\
  " rate_plan_type: #{@rate_plan_type}, account: #{@account}>"
end