Class: FdxV660Api::RewardCategoryEntity
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FdxV660Api::RewardCategoryEntity
- Defined in:
- lib/fdx_v660_api/models/reward_category_entity.rb
Overview
Reward category used to calculate rewards on a transaction
Instance Attribute Summary collapse
-
#category_id ⇒ String
Long term persistent identity of the reward category.
-
#category_name ⇒ String
Reward category name.
-
#description ⇒ String
Description of the reward category.
-
#fi_attributes ⇒ Array[FiAttributeEntity]
Array of FI-specific attributes.
-
#multiplier ⇒ Float
Factor used to calculate rewards accrued.
-
#reward_program_id ⇒ String
Long term persistent identity of the reward program.
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(reward_program_id: SKIP, category_name: SKIP, category_id: SKIP, multiplier: SKIP, description: SKIP, fi_attributes: SKIP, additional_properties: nil) ⇒ RewardCategoryEntity
constructor
A new instance of RewardCategoryEntity.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(reward_program_id: SKIP, category_name: SKIP, category_id: SKIP, multiplier: SKIP, description: SKIP, fi_attributes: SKIP, additional_properties: nil) ⇒ RewardCategoryEntity
Returns a new instance of RewardCategoryEntity.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 65 def initialize(reward_program_id: SKIP, category_name: SKIP, category_id: SKIP, multiplier: SKIP, description: SKIP, fi_attributes: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @reward_program_id = reward_program_id unless reward_program_id == SKIP @category_name = category_name unless category_name == SKIP @category_id = category_id unless category_id == SKIP @multiplier = multiplier unless multiplier == SKIP @description = description unless description == SKIP @fi_attributes = fi_attributes unless fi_attributes == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#category_id ⇒ String
Long term persistent identity of the reward category
22 23 24 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 22 def category_id @category_id end |
#category_name ⇒ String
Reward category name
18 19 20 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 18 def category_name @category_name end |
#description ⇒ String
Description of the reward category
30 31 32 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 30 def description @description end |
#fi_attributes ⇒ Array[FiAttributeEntity]
Array of FI-specific attributes
34 35 36 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 34 def fi_attributes @fi_attributes end |
#multiplier ⇒ Float
Factor used to calculate rewards accrued
26 27 28 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 26 def multiplier @multiplier end |
#reward_program_id ⇒ String
Long term persistent identity of the reward program
14 15 16 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 14 def reward_program_id @reward_program_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 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 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reward_program_id = hash.key?('rewardProgramId') ? hash['rewardProgramId'] : SKIP category_name = hash.key?('categoryName') ? hash['categoryName'] : SKIP category_id = hash.key?('categoryId') ? hash['categoryId'] : SKIP multiplier = hash.key?('multiplier') ? hash['multiplier'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP # Parameter is an array, so we need to iterate through it fi_attributes = nil unless hash['fiAttributes'].nil? fi_attributes = [] hash['fiAttributes'].each do |structure| fi_attributes << (FiAttributeEntity.from_hash(structure) if structure) end end fi_attributes = SKIP unless hash.key?('fiAttributes') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. RewardCategoryEntity.new(reward_program_id: reward_program_id, category_name: category_name, category_id: category_id, multiplier: multiplier, description: description, fi_attributes: fi_attributes, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['reward_program_id'] = 'rewardProgramId' @_hash['category_name'] = 'categoryName' @_hash['category_id'] = 'categoryId' @_hash['multiplier'] = 'multiplier' @_hash['description'] = 'description' @_hash['fi_attributes'] = 'fiAttributes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 49 def self.optionals %w[ reward_program_id category_name category_id multiplier description fi_attributes ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
128 129 130 131 132 133 134 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 128 def inspect class_name = self.class.name.split('::').last "<#{class_name} reward_program_id: #{@reward_program_id.inspect}, category_name:"\ " #{@category_name.inspect}, category_id: #{@category_id.inspect}, multiplier:"\ " #{@multiplier.inspect}, description: #{@description.inspect}, fi_attributes:"\ " #{@fi_attributes.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
120 121 122 123 124 125 |
# File 'lib/fdx_v660_api/models/reward_category_entity.rb', line 120 def to_s class_name = self.class.name.split('::').last "<#{class_name} reward_program_id: #{@reward_program_id}, category_name: #{@category_name},"\ " category_id: #{@category_id}, multiplier: #{@multiplier}, description: #{@description},"\ " fi_attributes: #{@fi_attributes}, additional_properties: #{@additional_properties}>" end |