Class: FdxV660Api::BaseTermsAndConditions

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/base_terms_and_conditions.rb

Overview

Base type for initial and current terms and conditions for deposit and line of credit accounts

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(product_id: SKIP, uris: SKIP, rewards_terms_and_conditions: SKIP, additional_properties: nil) ⇒ BaseTermsAndConditions

Returns a new instance of BaseTermsAndConditions.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 51

def initialize(product_id: SKIP, uris: SKIP,
               rewards_terms_and_conditions: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @product_id = product_id unless product_id == SKIP
  @uris = uris unless uris == SKIP
  unless rewards_terms_and_conditions == SKIP
    @rewards_terms_and_conditions =
      rewards_terms_and_conditions
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#product_idString

Unique ID of the marketed product for which these are the Terms and Conditions

Returns:

  • (String)


16
17
18
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 16

def product_id
  @product_id
end

#rewards_terms_and_conditionsRewardsTermsAndConditionsEntity2

The PDFs or JSON data elements for the terms and conditions for the account's reward program (and reward categories, if any)



26
27
28
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 26

def rewards_terms_and_conditions
  @rewards_terms_and_conditions
end

#urisArray[TermsAndConditionsUriEntity]

Static public-facing URIs which return initial or latest account terms and conditions as PDF files or web content

Returns:



21
22
23
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 21

def uris
  @uris
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  product_id = hash.key?('productId') ? hash['productId'] : SKIP
  # Parameter is an array, so we need to iterate through it
  uris = nil
  unless hash['uris'].nil?
    uris = []
    hash['uris'].each do |structure|
      uris << (TermsAndConditionsUriEntity.from_hash(structure) if structure)
    end
  end

  uris = SKIP unless hash.key?('uris')
  if hash['rewardsTermsAndConditions']
    rewards_terms_and_conditions = RewardsTermsAndConditionsEntity2.from_hash(hash['rewardsTermsAndConditions'])
  end

  # 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.
  BaseTermsAndConditions.new(product_id: product_id,
                             uris: uris,
                             rewards_terms_and_conditions: rewards_terms_and_conditions,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['product_id'] = 'productId'
  @_hash['uris'] = 'uris'
  @_hash['rewards_terms_and_conditions'] = 'rewardsTermsAndConditions'
  @_hash
end

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 47

def self.nullables
  []
end

.optionalsObject

An array for optional fields



38
39
40
41
42
43
44
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 38

def self.optionals
  %w[
    product_id
    uris
    rewards_terms_and_conditions
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 108

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

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
# File 'lib/fdx_v660_api/models/base_terms_and_conditions.rb', line 101

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