loyalty-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +187 -0
  4. data/bin/console +15 -0
  5. data/lib/loyalty_ap_is/api_helper.rb +10 -0
  6. data/lib/loyalty_ap_is/apis/authorization_api.rb +116 -0
  7. data/lib/loyalty_ap_is/apis/balances_api.rb +96 -0
  8. data/lib/loyalty_ap_is/apis/base_api.rb +67 -0
  9. data/lib/loyalty_ap_is/apis/oauth_authorization_api.rb +44 -0
  10. data/lib/loyalty_ap_is/apis/offer_api.rb +164 -0
  11. data/lib/loyalty_ap_is/apis/profile_management_api.rb +44 -0
  12. data/lib/loyalty_ap_is/apis/redemption_api.rb +107 -0
  13. data/lib/loyalty_ap_is/apis/transaction_api.rb +143 -0
  14. data/lib/loyalty_ap_is/client.rb +137 -0
  15. data/lib/loyalty_ap_is/configuration.rb +238 -0
  16. data/lib/loyalty_ap_is/exceptions/api_exception.rb +21 -0
  17. data/lib/loyalty_ap_is/exceptions/common_error_exception.rb +98 -0
  18. data/lib/loyalty_ap_is/exceptions/consumers_balances400_error_exception.rb +57 -0
  19. data/lib/loyalty_ap_is/exceptions/consumers_balances401_error_exception.rb +57 -0
  20. data/lib/loyalty_ap_is/exceptions/consumers_balances404_error_exception.rb +57 -0
  21. data/lib/loyalty_ap_is/exceptions/consumers_balances422_error_exception.rb +57 -0
  22. data/lib/loyalty_ap_is/exceptions/error_response_exception.rb +57 -0
  23. data/lib/loyalty_ap_is/exceptions/json_api_error_exception.rb +60 -0
  24. data/lib/loyalty_ap_is/exceptions/oauth_provider_exception.rb +64 -0
  25. data/lib/loyalty_ap_is/exceptions/resource_not_found_error_exception.rb +57 -0
  26. data/lib/loyalty_ap_is/http/api_response.rb +19 -0
  27. data/lib/loyalty_ap_is/http/auth/client_authorization_token.rb +148 -0
  28. data/lib/loyalty_ap_is/http/auth/customer_header.rb +52 -0
  29. data/lib/loyalty_ap_is/http/auth/private_basic_token.rb +52 -0
  30. data/lib/loyalty_ap_is/http/auth/public_basic_token.rb +52 -0
  31. data/lib/loyalty_ap_is/http/auth/public_bearer_token.rb +53 -0
  32. data/lib/loyalty_ap_is/http/http_call_back.rb +10 -0
  33. data/lib/loyalty_ap_is/http/http_method_enum.rb +10 -0
  34. data/lib/loyalty_ap_is/http/http_request.rb +10 -0
  35. data/lib/loyalty_ap_is/http/http_response.rb +10 -0
  36. data/lib/loyalty_ap_is/http/proxy_settings.rb +22 -0
  37. data/lib/loyalty_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
  38. data/lib/loyalty_ap_is/logging/sdk_logger.rb +17 -0
  39. data/lib/loyalty_ap_is/models/access_code_response.rb +87 -0
  40. data/lib/loyalty_ap_is/models/assign_offer_channel.rb +26 -0
  41. data/lib/loyalty_ap_is/models/auth_token_request.rb +75 -0
  42. data/lib/loyalty_ap_is/models/auth_token_response.rb +106 -0
  43. data/lib/loyalty_ap_is/models/bad_request_error.rb +63 -0
  44. data/lib/loyalty_ap_is/models/balance_amount.rb +84 -0
  45. data/lib/loyalty_ap_is/models/balance_amount_detail.rb +141 -0
  46. data/lib/loyalty_ap_is/models/balance_currency_amount.rb +93 -0
  47. data/lib/loyalty_ap_is/models/balance_currency_type.rb +60 -0
  48. data/lib/loyalty_ap_is/models/balance_state.rb +72 -0
  49. data/lib/loyalty_ap_is/models/base_model.rb +110 -0
  50. data/lib/loyalty_ap_is/models/client_auth_token_request.rb +78 -0
  51. data/lib/loyalty_ap_is/models/currency_data.rb +101 -0
  52. data/lib/loyalty_ap_is/models/customer_balances.rb +84 -0
  53. data/lib/loyalty_ap_is/models/error_base_container.rb +82 -0
  54. data/lib/loyalty_ap_is/models/error_info.rb +84 -0
  55. data/lib/loyalty_ap_is/models/error_item.rb +105 -0
  56. data/lib/loyalty_ap_is/models/error_presenter.rb +150 -0
  57. data/lib/loyalty_ap_is/models/error_source.rb +75 -0
  58. data/lib/loyalty_ap_is/models/ev_charging_details.rb +151 -0
  59. data/lib/loyalty_ap_is/models/exchange_access_code_request.rb +77 -0
  60. data/lib/loyalty_ap_is/models/fault.rb +85 -0
  61. data/lib/loyalty_ap_is/models/fault_detail.rb +76 -0
  62. data/lib/loyalty_ap_is/models/json_api_version.rb +75 -0
  63. data/lib/loyalty_ap_is/models/loyalty_card_info.rb +76 -0
  64. data/lib/loyalty_ap_is/models/m200_user_partners.rb +109 -0
  65. data/lib/loyalty_ap_is/models/method_not_allowed_error.rb +62 -0
  66. data/lib/loyalty_ap_is/models/not_found_error.rb +62 -0
  67. data/lib/loyalty_ap_is/models/not_found_error_response.rb +90 -0
  68. data/lib/loyalty_ap_is/models/oauth_provider_error.rb +62 -0
  69. data/lib/loyalty_ap_is/models/oauth_token.rb +96 -0
  70. data/lib/loyalty_ap_is/models/offer.rb +155 -0
  71. data/lib/loyalty_ap_is/models/offer_assignment.rb +172 -0
  72. data/lib/loyalty_ap_is/models/offer_base.rb +101 -0
  73. data/lib/loyalty_ap_is/models/offer_info.rb +156 -0
  74. data/lib/loyalty_ap_is/models/offer_language.rb +100 -0
  75. data/lib/loyalty_ap_is/models/points_to_cash.rb +99 -0
  76. data/lib/loyalty_ap_is/models/product_type.rb +53 -0
  77. data/lib/loyalty_ap_is/models/redeemed_item.rb +221 -0
  78. data/lib/loyalty_ap_is/models/redeemed_item_product.rb +131 -0
  79. data/lib/loyalty_ap_is/models/redemption_item.rb +109 -0
  80. data/lib/loyalty_ap_is/models/redemption_request.rb +107 -0
  81. data/lib/loyalty_ap_is/models/redemption_response.rb +118 -0
  82. data/lib/loyalty_ap_is/models/redemption_response_item.rb +111 -0
  83. data/lib/loyalty_ap_is/models/refresh_token_request.rb +75 -0
  84. data/lib/loyalty_ap_is/models/refresh_token_response.rb +93 -0
  85. data/lib/loyalty_ap_is/models/sale_item.rb +262 -0
  86. data/lib/loyalty_ap_is/models/sale_item_product.rb +135 -0
  87. data/lib/loyalty_ap_is/models/site_data.rb +121 -0
  88. data/lib/loyalty_ap_is/models/transaction.rb +351 -0
  89. data/lib/loyalty_ap_is/models/transaction_balance.rb +91 -0
  90. data/lib/loyalty_ap_is/models/transaction_balance_amount.rb +82 -0
  91. data/lib/loyalty_ap_is/models/transaction_balance_state.rb +64 -0
  92. data/lib/loyalty_ap_is/models/transaction_currency_type.rb +56 -0
  93. data/lib/loyalty_ap_is/models/transaction_detail_type.rb +53 -0
  94. data/lib/loyalty_ap_is/models/transaction_type_filter.rb +40 -0
  95. data/lib/loyalty_ap_is/models/transaction_voucher.rb +109 -0
  96. data/lib/loyalty_ap_is/models/transactions_response.rb +118 -0
  97. data/lib/loyalty_ap_is/models/unauthorized_error.rb +62 -0
  98. data/lib/loyalty_ap_is/models/unit_measure.rb +40 -0
  99. data/lib/loyalty_ap_is/models/unprocessable_entity_error_response.rb +90 -0
  100. data/lib/loyalty_ap_is/models/voucher_item.rb +99 -0
  101. data/lib/loyalty_ap_is/utilities/date_time_helper.rb +11 -0
  102. data/lib/loyalty_ap_is/utilities/file_wrapper.rb +28 -0
  103. data/lib/loyalty_ap_is.rb +128 -0
  104. metadata +189 -0
