tremendous_ruby 5.7.0 → 5.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 195da80d84c9b36ee4e1f637992aa13deface61e0ab23e16b8987c1285b554f4
4
- data.tar.gz: 4cee12139802e096dba6067ead8eb03349cdb94f75b8b075d0336bf8f4241043
3
+ metadata.gz: 172ed5c1dcd272f89f1277627b38b489c576dffbff029873d0b3e8baf0c851cc
4
+ data.tar.gz: 79460dfe511fe1c9d8b9834b4759a5d92b79cc30b11bc0bcd64382796ff36c13
5
5
  SHA512:
6
- metadata.gz: d74b168ef7ee0c64df551edce823e2656ee9be73970b50240dbc421b64b2b36d584ed1bea33026de07c9073ad53f0a688d3334fe6e1c4017f2bdda0cd73cb832
7
- data.tar.gz: 7aa7bb52a9c9b443f9d0ea2ccb807392963d9773fd00ceba6d8a647d47c31bfc15fd1efd75aba167b747f8518e95969d8d9aa1793bfb5d9d2464922766fd6293
6
+ metadata.gz: 75f66c3262aa9ec2ba03e5ad3697aee0c0229c1d835c700f1822aba7d5a16da79b642d2149c528efef2370a335048d056470ad88e8627e41f68d4049803d86a3
7
+ data.tar.gz: 850bf2fbe55677c1211be8778497374a8c129d4c80ad454624f51c1b5ff3bf940eb9e7640555117e8699c0be9831c460b2c5e1f1bae60bc8038584defac885f8
@@ -23,7 +23,7 @@ module Tremendous
23
23
  # Approves an order that is pending review, identified by the given `id` in the URL. Approvals is a feature that requires orders to be approved by an organization admin before they are sent out. To enable approvals for your organization, please enable 'Allow approvals via API' via the organization''s 'Order Approvals' settings from the Tremendous dashboard.
24
24
  # @param id [String] ID of the order that should be approved. In case the order has an `external_id` reference supplied by the customer on creation, it's possible to use it instead.
25
25
  # @param [Hash] opts the optional parameters
26
- # @return [CreateOrder201Response]
26
+ # @return [GetOrder200Response]
27
27
  def approve_order(id, opts = {})
28
28
  data, _status_code, _headers = approve_order_with_http_info(id, opts)
29
29
  data
@@ -33,7 +33,7 @@ module Tremendous
33
33
  # Approves an order that is pending review, identified by the given `id` in the URL. Approvals is a feature that requires orders to be approved by an organization admin before they are sent out. To enable approvals for your organization, please enable 'Allow approvals via API' via the organization''s 'Order Approvals' settings from the Tremendous dashboard.
34
34
  # @param id [String] ID of the order that should be approved. In case the order has an `external_id` reference supplied by the customer on creation, it's possible to use it instead.
35
35
  # @param [Hash] opts the optional parameters
36
- # @return [Array<(CreateOrder201Response, Integer, Hash)>] CreateOrder201Response data, response status code and response headers
36
+ # @return [Array<(GetOrder200Response, Integer, Hash)>] GetOrder200Response data, response status code and response headers
37
37
  def approve_order_with_http_info(id, opts = {})
38
38
  if @api_client.config.debugging
39
39
  @api_client.config.logger.debug 'Calling API: TremendousApi.approve_order ...'
@@ -65,7 +65,7 @@ module Tremendous
65
65
  post_body = opts[:debug_body]
66
66
 
67
67
  # return_type
68
- return_type = opts[:debug_return_type] || 'CreateOrder201Response'
68
+ return_type = opts[:debug_return_type] || 'GetOrder200Response'
69
69
 
70
70
  # auth_names
71
71
  auth_names = opts[:debug_auth_names] || ['BearerApiKey']
@@ -1549,7 +1549,7 @@ module Tremendous
1549
1549
  # Retrieve the order, identified by the given `id` in the URL
1550
1550
  # @param id [String] ID of the order that should be retrieved. In case the order has an &#x60;external_id&#x60; reference supplied by the customer on creation, it&#39;s possible to use it instead.
