smplkit 3.0.37 → 3.0.38

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: 97fc9d5f5ccd8884a150cc985e0c09dc4f0323f19ba39940d435e4b30fa6a8a4
4
- data.tar.gz: a66fa0dd76a8188fd8a3673c122bd6305f3916da73174f5d8dcd75b9edd2628a
3
+ metadata.gz: d093db00d56d49c99f82f21d6745a658a57bbe323df0d2ae6dc5f7ad6ac2b6ee
4
+ data.tar.gz: 7d4e8749500d54c85f4f327ce97a52916e0c13a62f20b75cbec5b16af637bb9c
5
5
  SHA512:
6
- metadata.gz: 2e2970204abfbab07db8d18f3e9ba94c33fe8e5d7d56f78ffd3bc436c8fe01b8add1db4c541ee4307756b5f030403667d2ac258b3bf1cbde0423749167390f39
7
- data.tar.gz: 923a51443ab908653434775e9f94ff40ad8a02a18cb981176da51baba6469f6164cccddf3b210e5de5b454bcdb71c6a446d8126cbdce8f314cb93f59cf723399
6
+ metadata.gz: 609ac236e6ef526c76100fcf5dd87f4c51f42187d69d80d31017e0cf4f570dbf9afcda9de04af37e8a7c3dedb5959a76983f74bee9d808c4505a29eec7fdd2cd
7
+ data.tar.gz: 0f366d56e2d5db7df8b0db9bdf35a2c7787c6920a5f8bf8b9522165afb6f04494b35182c9748303f243b513399a60bebd2a5af0f9c16a595346d744c76fb41b6
@@ -0,0 +1,95 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module SmplkitGeneratedClient::App
16
+ class DiscountTiersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List Discount Tiers
23
+ # Return the multi-product volume discount schedule. Each tier is identified by the minimum number of paid products at which the discount applies. The first tier (1 product) carries no discount; subsequent tiers grant a progressively larger percent off every paid subscription item. Default sort is `products_count` ascending, which is the natural ladder customers traverse as they add products.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `products_count`. Allowed values: `percent_off`, `-percent_off`, `products_count`, `-products_count`. (default to 'products_count')
26
+ # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to `1` when omitted. Must be `>= 1` — requests with a smaller value are rejected with a 400 error. (default to 1)
27
+ # @option opts [Integer] :page_size Number of items per page. Optional; defaults to `1000` when omitted. Must be between `1` and `1000` inclusive — requests outside that range are rejected with a 400 error. (default to 1000)
28
+ # @option opts [Boolean] :meta_total When `true`, the response's `meta.pagination` block includes `total` (the total number of matching items across all pages) and `total_pages`. Computing these requires an extra `COUNT` query, so omit (or pass `false`) when the totals are not needed. Defaults to `false`. (default to false)
29
+ # @return [DiscountTierListResponse]
30
+ def list_discount_tiers(opts = {})
31
+ data, _status_code, _headers = list_discount_tiers_with_http_info(opts)
32
+ data
33
+ end
34
+
35
+ # List Discount Tiers
36
+ # Return the multi-product volume discount schedule. Each tier is identified by the minimum number of paid products at which the discount applies. The first tier (1 product) carries no discount; subsequent tiers grant a progressively larger percent off every paid subscription item. Default sort is `products_count` ascending, which is the natural ladder customers traverse as they add products.
37
+ # @param [Hash] opts the optional parameters
38
+ # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `products_count`. Allowed values: `percent_off`, `-percent_off`, `products_count`, `-products_count`. (default to 'products_count')
39
+ # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to `1` when omitted. Must be `>= 1` — requests with a smaller value are rejected with a 400 error. (default to 1)
40
+ # @option opts [Integer] :page_size Number of items per page. Optional; defaults to `1000` when omitted. Must be between `1` and `1000` inclusive — requests outside that range are rejected with a 400 error. (default to 1000)
41
+ # @option opts [Boolean] :meta_total When `true`, the response's `meta.pagination` block includes `total` (the total number of matching items across all pages) and `total_pages`. Computing these requires an extra `COUNT` query, so omit (or pass `false`) when the totals are not needed. Defaults to `false`. (default to false)
42
+ # @return [Array<(DiscountTierListResponse, Integer, Hash)>] DiscountTierListResponse data, response status code and response headers
43
+ def list_discount_tiers_with_http_info(opts = {})
44
+ if @api_client.config.debugging
45
+ @api_client.config.logger.debug 'Calling API: DiscountTiersApi.list_discount_tiers ...'
46
+ end
47
+ allowable_values = ["percent_off", "-percent_off", "products_count", "-products_count"]
48
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
49
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
50
+ end
51
+ # resource path
52
+ local_var_path = '/api/v1/discount_tiers'
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
57
+ query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?
58
+ query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
59
+ query_params[:'meta[total]'] = opts[:'meta_total'] if !opts[:'meta_total'].nil?
60
+
61
+ # header parameters
62
+ header_params = opts[:header_params] || {}
63
+ # HTTP header 'Accept' (if needed)
64
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']
65
+
66
+ # form parameters
67
+ form_params = opts[:form_params] || {}
68
+
69
+ # http body (model)
70
+ post_body = opts[:debug_body]
71
+
72
+ # return_type
73
+ return_type = opts[:debug_return_type] || 'DiscountTierListResponse'
74
+
75
+ # auth_names
76
+ auth_names = opts[:debug_auth_names] || []
77
+
78
+ new_options = opts.merge(
79
+ :operation => :"DiscountTiersApi.list_discount_tiers",
80
+ :header_params => header_params,
81
+ :query_params => query_params,
82
+ :form_params => form_params,
83
+ :body => post_body,
84
+ :auth_names => auth_names,
85
+ :return_type => return_type
86
+ )
87
+
88
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
89
+ if @api_client.config.debugging
90
+ @api_client.config.logger.debug "API called: DiscountTiersApi#list_discount_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
91
+ end
92
+ return data, status_code, headers
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,193 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::App
17
+ # A single tier of the multi-product volume discount schedule.
18
+ class DiscountTier < ApiModelBase
19
+ # Minimum number of paid product subscriptions a customer must hold for this tier's discount to apply. Counts above the highest defined tier are clamped to that tier.
20
+ attr_accessor :products_count
21
+
22
+ # Discount percentage applied to every paid subscription item when the customer holds at least ``products_count`` paid products. 0 means no discount at this tier.
23
+ attr_accessor :percent_off
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'products_count' => :'products_count',
29
+ :'percent_off' => :'percent_off'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'products_count' => :'Integer',
47
+ :'percent_off' => :'Integer'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::DiscountTier` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::DiscountTier`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'products_count')
74
+ self.products_count = attributes[:'products_count']
75
+ else
76
+ self.products_count = nil
77
+ end
78
+
79
+ if attributes.key?(:'percent_off')
80
+ self.percent_off = attributes[:'percent_off']
81
+ else
82
+ self.percent_off = nil
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
+ invalid_properties = Array.new
91
+ if @products_count.nil?
92
+ invalid_properties.push('invalid value for "products_count", products_count cannot be nil.')
93
+ end
94
+
95
+ if @percent_off.nil?
96
+ invalid_properties.push('invalid value for "percent_off", percent_off cannot be nil.')
97
+ end
98
+
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ warn '[DEPRECATED] the `valid?` method is obsolete'
106
+ return false if @products_count.nil?
107
+ return false if @percent_off.nil?
108
+ true
109
+ end
110
+
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] products_count Value to be assigned
113
+ def products_count=(products_count)
114
+ if products_count.nil?
115
+ fail ArgumentError, 'products_count cannot be nil'
116
+ end
117
+
118
+ @products_count = products_count
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param [Object] percent_off Value to be assigned
123
+ def percent_off=(percent_off)
124
+ if percent_off.nil?
125
+ fail ArgumentError, 'percent_off cannot be nil'
126
+ end
127
+
128
+ @percent_off = percent_off
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ products_count == o.products_count &&
137
+ percent_off == o.percent_off
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [products_count, percent_off].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ attributes = attributes.transform_keys(&:to_sym)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
162
+ elsif type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
167
+ end
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
170
+ end
171
+ end
172
+ new(transformed_hash)
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ if value.nil?
182
+ is_nullable = self.class.openapi_nullable.include?(attr)
183
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
184
+ end
185
+
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ end
192
+
193
+ end
@@ -0,0 +1,193 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::App
17
+ # JSON:API collection response for the volume discount schedule.
18
+ class DiscountTierListResponse < ApiModelBase
19
+ attr_accessor :data
20
+
21
+ attr_accessor :meta
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'data' => :'data',
27
+ :'meta' => :'meta'
28
+ }
29
+ end
30
+
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'data' => :'Array<DiscountTierResource>',
45
+ :'meta' => :'ListMeta'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::DiscountTierListResponse` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::DiscountTierListResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'data')
72
+ if (value = attributes[:'data']).is_a?(Array)
73
+ self.data = value
74
+ end
75
+ else
76
+ self.data = nil
77
+ end
78
+
79
+ if attributes.key?(:'meta')
80
+ self.meta = attributes[:'meta']
81
+ else
82
+ self.meta = nil
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
+ invalid_properties = Array.new
91
+ if @data.nil?
92
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
93
+ end
94
+
95
+ if @meta.nil?
96
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
97
+ end
98
+
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ warn '[DEPRECATED] the `valid?` method is obsolete'
106
+ return false if @data.nil?
107
+ return false if @meta.nil?
108
+ true
109
+ end
110
+
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] data Value to be assigned
113
+ def data=(data)
114
+ if data.nil?
115
+ fail ArgumentError, 'data cannot be nil'
116
+ end
117
+
118
+ @data = data
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param [Object] meta Value to be assigned
123
+ def meta=(meta)
124
+ if meta.nil?
125
+ fail ArgumentError, 'meta cannot be nil'
126
+ end
127
+
128
+ @meta = meta
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ data == o.data &&
137
+ meta == o.meta
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [data, meta].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ attributes = attributes.transform_keys(&:to_sym)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
162
+ elsif type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
167
+ end
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
170
+ end
171
+ end
172
+ new(transformed_hash)
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ if value.nil?
182
+ is_nullable = self.class.openapi_nullable.include?(attr)
183
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
184
+ end
185
+
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ end
192
+
193
+ end
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::App
17
+ # JSON:API resource envelope for a volume discount tier.
18
+ class DiscountTierResource < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ attr_accessor :type
22
+
23
+ attr_accessor :attributes
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'id' => :'id',
51
+ :'type' => :'type',
52
+ :'attributes' => :'attributes'
53
+ }
54
+ end
55
+
56
+ # Returns attribute mapping this model knows about
57
+ def self.acceptable_attribute_map
58
+ attribute_map
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ acceptable_attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'id' => :'String',
70
+ :'type' => :'String',
71
+ :'attributes' => :'DiscountTier'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ :'id',
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::DiscountTierResource` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::DiscountTierResource`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'id')
99
+ self.id = attributes[:'id']
100
+ end
101
+
102
+ if attributes.key?(:'type')
103
+ self.type = attributes[:'type']
104
+ else
105
+ self.type = nil
106
+ end
107
+
108
+ if attributes.key?(:'attributes')
109
+ self.attributes = attributes[:'attributes']
110
+ else
111
+ self.attributes = nil
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @type.nil?
121
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
122
+ end
123
+
124
+ if @attributes.nil?
125
+ invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ warn '[DEPRECATED] the `valid?` method is obsolete'
135
+ return false if @type.nil?
136
+ type_validator = EnumAttributeValidator.new('String', ["discount_tier"])
137
+ return false unless type_validator.valid?(@type)
138
+ return false if @attributes.nil?
139
+ true
140
+ end
141
+
142
+ # Custom attribute writer method checking allowed values (enum).
143
+ # @param [Object] type Object to be assigned
144
+ def type=(type)
145
+ validator = EnumAttributeValidator.new('String', ["discount_tier"])
146
+ unless validator.valid?(type)
147
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
148
+ end
149
+ @type = type
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] attributes Value to be assigned
154
+ def attributes=(attributes)
155
+ if attributes.nil?
156
+ fail ArgumentError, 'attributes cannot be nil'
157
+ end
158
+
159
+ @attributes = attributes
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ id == o.id &&
168
+ type == o.type &&
169
+ attributes == o.attributes
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [id, type, attributes].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ transformed_hash = {}
191
+ openapi_types.each_pair do |key, type|
192
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = nil
194
+ elsif type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[attribute_map[key]].is_a?(Array)
198
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
199
+ end
200
+ elsif !attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
202
+ end
203
+ end
204
+ new(transformed_hash)
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -52,6 +52,9 @@ require 'smplkit_app_client/models/context_type_response'
52
52
  require 'smplkit_app_client/models/context_value'
53
53
  require 'smplkit_app_client/models/context_value_list_response'
54
54
  require 'smplkit_app_client/models/context_value_resource'
55
+ require 'smplkit_app_client/models/discount_tier'
56
+ require 'smplkit_app_client/models/discount_tier_list_response'
57
+ require 'smplkit_app_client/models/discount_tier_resource'
55
58
  require 'smplkit_app_client/models/email'
56
59
  require 'smplkit_app_client/models/email_resource'
57
60
  require 'smplkit_app_client/models/email_response'
@@ -140,6 +143,7 @@ require 'smplkit_app_client/api/billing_api'
140
143
  require 'smplkit_app_client/api/context_types_api'
141
144
  require 'smplkit_app_client/api/context_values_api'
142
145
  require 'smplkit_app_client/api/contexts_api'
146
+ require 'smplkit_app_client/api/discount_tiers_api'
143
147
  require 'smplkit_app_client/api/email_registrations_api'
144
148
  require 'smplkit_app_client/api/emails_api'
145
149
  require 'smplkit_app_client/api/environments_api'
@@ -0,0 +1,50 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for SmplkitGeneratedClient::App::DiscountTiersApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'DiscountTiersApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = SmplkitGeneratedClient::App::DiscountTiersApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of DiscountTiersApi' do
30
+ it 'should create an instance of DiscountTiersApi' do
31
+ expect(@api_instance).to be_instance_of(SmplkitGeneratedClient::App::DiscountTiersApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for list_discount_tiers
36
+ # List Discount Tiers
37
+ # Return the multi-product volume discount schedule. Each tier is identified by the minimum number of paid products at which the discount applies. The first tier (1 product) carries no discount; subsequent tiers grant a progressively larger percent off every paid subscription item. Default sort is &#x60;products_count&#x60; ascending, which is the natural ladder customers traverse as they add products.
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;products_count&#x60;. Allowed values: &#x60;percent_off&#x60;, &#x60;-percent_off&#x60;, &#x60;products_count&#x60;, &#x60;-products_count&#x60;.
40
+ # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to &#x60;1&#x60; when omitted. Must be &#x60;&gt;&#x3D; 1&#x60; — requests with a smaller value are rejected with a 400 error.
41
+ # @option opts [Integer] :page_size Number of items per page. Optional; defaults to &#x60;1000&#x60; when omitted. Must be between &#x60;1&#x60; and &#x60;1000&#x60; inclusive — requests outside that range are rejected with a 400 error.
42
+ # @option opts [Boolean] :meta_total When &#x60;true&#x60;, the response&#39;s &#x60;meta.pagination&#x60; block includes &#x60;total&#x60; (the total number of matching items across all pages) and &#x60;total_pages&#x60;. Computing these requires an extra &#x60;COUNT&#x60; query, so omit (or pass &#x60;false&#x60;) when the totals are not needed. Defaults to &#x60;false&#x60;.
43
+ # @return [DiscountTierListResponse]
44
+ describe 'list_discount_tiers test' do
45
+ it 'should work' do
46
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for SmplkitGeneratedClient::App::DiscountTierListResponse
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe SmplkitGeneratedClient::App::DiscountTierListResponse do
21
+ #let(:instance) { SmplkitGeneratedClient::App::DiscountTierListResponse.new }
22
+
23
+ describe 'test an instance of DiscountTierListResponse' do
24
+ it 'should create an instance of DiscountTierListResponse' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::App::DiscountTierListResponse)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "data"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "meta"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,52 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for SmplkitGeneratedClient::App::DiscountTierResource
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe SmplkitGeneratedClient::App::DiscountTierResource do
21
+ #let(:instance) { SmplkitGeneratedClient::App::DiscountTierResource.new }
22
+
23
+ describe 'test an instance of DiscountTierResource' do
24
+ it 'should create an instance of DiscountTierResource' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::App::DiscountTierResource)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "id"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "type"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["discount_tier"])
40
+ # validator.allowable_values.each do |value|
41
+ # expect { instance.type = value }.not_to raise_error
42
+ # end
43
+ end
44
+ end
45
+
46
+ describe 'test attribute "attributes"' do
47
+ it 'should work' do
48
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
49
+ end
50
+ end
51
+
52
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for SmplkitGeneratedClient::App::DiscountTier
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe SmplkitGeneratedClient::App::DiscountTier do
21
+ #let(:instance) { SmplkitGeneratedClient::App::DiscountTier.new }
22
+
23
+ describe 'test an instance of DiscountTier' do
24
+ it 'should create an instance of DiscountTier' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::App::DiscountTier)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "products_count"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "percent_off"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smplkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.37
4
+ version: 3.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC
@@ -159,6 +159,7 @@ files:
159
159
  - lib/smplkit/_generated/app/lib/smplkit_app_client/api/context_types_api.rb
160
160
  - lib/smplkit/_generated/app/lib/smplkit_app_client/api/context_values_api.rb
161
161
  - lib/smplkit/_generated/app/lib/smplkit_app_client/api/contexts_api.rb
162
+ - lib/smplkit/_generated/app/lib/smplkit_app_client/api/discount_tiers_api.rb
162
163
  - lib/smplkit/_generated/app/lib/smplkit_app_client/api/email_registrations_api.rb
163
164
  - lib/smplkit/_generated/app/lib/smplkit_app_client/api/emails_api.rb
164
165
  - lib/smplkit/_generated/app/lib/smplkit_app_client/api/environments_api.rb
@@ -207,6 +208,9 @@ files:
207
208
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/context_value.rb
208
209
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/context_value_list_response.rb
209
210
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/context_value_resource.rb
211
+ - lib/smplkit/_generated/app/lib/smplkit_app_client/models/discount_tier.rb
212
+ - lib/smplkit/_generated/app/lib/smplkit_app_client/models/discount_tier_list_response.rb
213
+ - lib/smplkit/_generated/app/lib/smplkit_app_client/models/discount_tier_resource.rb
210
214
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/email.rb
211
215
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/email_resource.rb
212
216
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/email_response.rb
@@ -294,6 +298,7 @@ files:
294
298
  - lib/smplkit/_generated/app/spec/api/context_types_api_spec.rb
295
299
  - lib/smplkit/_generated/app/spec/api/context_values_api_spec.rb
296
300
  - lib/smplkit/_generated/app/spec/api/contexts_api_spec.rb
301
+ - lib/smplkit/_generated/app/spec/api/discount_tiers_api_spec.rb
297
302
  - lib/smplkit/_generated/app/spec/api/email_registrations_api_spec.rb
298
303
  - lib/smplkit/_generated/app/spec/api/emails_api_spec.rb
299
304
  - lib/smplkit/_generated/app/spec/api/environments_api_spec.rb
@@ -338,6 +343,9 @@ files:
338
343
  - lib/smplkit/_generated/app/spec/models/context_value_list_response_spec.rb
339
344
  - lib/smplkit/_generated/app/spec/models/context_value_resource_spec.rb
340
345
  - lib/smplkit/_generated/app/spec/models/context_value_spec.rb
346
+ - lib/smplkit/_generated/app/spec/models/discount_tier_list_response_spec.rb
347
+ - lib/smplkit/_generated/app/spec/models/discount_tier_resource_spec.rb
348
+ - lib/smplkit/_generated/app/spec/models/discount_tier_spec.rb
341
349
  - lib/smplkit/_generated/app/spec/models/email_resource_spec.rb
342
350
  - lib/smplkit/_generated/app/spec/models/email_response_spec.rb
343
351
  - lib/smplkit/_generated/app/spec/models/email_spec.rb