Class: Verizon::SharePlan

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

Overview

SharePlan Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(from_carrier_code = SKIP, to_carrier_code = SKIP, criteria_percentage = SKIP) ⇒ SharePlan

Returns a new instance of SharePlan.



47
48
49
50
51
52
# File 'lib/verizon/models/share_plan.rb', line 47

def initialize(from_carrier_code = SKIP, to_carrier_code = SKIP,
               criteria_percentage = SKIP)
  @from_carrier_code = from_carrier_code unless from_carrier_code == SKIP
  @to_carrier_code = to_carrier_code unless to_carrier_code == SKIP
  @criteria_percentage = criteria_percentage unless criteria_percentage == SKIP
end

Instance Attribute Details

#criteria_percentageInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def criteria_percentage
  @criteria_percentage
end

#from_carrier_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def from_carrier_code
  @from_carrier_code
end

#to_carrier_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def to_carrier_code
  @to_carrier_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/verizon/models/share_plan.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  from_carrier_code =
    hash.key?('fromCarrierCode') ? hash['fromCarrierCode'] : SKIP
  to_carrier_code =
    hash.key?('toCarrierCode') ? hash['toCarrierCode'] : SKIP
  criteria_percentage =
    hash.key?('criteriaPercentage') ? hash['criteriaPercentage'] : SKIP

  # Create object from extracted values.
  SharePlan.new(from_carrier_code,
                to_carrier_code,
                criteria_percentage)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/verizon/models/share_plan.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['from_carrier_code'] = 'fromCarrierCode'
  @_hash['to_carrier_code'] = 'toCarrierCode'
  @_hash['criteria_percentage'] = 'criteriaPercentage'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/verizon/models/share_plan.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
40
# File 'lib/verizon/models/share_plan.rb', line 34

def self.optionals
  %w[
    from_carrier_code
    to_carrier_code
    criteria_percentage
  ]
end