1551
1551
  # @param [Hash] opts the optional parameters
1552
- # @return [CreateOrder201Response]
1552
+ # @return [GetOrder200Response]
1553
1553
  def get_order(id, opts = {})
1554
1554
  data, _status_code, _headers = get_order_with_http_info(id, opts)
1555
1555
  data
@@ -1559,7 +1559,7 @@ module Tremendous
1559
1559
  # Retrieve the order, identified by the given &#x60;id&#x60; in the URL
1560
1560
  # @param id [String] ID of the order that should be retrieved. In case the order has an &#x60;external_id&#x60; reference supplied by the customer on creation, it&#39;s possible to use it instead.
1561
1561
  # @param [Hash] opts the optional parameters
1562
- # @return [Array<(CreateOrder201Response, Integer, Hash)>] CreateOrder201Response data, response status code and response headers
1562
+ # @return [Array<(GetOrder200Response, Integer, Hash)>] GetOrder200Response data, response status code and response headers
1563
1563
  def get_order_with_http_info(id, opts = {})
1564
1564
  if @api_client.config.debugging
1565
1565
  @api_client.config.logger.debug 'Calling API: TremendousApi.get_order ...'
@@ -1586,7 +1586,7 @@ module Tremendous
1586
1586
  post_body = opts[:debug_body]
1587
1587
 
1588
1588
  # return_type
1589
- return_type = opts[:debug_return_type] || 'CreateOrder201Response'
1589
+ return_type = opts[:debug_return_type] || 'GetOrder200Response'
1590
1590
 
1591
1591
  # auth_names
1592
1592
  auth_names = opts[:debug_auth_names] || ['BearerApiKey']
@@ -2953,7 +2953,7 @@ module Tremendous
2953
2953
  # Rejects an order that is pending review, identified by the given `id` in the URL. Approvals is a feature that requires orders to be approved by an organization admin before they are sent out. To enable approvals for your organization, please enable 'Allow approvals via API' via the organization''s 'Order Approvals' settings from the Tremendous dashboard.
2954
2954
  # @param id [String] ID of the order that should be rejected. In case the order has an &#x60;external_id&#x60; reference supplied by the customer on creation, it&#39;s possible to use it instead.
2955
2955
  # @param [Hash] opts the optional parameters
2956
- # @return [CreateOrder201Response]
2956
+ # @return [GetOrder200Response]
2957
2957
  def reject_order(id, opts = {})
2958
2958
  data, _status_code, _headers = reject_order_with_http_info(id, opts)
2959
2959
  data
@@ -2963,7 +2963,7 @@ module Tremendous
2963
2963
  # Rejects an order that is pending review, identified by the given &#x60;id&#x60; in the URL. Approvals is a feature that requires orders to be approved by an organization admin before they are sent out. To enable approvals for your organization, please enable &#39;Allow approvals via API&#39; via the organization&#39;&#39;s &#39;Order Approvals&#39; settings from the Tremendous dashboard.
2964
2964
  # @param id [String] ID of the order that should be rejected. In case the order has an &#x60;external_id&#x60; reference supplied by the customer on creation, it&#39;s possible to use it instead.
2965
2965
  # @param [Hash] opts the optional parameters
2966
- # @return [Array<(CreateOrder201Response, Integer, Hash)>] CreateOrder201Response data, response status code and response headers
2966
+ # @return [Array<(GetOrder200Response, Integer, Hash)>] GetOrder200Response data, response status code and response headers
2967
2967
  def reject_order_with_http_info(id, opts = {})
2968
2968
  if @api_client.config.debugging
2969
2969
  @api_client.config.logger.debug 'Calling API: TremendousApi.reject_order ...'
@@ -2995,7 +2995,7 @@ module Tremendous
2995
2995
  post_body = opts[:debug_body]
2996
2996
 
2997
2997
  # return_type
2998
- return_type = opts[:debug_return_type] || 'CreateOrder201Response'
2998
+ return_type = opts[:debug_return_type] || 'GetOrder200Response'
2999
2999
 
