printful_client 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '057873a0ee4a4268d53bdd79ce9ec67b028ebac7c17c458c7311718cf4dadac8'
4
- data.tar.gz: 46c34a64fcf9362704c448a9d65ab67ca9e8d674ae9e51a55f744d6dd5394ca7
3
+ metadata.gz: 02f8444942be126bba176a91509ece1cc05389cbae715a83ebc77a4af2dfbd65
4
+ data.tar.gz: 1d3268051aba16863e6a6c224ab4887ff911e97b77a6f8fb9fc01a175c09e449
5
5
  SHA512:
6
- metadata.gz: deb9b92405853e431160a098d5adf2f344be52ae8ea3ec7753dc7fa412e0f22ced6b3ee1b2b62eabc4a593a29ecb50359f8b4b08eab4ba1025ed6e4ad41bb798
7
- data.tar.gz: 233e0474acfdb5cc6b54798a4d5cee23bc4ea4b44624711915d61bf3554410337440a564a68c73676fb50e1585ea06bc8d20acca29597f83216c9a44501f9e5d
6
+ metadata.gz: 8a0883b020f57dbd9362d3dbf8ccdb18727bf9cf48eeda0e9fc85e6d335009a3f33af0f0edfe2e3ddc93e1980dca3d77ad269d3d72c4c5b9d6ecbb8ca7217baf
7
+ data.tar.gz: 6bd01576d749edca97275a3e7e2e5dc1fbda45954cf2f87b52dfdeb79d8e2dc431aae50c3fdea593d69462039f12cfaf6b830f41a74654b693e3f9c15e97122d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- printful_client (1.0.1)
4
+ printful_client (1.0.2)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # printful-client
1
+ # printful_client
2
2
 
