Class: Verizon::SharePlan
- Defined in:
- lib/verizon/models/share_plan.rb
Overview
SharePlan Model.
Instance Attribute Summary collapse
-
#criteria_percentage ⇒ Integer
TODO: Write general description for this method.
-
#from_carrier_code ⇒ String
TODO: Write general description for this method.
-
#to_carrier_code ⇒ String
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(from_carrier_code = SKIP, to_carrier_code = SKIP, criteria_percentage = SKIP) ⇒ SharePlan
constructor
A new instance of SharePlan.
Methods inherited from BaseModel
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_percentage ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/verizon/models/share_plan.rb', line 22 def criteria_percentage @criteria_percentage end |
#from_carrier_code ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/verizon/models/share_plan.rb', line 14 def from_carrier_code @from_carrier_code end |
#to_carrier_code ⇒ String
TODO: Write general description for this method
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/verizon/models/share_plan.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
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 |