Class: WalmartApIs::IncentivesEnrollment

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/incentives_enrollment.rb

Overview

IncentivesEnrollment 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(referral_fee_incentive_enrollment:, incentive_type:, incentive_id:, additional_properties: nil) ⇒ IncentivesEnrollment

Returns a new instance of IncentivesEnrollment.



44
45
46
47
48
49
50
51
52
53
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 44

def initialize(referral_fee_incentive_enrollment:, incentive_type:,
               incentive_id:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @referral_fee_incentive_enrollment = referral_fee_incentive_enrollment
  @incentive_type = incentive_type
  @incentive_id = incentive_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#incentive_idString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 22

def incentive_id
  @incentive_id
end

#incentive_typeString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 18

def incentive_type
  @incentive_type
end

#referral_fee_incentive_enrollmentString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 14

def referral_fee_incentive_enrollment
  @referral_fee_incentive_enrollment
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  referral_fee_incentive_enrollment =
    hash.key?('referralFeeIncentiveEnrollment') ? hash['referralFeeIncentiveEnrollment'] : nil
  incentive_type = hash.key?('incentiveType') ? hash['incentiveType'] : nil
  incentive_id = hash.key?('incentiveId') ? hash['incentiveId'] : nil

  # 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.
  IncentivesEnrollment.new(referral_fee_incentive_enrollment: referral_fee_incentive_enrollment,
                           incentive_type: incentive_type,
                           incentive_id: incentive_id,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
32
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['referral_fee_incentive_enrollment'] =
    'referralFeeIncentiveEnrollment'
  @_hash['incentive_type'] = 'incentiveType'
  @_hash['incentive_id'] = 'incentiveId'
  @_hash
end

.nullablesObject

An array for nullable fields



40
41
42
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 40

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 35

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



88
89
90
91
92
93
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 88

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} referral_fee_incentive_enrollment:"\
  " #{@referral_fee_incentive_enrollment.inspect}, incentive_type: #{@incentive_type.inspect},"\
  " incentive_id: #{@incentive_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



80
81
82
83
84
85
# File 'lib/walmart_ap_is/models/incentives_enrollment.rb', line 80

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} referral_fee_incentive_enrollment: #{@referral_fee_incentive_enrollment},"\
  " incentive_type: #{@incentive_type}, incentive_id: #{@incentive_id}, additional_properties:"\
  " #{@additional_properties}>"
end