@@ -0,0 +1,84 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # CustomerBalances Model.
8
+ class CustomerBalances < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A list of points balances. Not nullable, an empty array is used instead.
13
+ # @return [Array[BalanceAmount]]
14
+ attr_accessor :balances
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['balances'] = 'balances'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ balances
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(balances: SKIP, additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @balances = balances unless balances == SKIP
40
+ @additional_properties = additional_properties
41
+ end
42
+
43
+ # Creates an instance of the object from a hash.
44
+ def self.from_hash(hash)
45
+ return nil unless hash
46
+
47
+ # Extract variables from the hash.
48
+ # Parameter is an array, so we need to iterate through it
49
+ balances = nil
50
+ unless hash['balances'].nil?
51
+ balances = []
52
+ hash['balances'].each do |structure|
53
+ balances << (BalanceAmount.from_hash(structure) if structure)
54
+ end
55
+ end
56
+
57
+ balances = SKIP unless hash.key?('balances')
58
+
59
+ # Create a new hash for additional properties, removing known properties.
60
+ new_hash = hash.reject { |k, _| names.value?(k) }
61
+
62
+ additional_properties = APIHelper.get_additional_properties(
63
+ new_hash, proc { |value| value }
64
+ )
65
+
66
+ # Create object from extracted values.
67
+ CustomerBalances.new(balances: balances,
68
+ additional_properties: additional_properties)
69
+ end
70
+
71
+ # Provides a human-readable string representation of the object.
72
+ def to_s
73
+ class_name = self.class.name.split('::').last
74
+ "<#{class_name} balances: #{@balances}, additional_properties: #{@additional_properties}>"
75
+ end
76
+
77
+ # Provides a debugging-friendly string with detailed object information.
78
+ def inspect
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} balances: #{@balances.inspect}, additional_properties:"\
81
+ " #{@additional_properties}>"
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,82 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # ErrorBaseContainer Model.
8
+ class ErrorBaseContainer < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [ErrorPresenter]
14
+ attr_accessor :user
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [ErrorPresenter]
18
+ attr_accessor :developer
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['user'] = 'User'
24
+ @_hash['developer'] = 'Developer'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def self.nullables
35
+ []
36
+ end
37
+
38
+ def initialize(user:, developer:, additional_properties: nil)
39
+ # Add additional model properties to the instance
40
+ additional_properties = {} if additional_properties.nil?
41
+
42
+ @user = user
43
+ @developer = developer
44
+ @additional_properties = additional_properties
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ user = ErrorPresenter.from_hash(hash['User']) if hash['User']
53
+ developer = ErrorPresenter.from_hash(hash['Developer']) if hash['Developer']
54
+
55
+ # Create a new hash for additional properties, removing known properties.
56
+ new_hash = hash.reject { |k, _| names.value?(k) }
57
+
58
+ additional_properties = APIHelper.get_additional_properties(
59
+ new_hash, proc { |value| value }
60
+ )
61
+
62
+ # Create object from extracted values.
63
+ ErrorBaseContainer.new(user: user,
64
+ developer: developer,
65
+ additional_properties: additional_properties)
66
+ end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} user: #{@user}, developer: #{@developer}, additional_properties:"\
72
+ " #{@additional_properties}>"
73
+ end
74
+
75
+ # Provides a debugging-friendly string with detailed object information.
76
+ def inspect
77
+ class_name = self.class.name.split('::').last
78
+ "<#{class_name} user: #{@user.inspect}, developer: #{@developer.inspect},"\
79
+ " additional_properties: #{@additional_properties}>"
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,84 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # ErrorInfo Model.
8
+ class ErrorInfo < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [ErrorPresenter]
14
+ attr_accessor :user
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [ErrorPresenter]
18
+ attr_accessor :developer
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['user'] = 'User'
24
+ @_hash['developer'] = 'Developer'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ developer
32
+ ]
33
+ end
34
+
35
+ # An array for nullable fields
36
+ def self.nullables
37
+ []
38
+ end
39
+
40
+ def initialize(user:, developer: SKIP, additional_properties: nil)
41
+ # Add additional model properties to the instance
42
+ additional_properties = {} if additional_properties.nil?
43
+
44
+ @user = user
45
+ @developer = developer unless developer == SKIP
46
+ @additional_properties = additional_properties
47
+ end
48
+
49
+ # Creates an instance of the object from a hash.
50
+ def self.from_hash(hash)
51
+ return nil unless hash
52
+
53
+ # Extract variables from the hash.
54
+ user = ErrorPresenter.from_hash(hash['User']) if hash['User']
55
+ developer = ErrorPresenter.from_hash(hash['Developer']) if hash['Developer']
56
+
57
+ # Create a new hash for additional properties, removing known properties.
58
+ new_hash = hash.reject { |k, _| names.value?(k) }
59
+
60
+ additional_properties = APIHelper.get_additional_properties(
61
+ new_hash, proc { |value| value }
62
+ )
63
+
64
+ # Create object from extracted values.
65
+ ErrorInfo.new(user: user,
66
+ developer: developer,
67
+ additional_properties: additional_properties)
68
+ end
69
+
70
+ # Provides a human-readable string representation of the object.
71
+ def to_s
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} user: #{@user}, developer: #{@developer}, additional_properties:"\
74
+ " #{@additional_properties}>"
75
+ end
76
+
77
+ # Provides a debugging-friendly string with detailed object information.
78
+ def inspect
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} user: #{@user.inspect}, developer: #{@developer.inspect},"\
81
+ " additional_properties: #{@additional_properties}>"
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,105 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # ErrorItem Model.
8
+ class ErrorItem < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :status
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :title
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [ErrorSource]
22
+ attr_accessor :source
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :detail
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['status'] = 'status'
32
+ @_hash['title'] = 'title'
33
+ @_hash['source'] = 'source'
34
+ @_hash['detail'] = 'detail'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ status
42
+ title
43
+ source
44
+ detail
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(status: SKIP, title: SKIP, source: SKIP, detail: SKIP,
54
+ additional_properties: nil)
55
+ # Add additional model properties to the instance
56
+ additional_properties = {} if additional_properties.nil?
57
+
58
+ @status = status unless status == SKIP
59
+ @title = title unless title == SKIP
60
+ @source = source unless source == SKIP
61
+ @detail = detail unless detail == SKIP
62
+ @additional_properties = additional_properties
63
+ end
64
+
65
+ # Creates an instance of the object from a hash.
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash.
70
+ status = hash.key?('status') ? hash['status'] : SKIP
71
+ title = hash.key?('title') ? hash['title'] : SKIP
72
+ source = ErrorSource.from_hash(hash['source']) if hash['source']
73
+ detail = hash.key?('detail') ? hash['detail'] : SKIP
74
+
75
+ # Create a new hash for additional properties, removing known properties.
76
+ new_hash = hash.reject { |k, _| names.value?(k) }
77
+
78
+ additional_properties = APIHelper.get_additional_properties(
79
+ new_hash, proc { |value| value }
80
+ )
81
+
82
+ # Create object from extracted values.
83
+ ErrorItem.new(status: status,
84
+ title: title,
85
+ source: source,
86
+ detail: detail,
87
+ additional_properties: additional_properties)
88
+ end
89
+
90
+ # Provides a human-readable string representation of the object.
91
+ def to_s
92
+ class_name = self.class.name.split('::').last
93
+ "<#{class_name} status: #{@status}, title: #{@title}, source: #{@source}, detail:"\
94
+ " #{@detail}, additional_properties: #{@additional_properties}>"
95
+ end
96
+
97
+ # Provides a debugging-friendly string with detailed object information.
98
+ def inspect
99
+ class_name = self.class.name.split('::').last
100
+ "<#{class_name} status: #{@status.inspect}, title: #{@title.inspect}, source:"\
101
+ " #{@source.inspect}, detail: #{@detail.inspect}, additional_properties:"\
102
+ " #{@additional_properties}>"
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,150 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # ErrorPresenter Model.
8
+ class ErrorPresenter < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # custom error code for developer or user
13
+ # Note: One of the following values will be returned:
14
+ # 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1009, 1010, 1011, 1012,
15
+ # 1014, 1015, 1016
16
+ # @return [String]
17
+ attr_accessor :app_error_code
18
+
19
+ # Custom error message <br>
20
+ # Note: One of the following values will be returned:
21
+ # - Offer does not exist
22
+ # - Customer does not exist
23
+ # - Valid from date is invalid
24
+ # - ValidityPeriod is invalid
25
+ # - Offer is by default assigned to all customers, which cannot be
26
+ # changed.
27
+ # - Assignment is not allowed
28
+ # - Customer assign should have validity dates.
29
+ # - Customer assign validity start date should be before the validity end
30
+ # date.
31
+ # - Customer assign validity dates must be between the offer assignable
32
+ # dates.
33
+ # - Offer validity start date should not be in the past.
34
+ # - Customer already assigned to this offer.
35
+ # - Offer module is disabled
36
+ # - Partner code is not valid for this offer
37
+ # - Reference ID already used
38
+ # - Partner assignment already ended for this customer
39
+ # @return [String]
40
+ attr_accessor :message
41
+
42
+ # reason for the error
43
+ # @return [String]
44
+ attr_accessor :reason
45
+
46
+ # subject of the error. Examples will be shared later
47
+ # @return [String]
48
+ attr_accessor :subject
49
+
50
+ # subject type of the error. Examples will be shared later.
51
+ # @return [String]
52
+ attr_accessor :subject_type
53
+
54
+ # Type of error. Examples will be shared later.
55
+ # @return [String]
56
+ attr_accessor :type
57
+
58
+ # A mapping from model property names to API property names.
59
+ def self.names
60
+ @_hash = {} if @_hash.nil?
61
+ @_hash['app_error_code'] = 'appErrorCode'
62
+ @_hash['message'] = 'message'
63
+ @_hash['reason'] = 'reason'
64
+ @_hash['subject'] = 'subject'
65
+ @_hash['subject_type'] = 'subjectType'
66
+ @_hash['type'] = 'type'
67
+ @_hash
68
+ end
69
+
70
+ # An array for optional fields
71
+ def self.optionals
72
+ %w[
73
+ reason
74
+ subject
75
+ subject_type
76
+ type
77
+ ]
78
+ end
79
+
80
+ # An array for nullable fields
81
+ def self.nullables
82
+ %w[
83
+ reason
84
+ subject
85
+ subject_type
86
+ type
87
+ ]
88
+ end
89
+
90
+ def initialize(app_error_code:, message:, reason: SKIP, subject: SKIP,
91
+ subject_type: SKIP, type: SKIP, additional_properties: nil)
92
+ # Add additional model properties to the instance
93
+ additional_properties = {} if additional_properties.nil?
94
+
95
+ @app_error_code = app_error_code
96
+ @message = message
97
+ @reason = reason unless reason == SKIP
98
+ @subject = subject unless subject == SKIP
99
+ @subject_type = subject_type unless subject_type == SKIP
100
+ @type = type unless type == SKIP
101
+ @additional_properties = additional_properties
102
+ end
103
+
104
+ # Creates an instance of the object from a hash.
105
+ def self.from_hash(hash)
106
+ return nil unless hash
107
+
108
+ # Extract variables from the hash.
109
+ app_error_code = hash.key?('appErrorCode') ? hash['appErrorCode'] : nil
110
+ message = hash.key?('message') ? hash['message'] : nil
111
+ reason = hash.key?('reason') ? hash['reason'] : SKIP
112
+ subject = hash.key?('subject') ? hash['subject'] : SKIP
113
+ subject_type = hash.key?('subjectType') ? hash['subjectType'] : SKIP
114
+ type = hash.key?('type') ? hash['type'] : SKIP
115
+
116
+ # Create a new hash for additional properties, removing known properties.
117
+ new_hash = hash.reject { |k, _| names.value?(k) }
118
+
119
+ additional_properties = APIHelper.get_additional_properties(
120
+ new_hash, proc { |value| value }
121
+ )
122
+
123
+ # Create object from extracted values.
124
+ ErrorPresenter.new(app_error_code: app_error_code,
125
+ message: message,
126
+ reason: reason,
127
+ subject: subject,
128
+ subject_type: subject_type,
129
+ type: type,
130
+ additional_properties: additional_properties)
131
+ end
132
+
133
+ # Provides a human-readable string representation of the object.
134
+ def to_s
135
+ class_name = self.class.name.split('::').last
136
+ "<#{class_name} app_error_code: #{@app_error_code}, message: #{@message}, reason:"\
137
+ " #{@reason}, subject: #{@subject}, subject_type: #{@subject_type}, type: #{@type},"\
138
+ " additional_properties: #{@additional_properties}>"
139
+ end
140
+
141
+ # Provides a debugging-friendly string with detailed object information.
142
+ def inspect
143
+ class_name = self.class.name.split('::').last
144
+ "<#{class_name} app_error_code: #{@app_error_code.inspect}, message: #{@message.inspect},"\
145
+ " reason: #{@reason.inspect}, subject: #{@subject.inspect}, subject_type:"\
146
+ " #{@subject_type.inspect}, type: #{@type.inspect}, additional_properties:"\
147
+ " #{@additional_properties}>"
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,75 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # ErrorSource Model.
8
+ class ErrorSource < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :pointer
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['pointer'] = 'pointer'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ pointer
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(pointer: SKIP, additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @pointer = pointer unless pointer == SKIP
40
+ @additional_properties = additional_properties
41
+ end
42
+
43
+ # Creates an instance of the object from a hash.
44
+ def self.from_hash(hash)
45
+ return nil unless hash
46
+
47
+ # Extract variables from the hash.
48
+ pointer = hash.key?('pointer') ? hash['pointer'] : SKIP
49
+
50
+ # Create a new hash for additional properties, removing known properties.
51
+ new_hash = hash.reject { |k, _| names.value?(k) }
52
+
53
+ additional_properties = APIHelper.get_additional_properties(
54
+ new_hash, proc { |value| value }
55
+ )
56
+
57
+ # Create object from extracted values.
58
+ ErrorSource.new(pointer: pointer,
59
+ additional_properties: additional_properties)
60
+ end
61
+
62
+ # Provides a human-readable string representation of the object.
63
+ def to_s
64
+ class_name = self.class.name.split('::').last
65
+ "<#{class_name} pointer: #{@pointer}, additional_properties: #{@additional_properties}>"
66
+ end
67
+
68
+ # Provides a debugging-friendly string with detailed object information.
69
+ def inspect
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} pointer: #{@pointer.inspect}, additional_properties:"\
72
+ " #{@additional_properties}>"
73
+ end
74
+ end
75
+ end