3
3
  A Ruby client for the [Printful.com API](https://developers.printful.com/docs/)
4
4
  generated using their OpenAPI/Swagger spec and the [OpenAPI Generator](https://openapi-generator.tech/) tool.
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **code** | **Integer** | Response status code `200` | [optional] |
8
- | **result** | [**Array<Category>**](Category.md) | | [optional] |
8
+ | **result** | [**GetCategories200ResponseAllOfResult**](GetCategories200ResponseAllOfResult.md) | | [optional] |
9
9
 
10
10
  ## Example
11
11
 
@@ -0,0 +1,18 @@
1
+ # Printful::GetCategories200ResponseAllOfResult
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **categories** | [**Array<Category>**](Category.md) | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'printful_client'
13
+
14
+ instance = Printful::GetCategories200ResponseAllOfResult.new(
15
+ categories: null
16
+ )
17
+ ```
18
+
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **code** | **Integer** | Response status code `200` | [optional] |
8
- | **result** | [**Category**](Category.md) | | [optional] |
8
+ | **result** | [**GetCategoryById200ResponseAllOfResult**](GetCategoryById200ResponseAllOfResult.md) | | [optional] |
9
9
 
10
10
  ## Example
11
11
 
@@ -0,0 +1,18 @@
1
+ # Printful::GetCategoryById200ResponseAllOfResult
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **category** | [**Category**](Category.md) | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'printful_client'
13
+
14
+ instance = Printful::GetCategoryById200ResponseAllOfResult.new(
15
+ category: null
16
+ )
17
+ ```
18
+
data/docs/README.md CHANGED
@@ -91,7 +91,7 @@ Printful API has a general rate limit of 120 API calls per minute. Additionally,
91
91
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
92
92
 
93
93
  - API version: 1.0
94
- - Package version: 1.0.1
94
+ - Package version: 1.0.2
95
95
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
96
96
  For more information, please visit [https://www.printful.com/docs/support](https://www.printful.com/docs/support)
97
97
 
@@ -108,16 +108,16 @@ gem build printful_client.gemspec
108
108
  Then either install the gem locally:
109
109
 
110
110
  ```shell
111
- gem install ./printful_client-1.0.1.gem
111
+ gem install ./printful_client-1.0.2.gem
112
112
  ```
113
113
 
114
- (for development, run `gem install --dev ./printful_client-1.0.1.gem` to install the development dependencies)
114
+ (for development, run `gem install --dev ./printful_client-1.0.2.gem` to install the development dependencies)
115
115
 
116
116
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
117
117
 
118
118
  Finally add this to the Gemfile:
119
119
 
120
- gem 'printful_client', '~> 1.0.1'
120
+ gem 'printful_client', '~> 1.0.2'
121
121
 
122
122
  ### Install from Git
123
123
 
@@ -270,7 +270,9 @@ Class | Method | HTTP request | Description
270
270
  - [Printful::GenerationTaskTemplateFile](docs/GenerationTaskTemplateFile.md)
271
271
  - [Printful::GetApprovalSheets200Response](docs/GetApprovalSheets200Response.md)
272
272
  - [Printful::GetCategories200Response](docs/GetCategories200Response.md)
273
+ - [Printful::GetCategories200ResponseAllOfResult](docs/GetCategories200ResponseAllOfResult.md)
273
274
  - [Printful::GetCategoryById200Response](docs/GetCategoryById200Response.md)
275
+ - [Printful::GetCategoryById200ResponseAllOfResult](docs/GetCategoryById200ResponseAllOfResult.md)
274
276
  - [Printful::GetCountries200Response](docs/GetCountries200Response.md)
275
277
  - [Printful::GetOrderByIdIdParameter](docs/GetOrderByIdIdParameter.md)
276
278
  - [Printful::GetOrders200Response](docs/GetOrders200Response.md)
data/generate.sh CHANGED
@@ -18,11 +18,11 @@ docker run --rm -v ${PWD}:/local \
18
18
  --api-name-suffix 'Client' \
19
19
  --ignore-file-override "/local/.openapi-generator-ignore" \
20
20
  --additional-properties=gemName="printful_client" \
21
- --additional-properties=gemVersion="1.0.1" \
21
+ --additional-properties=gemVersion="1.0.2" \
22
22
  --additional-properties=gemAuthor="Mindprint.ai" \
23
23
  --additional-properties=gemAuthorEmail="tech@mindprint.ai" \
24
- --additional-properties=gemSummary="A Ruby client for the [Printful.com API" \
25
- --additional-properties=gemDescription="A Ruby client for the [Printful.com API](https://developers.printful.com/docs/) generated using their OpenAPI/Swagger spec and the [OpenAPI Generator](https://openapi-generator.tech/) tool." \
24
+ --additional-properties=gemSummary="A Ruby client for the Printful.com API" \
25
+ --additional-properties=gemDescription="A Ruby client for the Printful.com API (https://developers.printful.com/docs/) generated using their OpenAPI/Swagger spec and the OpenAPI Generator (https://openapi-generator.tech/) tool." \
26
26
  --additional-properties=gemHomepage="https://github.com/mindprintai/printful_client" \
27
27
  --additional-properties=gemLicense="MIT" \
28
28
  --additional-properties=moduleName="Printful"
@@ -37,7 +37,7 @@ module Printful
37
37
  def self.openapi_types
38
38
  {
39
39
  :'code' => :'Integer',
40
- :'result' => :'Array<Category>'
40
+ :'result' => :'GetCategories200ResponseAllOfResult'
41
41
  }
42
42
  end
43
43
 
@@ -74,9 +74,7 @@ module Printful
74
74
  end
75
75
 
76
76
  if attributes.key?(:'result')
77
- if (value = attributes[:'result']).is_a?(Array)
78
- self.result = value
79
- end
77
+ self.result = attributes[:'result']
80
78
  end
81
79
  end
82
80
 
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #API Documentation | Printful
3
+
4
+ ## About the Printful API The Printful API is a RESTful API, that uses an HTTP protocol for communication. HTTP GET, POST, PUT and DELETE methods are used to access the API resources. ## Requests and responses ### Request endpoint All API requests have to be sent to this URL: ``` https://api.printful.com/ ``` If you are using a proxy, make sure that all requests have host header set to **api.printful.com**. ### Request parameters Some mandatory parameters (like object identifiers) must be included in the request URL path ``` GET /orders/123 ``` Additional parameters can be passed as GET variables: ``` GET /orders?offset=10&limit=5 ``` For POST and PUT requests, a more complex data structure can be passed as JSON encoded data in the request body: ``` POST /orders {\"recipient\":{...},\"items\":[...]} ``` ### Response body The response body is always a JSON object that contains a response status code (identical to the HTTP status code) and the result of the action. If the status code is 200, then the action was successful. ``` { \"code\": 200, //Response status code \"result\":{ //API method return data //... } } ``` Sometimes the response includes paging information to allow to browse larger result sets by adding offset and limit GET parameters to the request URL. ``` { \"code\": 200, //Response status code \"result\":[ { //Item 11 }, { //Item 12 } ] \"paging\": { \"total\": 12, //Total items available \"offset\": 10, //Items skipped from the beginning \"limit\": 20 //Number of items per page } } ``` ## Error response If the API call is not successful, then the response code is not in the 2xx range and the `result` attribute contains an error description. ``` { \"code\": 404, \"result\": \"Not Found\", \"error\": { \"reason\": \"NotFound\", \"message\": \"Not Found\" } } ``` In general, response codes in the 4xx range indicate an error that resulted from the provided information (e.g. a required parameter was missing, etc.), and codes in the 5xx range indicate an error with Printful's servers. ### Timestamps All timestamps from the API are returned as integers in UNIX timestamp format. ### Rate Limits Printful API has a general rate limit of 120 API calls per minute. Additionally, endpoints that perform resource intensive operations (such as mockup generator) have a lower allowed request limit. # Authentication <!-- ReDoc-Inject: <security-definitions> -->
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: devsupport@printful.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Printful
17
+ class GetCategories200ResponseAllOfResult
18
+ attr_accessor :categories
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'categories' => :'categories'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'categories' => :'Array<Category>'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Printful::GetCategories200ResponseAllOfResult` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Printful::GetCategories200ResponseAllOfResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'categories')
61
+ if (value = attributes[:'categories']).is_a?(Array)
62
+ self.categories = value
63
+ end
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
71
+ invalid_properties = Array.new
72
+ invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ warn '[DEPRECATED] the `valid?` method is obsolete'
79
+ true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ categories == o.categories
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Integer] Hash code
98
+ def hash
99
+ [categories].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def self.build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ attributes = attributes.transform_keys(&:to_sym)
108
+ transformed_hash = {}
109
+ openapi_types.each_pair do |key, type|
110
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
111
+ transformed_hash["#{key}"] = nil
112
+ elsif type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[attribute_map[key]].is_a?(Array)
116
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
117
+ end
118
+ elsif !attributes[attribute_map[key]].nil?
119
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
120
+ end
121
+ end
122
+ new(transformed_hash)
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def self._deserialize(type, value)
130
+ case type.to_sym
131
+ when :Time
132
+ Time.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ # models (e.g. Pet) or oneOf
163
+ klass = Printful.const_get(type)
164
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
165
+ end
166
+ end
167
+
168
+ # Returns the string representation of the object
169
+ # @return [String] String presentation of the object
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_hash (backward compatibility)
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_body
177
+ to_hash
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ if value.nil?
187
+ is_nullable = self.class.openapi_nullable.include?(attr)
188
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
+ end
190
+
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+
214
+ end
215
+
216
+ end
@@ -37,7 +37,7 @@ module Printful
37
37
  def self.openapi_types
38
38
  {
39
39
  :'code' => :'Integer',
40
- :'result' => :'Category'
40
+ :'result' => :'GetCategoryById200ResponseAllOfResult'
41
41
  }
42
42
  end
43
43
 
@@ -0,0 +1,214 @@
1
+ =begin
2
+ #API Documentation | Printful
3
+
4
+ ## About the Printful API The Printful API is a RESTful API, that uses an HTTP protocol for communication. HTTP GET, POST, PUT and DELETE methods are used to access the API resources. ## Requests and responses ### Request endpoint All API requests have to be sent to this URL: ``` https://api.printful.com/ ``` If you are using a proxy, make sure that all requests have host header set to **api.printful.com**. ### Request parameters Some mandatory parameters (like object identifiers) must be included in the request URL path ``` GET /orders/123 ``` Additional parameters can be passed as GET variables: ``` GET /orders?offset=10&limit=5 ``` For POST and PUT requests, a more complex data structure can be passed as JSON encoded data in the request body: ``` POST /orders {\"recipient\":{...},\"items\":[...]} ``` ### Response body The response body is always a JSON object that contains a response status code (identical to the HTTP status code) and the result of the action. If the status code is 200, then the action was successful. ``` { \"code\": 200, //Response status code \"result\":{ //API method return data //... } } ``` Sometimes the response includes paging information to allow to browse larger result sets by adding offset and limit GET parameters to the request URL. ``` { \"code\": 200, //Response status code \"result\":[ { //Item 11 }, { //Item 12 } ] \"paging\": { \"total\": 12, //Total items available \"offset\": 10, //Items skipped from the beginning \"limit\": 20 //Number of items per page } } ``` ## Error response If the API call is not successful, then the response code is not in the 2xx range and the `result` attribute contains an error description. ``` { \"code\": 404, \"result\": \"Not Found\", \"error\": { \"reason\": \"NotFound\", \"message\": \"Not Found\" } } ``` In general, response codes in the 4xx range indicate an error that resulted from the provided information (e.g. a required parameter was missing, etc.), and codes in the 5xx range indicate an error with Printful's servers. ### Timestamps All timestamps from the API are returned as integers in UNIX timestamp format. ### Rate Limits Printful API has a general rate limit of 120 API calls per minute. Additionally, endpoints that perform resource intensive operations (such as mockup generator) have a lower allowed request limit. # Authentication <!-- ReDoc-Inject: <security-definitions> -->
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: devsupport@printful.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Printful
17
+ class GetCategoryById200ResponseAllOfResult
18
+ attr_accessor :category
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'category' => :'category'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'category' => :'Category'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Printful::GetCategoryById200ResponseAllOfResult` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Printful::GetCategoryById200ResponseAllOfResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'category')
61
+ self.category = attributes[:'category']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ warn '[DEPRECATED] the `valid?` method is obsolete'
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ category == o.category
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [category].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ attributes = attributes.transform_keys(&:to_sym)
106
+ transformed_hash = {}
107
+ openapi_types.each_pair do |key, type|
108
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
109
+ transformed_hash["#{key}"] = nil
110
+ elsif type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[attribute_map[key]].is_a?(Array)
114
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
115
+ end
116
+ elsif !attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
118
+ end
119
+ end
120
+ new(transformed_hash)
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def self._deserialize(type, value)
128
+ case type.to_sym
129
+ when :Time
130
+ Time.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :Boolean
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ # models (e.g. Pet) or oneOf
161
+ klass = Printful.const_get(type)
162
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+
212
+ end
213
+
214
+ end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 7.0.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module Printful
14
- VERSION = '1.0.1'
14
+ VERSION = '1.0.2'
15
15
  end
@@ -64,7 +64,9 @@ require 'printful_client/models/generation_task_mockup'
64
64
  require 'printful_client/models/generation_task_template_file'
65
65
  require 'printful_client/models/get_approval_sheets200_response'
66
66
  require 'printful_client/models/get_categories200_response'
67
+ require 'printful_client/models/get_categories200_response_all_of_result'
67
68
  require 'printful_client/models/get_category_by_id200_response'
69
+ require 'printful_client/models/get_category_by_id200_response_all_of_result'
68
70
  require 'printful_client/models/get_countries200_response'
69
71
  require 'printful_client/models/get_order_by_id_id_parameter'
70
72
  require 'printful_client/models/get_orders200_response'
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
22
22
  s.authors = ["Mindprint.ai"]
23
23
  s.email = ["tech@mindprint.ai"]
24
24
  s.homepage = "https://github.com/mindprintai/printful_client"
25
- s.summary = "A Ruby client for the [Printful.com API"
26
- s.description = "A Ruby client for the [Printful.com API](https://developers.printful.com/docs/) generated using their OpenAPI/Swagger spec and the [OpenAPI Generator](https://openapi-generator.tech/) tool."
25
+ s.summary = "A Ruby client for the Printful.com API"
26
+ s.description = "A Ruby client for the Printful.com API (https://developers.printful.com/docs/) generated using their OpenAPI/Swagger spec and the OpenAPI Generator (https://openapi-generator.tech/) tool."
27
27
  s.license = "MIT"
28
28
  s.required_ruby_version = ">= 2.7"
29
29
 
@@ -0,0 +1,34 @@
1
+ =begin
2
+ #API Documentation | Printful
3
+
4
+ ## About the Printful API The Printful API is a RESTful API, that uses an HTTP protocol for communication. HTTP GET, POST, PUT and DELETE methods are used to access the API resources. ## Requests and responses ### Request endpoint All API requests have to be sent to this URL: ``` https://api.printful.com/ ``` If you are using a proxy, make sure that all requests have host header set to **api.printful.com**. ### Request parameters Some mandatory parameters (like object identifiers) must be included in the request URL path ``` GET /orders/123 ``` Additional parameters can be passed as GET variables: ``` GET /orders?offset=10&limit=5 ``` For POST and PUT requests, a more complex data structure can be passed as JSON encoded data in the request body: ``` POST /orders {\"recipient\":{...},\"items\":[...]} ``` ### Response body The response body is always a JSON object that contains a response status code (identical to the HTTP status code) and the result of the action. If the status code is 200, then the action was successful. ``` { \"code\": 200, //Response status code \"result\":{ //API method return data //... } } ``` Sometimes the response includes paging information to allow to browse larger result sets by adding offset and limit GET parameters to the request URL. ``` { \"code\": 200, //Response status code \"result\":[ { //Item 11 }, { //Item 12 } ] \"paging\": { \"total\": 12, //Total items available \"offset\": 10, //Items skipped from the beginning \"limit\": 20 //Number of items per page } } ``` ## Error response If the API call is not successful, then the response code is not in the 2xx range and the `result` attribute contains an error description. ``` { \"code\": 404, \"result\": \"Not Found\", \"error\": { \"reason\": \"NotFound\", \"message\": \"Not Found\" } } ``` In general, response codes in the 4xx range indicate an error that resulted from the provided information (e.g. a required parameter was missing, etc.), and codes in the 5xx range indicate an error with Printful's servers. ### Timestamps All timestamps from the API are returned as integers in UNIX timestamp format. ### Rate Limits Printful API has a general rate limit of 120 API calls per minute. Additionally, endpoints that perform resource intensive operations (such as mockup generator) have a lower allowed request limit. # Authentication <!-- ReDoc-Inject: <security-definitions> -->
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: devsupport@printful.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for Printful::GetCategories200ResponseAllOfResult
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe Printful::GetCategories200ResponseAllOfResult do
21
+ let(:instance) { Printful::GetCategories200ResponseAllOfResult.new }
22
+
23
+ describe 'test an instance of GetCategories200ResponseAllOfResult' do
24
+ it 'should create an instance of GetCategories200ResponseAllOfResult' do
25
+ expect(instance).to be_instance_of(Printful::GetCategories200ResponseAllOfResult)
26
+ end
27
+ end
28
+ describe 'test attribute "categories"' do
29
+ it 'should work' do
30
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
31
+ end
32
+ end
33
+
34
+ end
@@ -0,0 +1,34 @@
1
+ =begin
2
+ #API Documentation | Printful
3
+
4
+ ## About the Printful API The Printful API is a RESTful API, that uses an HTTP protocol for communication. HTTP GET, POST, PUT and DELETE methods are used to access the API resources. ## Requests and responses ### Request endpoint All API requests have to be sent to this URL: ``` https://api.printful.com/ ``` If you are using a proxy, make sure that all requests have host header set to **api.printful.com**. ### Request parameters Some mandatory parameters (like object identifiers) must be included in the request URL path ``` GET /orders/123 ``` Additional parameters can be passed as GET variables: ``` GET /orders?offset=10&limit=5 ``` For POST and PUT requests, a more complex data structure can be passed as JSON encoded data in the request body: ``` POST /orders {\"recipient\":{...},\"items\":[...]} ``` ### Response body The response body is always a JSON object that contains a response status code (identical to the HTTP status code) and the result of the action. If the status code is 200, then the action was successful. ``` { \"code\": 200, //Response status code \"result\":{ //API method return data //... } } ``` Sometimes the response includes paging information to allow to browse larger result sets by adding offset and limit GET parameters to the request URL. ``` { \"code\": 200, //Response status code \"result\":[ { //Item 11 }, { //Item 12 } ] \"paging\": { \"total\": 12, //Total items available \"offset\": 10, //Items skipped from the beginning \"limit\": 20 //Number of items per page } } ``` ## Error response If the API call is not successful, then the response code is not in the 2xx range and the `result` attribute contains an error description. ``` { \"code\": 404, \"result\": \"Not Found\", \"error\": { \"reason\": \"NotFound\", \"message\": \"Not Found\" } } ``` In general, response codes in the 4xx range indicate an error that resulted from the provided information (e.g. a required parameter was missing, etc.), and codes in the 5xx range indicate an error with Printful's servers. ### Timestamps All timestamps from the API are returned as integers in UNIX timestamp format. ### Rate Limits Printful API has a general rate limit of 120 API calls per minute. Additionally, endpoints that perform resource intensive operations (such as mockup generator) have a lower allowed request limit. # Authentication <!-- ReDoc-Inject: <security-definitions> -->
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: devsupport@printful.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for Printful::GetCategoryById200ResponseAllOfResult
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe Printful::GetCategoryById200ResponseAllOfResult do
21
+ let(:instance) { Printful::GetCategoryById200ResponseAllOfResult.new }
22
+
23
+ describe 'test an instance of GetCategoryById200ResponseAllOfResult' do
24
+ it 'should create an instance of GetCategoryById200ResponseAllOfResult' do
25
+ expect(instance).to be_instance_of(Printful::GetCategoryById200ResponseAllOfResult)
26
+ end
27
+ end
28
+ describe 'test attribute "category"' do
29
+ it 'should work' do
30
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
31
+ end
32
+ end
33
+
34
+ end
data/swagger.json CHANGED
@@ -4054,9 +4054,14 @@
4054
4054
  {
4055
4055
  "properties": {
4056
4056
  "result": {
4057
- "type": "array",
4058
- "items": {
4059
- "$ref": "#/components/schemas/Category"
4057
+ "type": "object",
4058
+ "properties": {
4059
+ "categories": {
4060
+ "type": "array",
4061
+ "items": {
4062
+ "$ref": "#/components/schemas/Category"
4063
+ }
4064
+ }
4060
4065
  }
4061
4066
  }
4062
4067
  }
@@ -4078,7 +4083,12 @@
4078
4083
  {
4079
4084
  "properties": {
4080
4085
  "result": {
4081
- "$ref": "#/components/schemas/Category"
4086
+ "type": "object",
4087
+ "properties": {
4088
+ "category": {
4089
+ "$ref": "#/components/schemas/Category"
4090
+ }
4091
+ }
4082
4092
  }
4083
4093
  }
4084
4094
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: printful_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindprint.ai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-22 00:00:00.000000000 Z
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -50,8 +50,8 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 3.6.0
53
- description: A Ruby client for the [Printful.com API](https://developers.printful.com/docs/)
54
- generated using their OpenAPI/Swagger spec and the [OpenAPI Generator](https://openapi-generator.tech/)
53
+ description: A Ruby client for the Printful.com API (https://developers.printful.com/docs/)
54
+ generated using their OpenAPI/Swagger spec and the OpenAPI Generator (https://openapi-generator.tech/)
55
55
  tool.
56
56
  email:
57
57
  - tech@mindprint.ai
@@ -115,7 +115,9 @@ files:
115
115
  - docs/GenerationTaskTemplateFile.md
116
116
  - docs/GetApprovalSheets200Response.md
117
117
  - docs/GetCategories200Response.md
118
+ - docs/GetCategories200ResponseAllOfResult.md
118
119
  - docs/GetCategoryById200Response.md
120
+ - docs/GetCategoryById200ResponseAllOfResult.md
119
121
  - docs/GetCountries200Response.md
120
122
  - docs/GetOrderByIdIdParameter.md
121
123
  - docs/GetOrders200Response.md
@@ -309,7 +311,9 @@ files:
309
311
  - lib/printful_client/models/generation_task_template_file.rb
310
312
  - lib/printful_client/models/get_approval_sheets200_response.rb
311
313
  - lib/printful_client/models/get_categories200_response.rb
314
+ - lib/printful_client/models/get_categories200_response_all_of_result.rb
312
315
  - lib/printful_client/models/get_category_by_id200_response.rb
316
+ - lib/printful_client/models/get_category_by_id200_response_all_of_result.rb
313
317
  - lib/printful_client/models/get_countries200_response.rb
314
318
  - lib/printful_client/models/get_order_by_id_id_parameter.rb
315
319
  - lib/printful_client/models/get_orders200_response.rb
@@ -489,7 +493,9 @@ files:
489
493
  - spec/models/generation_task_spec.rb
490
494
  - spec/models/generation_task_template_file_spec.rb
491
495
  - spec/models/get_approval_sheets200_response_spec.rb
496
+ - spec/models/get_categories200_response_all_of_result_spec.rb
492
497
  - spec/models/get_categories200_response_spec.rb
498
+ - spec/models/get_category_by_id200_response_all_of_result_spec.rb
493
499
  - spec/models/get_category_by_id200_response_spec.rb
494
500
  - spec/models/get_countries200_response_spec.rb
495
501
  - spec/models/get_order_by_id_id_parameter_spec.rb
@@ -628,7 +634,7 @@ requirements: []
628
634
  rubygems_version: 3.4.10
629
635
  signing_key:
630
636
  specification_version: 4
631
- summary: A Ruby client for the [Printful.com API
637
+ summary: A Ruby client for the Printful.com API
632
638
  test_files:
633
639
  - spec/api/product_templates_api_client_spec.rb
634
640
  - spec/api/orders_api_client_spec.rb
@@ -705,9 +711,11 @@ test_files:
705
711
  - spec/models/get_stores200_response_spec.rb
706
712
  - spec/models/update_sync_product_request_sync_variants_inner_spec.rb
707
713
  - spec/models/delete_product_template200_response_all_of_result_spec.rb
714
+ - spec/models/get_categories200_response_all_of_result_spec.rb
708
715
  - spec/models/create_sync_product400_response_error_spec.rb
709
716
  - spec/models/update_sync_variant_request_spec.rb
710
717
  - spec/models/tax_request_spec.rb
718
+ - spec/models/get_category_by_id200_response_all_of_result_spec.rb
711
719
  - spec/models/get_templates200_response_spec.rb
712
720
  - spec/models/get_products401_response_spec.rb
713
721
  - spec/models/get_tax_countries200_response_result_inner_spec.rb