3000
3000
  # auth_names
3001
3001
  auth_names = opts[:debug_auth_names] || ['BearerApiKey']
@@ -31,6 +31,8 @@ module Tremendous
31
31
  # A brief description of the transaction
32
32
  attr_accessor :description
33
33
 
34
+ attr_accessor :order
35
+
34
36
  # Attribute mapping from ruby-style variable name to JSON key.
35
37
  def self.attribute_map
36
38
  {
@@ -38,7 +40,8 @@ module Tremendous
38
40
  :'amount' => :'amount',
39
41
  :'balance' => :'balance',
40
42
  :'action' => :'action',
41
- :'description' => :'description'
43
+ :'description' => :'description',
44
+ :'order' => :'order'
42
45
  }
43
46
  end
44
47
 
@@ -54,7 +57,8 @@ module Tremendous
54
57
  :'amount' => :'Float',
55
58
  :'balance' => :'Float',
56
59
  :'action' => :'String',
57
- :'description' => :'String'
60
+ :'description' => :'String',
61
+ :'order' => :'BalanceTransactionOrder'
58
62
  }
59
63
  end
60
64
 
@@ -108,6 +112,10 @@ module Tremendous
108
112
  else
109
113
  self.description = nil
110
114
  end
115
+
116
+ if attributes.key?(:'order')
117
+ self.order = attributes[:'order']
118
+ end
111
119
  end
112
120
 
113
121
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -159,7 +167,8 @@ module Tremendous
159
167
  amount == o.amount &&
160
168
  balance == o.balance &&
161
169
  action == o.action &&
162
- description == o.description
170
+ description == o.description &&
171
+ order == o.order
163
172
  end
164
173
 
165
174
  # @see the `==` method
@@ -171,7 +180,7 @@ module Tremendous
171
180
  # Calculates hash code according to all attributes.
172
181
  # @return [Integer] Hash code
173
182
  def hash
174
- [created_at, amount, balance, action, description].hash
183
+ [created_at, amount, balance, action, description, order].hash
175
184
  end
176
185
 
177
186
  # Builds the object from hash
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #API Endpoints
3
+
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
5
+
6
+ The version of the OpenAPI document: 2
7
+ Contact: developers@tremendous.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ # Order details
18
+ class BalanceTransactionOrder
19
+ attr_accessor :id
20
+
21
+ # Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only.
22
+ attr_accessor :external_id
23
+
24
+ attr_accessor :payment
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'id' => :'id',
30
+ :'external_id' => :'external_id',
31
+ :'payment' => :'payment'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'id' => :'String',
44
+ :'external_id' => :'String',
45
+ :'payment' => :'BalanceTransactionOrderPayment'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ :'external_id',
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::BalanceTransactionOrder` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::BalanceTransactionOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'id')
72
+ self.id = attributes[:'id']
73
+ end
74
+
75
+ if attributes.key?(:'external_id')
76
+ self.external_id = attributes[:'external_id']
77
+ end
78
+
79
+ if attributes.key?(:'payment')
80
+ self.payment = attributes[:'payment']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
90
+ if !@id.nil? && @id !~ pattern
91
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
101
+ return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
102
+ true
103
+ end
104
+
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] id Value to be assigned
107
+ def id=(id)
108
+ if id.nil?
109
+ fail ArgumentError, 'id cannot be nil'
110
+ end
111
+
112
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
113
+ if id !~ pattern
114
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
115
+ end
116
+
117
+ @id = id
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ id == o.id &&
126
+ external_id == o.external_id &&
127
+ payment == o.payment
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [id, external_id, payment].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ transformed_hash = {}
149
+ openapi_types.each_pair do |key, type|
150
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
+ transformed_hash["#{key}"] = nil
152
+ elsif type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[attribute_map[key]].is_a?(Array)
156
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
157
+ end
158
+ elsif !attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
+ end
161
+ end
162
+ new(transformed_hash)
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def self._deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = Tremendous.const_get(type)
204
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end