google-apis-manufacturers_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module ManufacturersV1
18
+ # Version of the google-apis-manufacturers_v1 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20201208"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,253 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module ManufacturersV1
24
+
25
+ class Attributes
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class Capacity
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class Count
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class DestinationStatus
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class Empty
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class FeatureDescription
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class Image
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class Issue
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class ListProductsResponse
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class Price
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class Product
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class ProductDetail
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class Attributes
98
+ # @private
99
+ class Representation < Google::Apis::Core::JsonRepresentation
100
+ collection :additional_image_link, as: 'additionalImageLink', class: Google::Apis::ManufacturersV1::Image, decorator: Google::Apis::ManufacturersV1::Image::Representation
101
+
102
+ property :age_group, as: 'ageGroup'
103
+ property :brand, as: 'brand'
104
+ property :capacity, as: 'capacity', class: Google::Apis::ManufacturersV1::Capacity, decorator: Google::Apis::ManufacturersV1::Capacity::Representation
105
+
106
+ property :color, as: 'color'
107
+ property :count, as: 'count', class: Google::Apis::ManufacturersV1::Count, decorator: Google::Apis::ManufacturersV1::Count::Representation
108
+
109
+ property :description, as: 'description'
110
+ property :disclosure_date, as: 'disclosureDate'
111
+ collection :excluded_destination, as: 'excludedDestination'
112
+ collection :feature_description, as: 'featureDescription', class: Google::Apis::ManufacturersV1::FeatureDescription, decorator: Google::Apis::ManufacturersV1::FeatureDescription::Representation
113
+
114
+ property :flavor, as: 'flavor'
115
+ property :format, as: 'format'
116
+ property :gender, as: 'gender'
117
+ collection :gtin, as: 'gtin'
118
+ property :image_link, as: 'imageLink', class: Google::Apis::ManufacturersV1::Image, decorator: Google::Apis::ManufacturersV1::Image::Representation
119
+
120
+ collection :included_destination, as: 'includedDestination'
121
+ property :item_group_id, as: 'itemGroupId'
122
+ property :material, as: 'material'
123
+ property :mpn, as: 'mpn'
124
+ property :pattern, as: 'pattern'
125
+ collection :product_detail, as: 'productDetail', class: Google::Apis::ManufacturersV1::ProductDetail, decorator: Google::Apis::ManufacturersV1::ProductDetail::Representation
126
+
127
+ property :product_line, as: 'productLine'
128
+ property :product_name, as: 'productName'
129
+ property :product_page_url, as: 'productPageUrl'
130
+ collection :product_type, as: 'productType'
131
+ property :release_date, as: 'releaseDate'
132
+ collection :rich_product_content, as: 'richProductContent'
133
+ property :scent, as: 'scent'
134
+ property :size, as: 'size'
135
+ property :size_system, as: 'sizeSystem'
136
+ property :size_type, as: 'sizeType'
137
+ property :suggested_retail_price, as: 'suggestedRetailPrice', class: Google::Apis::ManufacturersV1::Price, decorator: Google::Apis::ManufacturersV1::Price::Representation
138
+
139
+ property :target_client_id, as: 'targetClientId'
140
+ property :theme, as: 'theme'
141
+ property :title, as: 'title'
142
+ collection :video_link, as: 'videoLink'
143
+ end
144
+ end
145
+
146
+ class Capacity
147
+ # @private
148
+ class Representation < Google::Apis::Core::JsonRepresentation
149
+ property :unit, as: 'unit'
150
+ property :value, :numeric_string => true, as: 'value'
151
+ end
152
+ end
153
+
154
+ class Count
155
+ # @private
156
+ class Representation < Google::Apis::Core::JsonRepresentation
157
+ property :unit, as: 'unit'
158
+ property :value, :numeric_string => true, as: 'value'
159
+ end
160
+ end
161
+
162
+ class DestinationStatus
163
+ # @private
164
+ class Representation < Google::Apis::Core::JsonRepresentation
165
+ property :destination, as: 'destination'
166
+ property :status, as: 'status'
167
+ end
168
+ end
169
+
170
+ class Empty
171
+ # @private
172
+ class Representation < Google::Apis::Core::JsonRepresentation
173
+ end
174
+ end
175
+
176
+ class FeatureDescription
177
+ # @private
178
+ class Representation < Google::Apis::Core::JsonRepresentation
179
+ property :headline, as: 'headline'
180
+ property :image, as: 'image', class: Google::Apis::ManufacturersV1::Image, decorator: Google::Apis::ManufacturersV1::Image::Representation
181
+
182
+ property :text, as: 'text'
183
+ end
184
+ end
185
+
186
+ class Image
187
+ # @private
188
+ class Representation < Google::Apis::Core::JsonRepresentation
189
+ property :image_url, as: 'imageUrl'
190
+ property :status, as: 'status'
191
+ property :type, as: 'type'
192
+ end
193
+ end
194
+
195
+ class Issue
196
+ # @private
197
+ class Representation < Google::Apis::Core::JsonRepresentation
198
+ property :attribute, as: 'attribute'
199
+ property :description, as: 'description'
200
+ property :destination, as: 'destination'
201
+ property :resolution, as: 'resolution'
202
+ property :severity, as: 'severity'
203
+ property :timestamp, as: 'timestamp'
204
+ property :title, as: 'title'
205
+ property :type, as: 'type'
206
+ end
207
+ end
208
+
209
+ class ListProductsResponse
210
+ # @private
211
+ class Representation < Google::Apis::Core::JsonRepresentation
212
+ property :next_page_token, as: 'nextPageToken'
213
+ collection :products, as: 'products', class: Google::Apis::ManufacturersV1::Product, decorator: Google::Apis::ManufacturersV1::Product::Representation
214
+
215
+ end
216
+ end
217
+
218
+ class Price
219
+ # @private
220
+ class Representation < Google::Apis::Core::JsonRepresentation
221
+ property :amount, as: 'amount'
222
+ property :currency, as: 'currency'
223
+ end
224
+ end
225
+
226
+ class Product
227
+ # @private
228
+ class Representation < Google::Apis::Core::JsonRepresentation
229
+ property :attributes, as: 'attributes', class: Google::Apis::ManufacturersV1::Attributes, decorator: Google::Apis::ManufacturersV1::Attributes::Representation
230
+
231
+ property :content_language, as: 'contentLanguage'
232
+ collection :destination_statuses, as: 'destinationStatuses', class: Google::Apis::ManufacturersV1::DestinationStatus, decorator: Google::Apis::ManufacturersV1::DestinationStatus::Representation
233
+
234
+ collection :issues, as: 'issues', class: Google::Apis::ManufacturersV1::Issue, decorator: Google::Apis::ManufacturersV1::Issue::Representation
235
+
236
+ property :name, as: 'name'
237
+ property :parent, as: 'parent'
238
+ property :product_id, as: 'productId'
239
+ property :target_country, as: 'targetCountry'
240
+ end
241
+ end
242
+
243
+ class ProductDetail
244
+ # @private
245
+ class Representation < Google::Apis::Core::JsonRepresentation
246
+ property :attribute_name, as: 'attributeName'
247
+ property :attribute_value, as: 'attributeValue'
248
+ property :section_name, as: 'sectionName'
249
+ end
250
+ end
251
+ end
252
+ end
253
+ end
@@ -0,0 +1,239 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module ManufacturersV1
23
+ # Manufacturer Center API
24
+ #
25
+ # Public API for managing Manufacturer Center related data.
26
+ #
27
+ # @example
28
+ # require 'google/apis/manufacturers_v1'
29
+ #
30
+ # Manufacturers = Google::Apis::ManufacturersV1 # Alias the module
31
+ # service = Manufacturers::ManufacturerCenterService.new
32
+ #
33
+ # @see https://developers.google.com/manufacturers/
34
+ class ManufacturerCenterService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://manufacturers.googleapis.com/', '',
47
+ client_name: 'google-apis-manufacturers_v1',
48
+ client_version: Google::Apis::ManufacturersV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Deletes the product from a Manufacturer Center account.
53
+ # @param [String] parent
54
+ # Parent ID in the format `accounts/`account_id``. `account_id` - The ID of the
55
+ # Manufacturer Center account.
56
+ # @param [String] name
57
+ # Name in the format ``target_country`:`content_language`:`product_id``. `
58
+ # target_country` - The target country of the product as a CLDR territory code (
59
+ # for example, US). `content_language` - The content language of the product as
60
+ # a two-letter ISO 639-1 language code (for example, en). `product_id` - The ID
61
+ # of the product. For more information, see https://support.google.com/
62
+ # manufacturers/answer/6124116#id.
63
+ # @param [String] fields
64
+ # Selector specifying which fields to include in a partial response.
65
+ # @param [String] quota_user
66
+ # Available to use for quota purposes for server-side applications. Can be any
67
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
68
+ # @param [Google::Apis::RequestOptions] options
69
+ # Request-specific options
70
+ #
71
+ # @yield [result, err] Result & error if block supplied
72
+ # @yieldparam result [Google::Apis::ManufacturersV1::Empty] parsed result object
73
+ # @yieldparam err [StandardError] error object if request failed
74
+ #
75
+ # @return [Google::Apis::ManufacturersV1::Empty]
76
+ #
77
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
78
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
79
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
80
+ def delete_account_product(parent, name, fields: nil, quota_user: nil, options: nil, &block)
81
+ command = make_simple_command(:delete, 'v1/{+parent}/products/{+name}', options)
82
+ command.response_representation = Google::Apis::ManufacturersV1::Empty::Representation
83
+ command.response_class = Google::Apis::ManufacturersV1::Empty
84
+ command.params['parent'] = parent unless parent.nil?
85
+ command.params['name'] = name unless name.nil?
86
+ command.query['fields'] = fields unless fields.nil?
87
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
88
+ execute_or_queue_command(command, &block)
89
+ end
90
+
91
+ # Gets the product from a Manufacturer Center account, including product issues.
92
+ # A recently updated product takes around 15 minutes to process. Changes are
93
+ # only visible after it has been processed. While some issues may be available
94
+ # once the product has been processed, other issues may take days to appear.
95
+ # @param [String] parent
96
+ # Parent ID in the format `accounts/`account_id``. `account_id` - The ID of the
97
+ # Manufacturer Center account.
98
+ # @param [String] name
99
+ # Name in the format ``target_country`:`content_language`:`product_id``. `
100
+ # target_country` - The target country of the product as a CLDR territory code (
101
+ # for example, US). `content_language` - The content language of the product as
102
+ # a two-letter ISO 639-1 language code (for example, en). `product_id` - The ID
103
+ # of the product. For more information, see https://support.google.com/
104
+ # manufacturers/answer/6124116#id.
105
+ # @param [Array<String>, String] include
106
+ # The information to be included in the response. Only sections listed here will
107
+ # be returned.
108
+ # @param [String] fields
109
+ # Selector specifying which fields to include in a partial response.
110
+ # @param [String] quota_user
111
+ # Available to use for quota purposes for server-side applications. Can be any
112
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
113
+ # @param [Google::Apis::RequestOptions] options
114
+ # Request-specific options
115
+ #
116
+ # @yield [result, err] Result & error if block supplied
117
+ # @yieldparam result [Google::Apis::ManufacturersV1::Product] parsed result object
118
+ # @yieldparam err [StandardError] error object if request failed
119
+ #
120
+ # @return [Google::Apis::ManufacturersV1::Product]
121
+ #
122
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
123
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
124
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
125
+ def get_account_product(parent, name, include: nil, fields: nil, quota_user: nil, options: nil, &block)
126
+ command = make_simple_command(:get, 'v1/{+parent}/products/{+name}', options)
127
+ command.response_representation = Google::Apis::ManufacturersV1::Product::Representation
128
+ command.response_class = Google::Apis::ManufacturersV1::Product
129
+ command.params['parent'] = parent unless parent.nil?
130
+ command.params['name'] = name unless name.nil?
131
+ command.query['include'] = include unless include.nil?
132
+ command.query['fields'] = fields unless fields.nil?
133
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
134
+ execute_or_queue_command(command, &block)
135
+ end
136
+
137
+ # Lists all the products in a Manufacturer Center account.
138
+ # @param [String] parent
139
+ # Parent ID in the format `accounts/`account_id``. `account_id` - The ID of the
140
+ # Manufacturer Center account.
141
+ # @param [Array<String>, String] include
142
+ # The information to be included in the response. Only sections listed here will
143
+ # be returned.
144
+ # @param [Fixnum] page_size
145
+ # Maximum number of product statuses to return in the response, used for paging.
146
+ # @param [String] page_token
147
+ # The token returned by the previous request.
148
+ # @param [String] fields
149
+ # Selector specifying which fields to include in a partial response.
150
+ # @param [String] quota_user
151
+ # Available to use for quota purposes for server-side applications. Can be any
152
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
153
+ # @param [Google::Apis::RequestOptions] options
154
+ # Request-specific options
155
+ #
156
+ # @yield [result, err] Result & error if block supplied
157
+ # @yieldparam result [Google::Apis::ManufacturersV1::ListProductsResponse] parsed result object
158
+ # @yieldparam err [StandardError] error object if request failed
159
+ #
160
+ # @return [Google::Apis::ManufacturersV1::ListProductsResponse]
161
+ #
162
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
163
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
164
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
165
+ def list_account_products(parent, include: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
166
+ command = make_simple_command(:get, 'v1/{+parent}/products', options)
167
+ command.response_representation = Google::Apis::ManufacturersV1::ListProductsResponse::Representation
168
+ command.response_class = Google::Apis::ManufacturersV1::ListProductsResponse
169
+ command.params['parent'] = parent unless parent.nil?
170
+ command.query['include'] = include unless include.nil?
171
+ command.query['pageSize'] = page_size unless page_size.nil?
172
+ command.query['pageToken'] = page_token unless page_token.nil?
173
+ command.query['fields'] = fields unless fields.nil?
174
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
175
+ execute_or_queue_command(command, &block)
176
+ end
177
+
178
+ # Inserts or updates the attributes of the product in a Manufacturer Center
179
+ # account. Creates a product with the provided attributes. If the product
180
+ # already exists, then all attributes are replaced with the new ones. The checks
181
+ # at upload time are minimal. All required attributes need to be present for a
182
+ # product to be valid. Issues may show up later after the API has accepted a new
183
+ # upload for a product and it is possible to overwrite an existing valid product
184
+ # with an invalid product. To detect this, you should retrieve the product and
185
+ # check it for issues once the new version is available. Uploaded attributes
186
+ # first need to be processed before they can be retrieved. Until then, new
187
+ # products will be unavailable, and retrieval of previously uploaded products
188
+ # will return the original state of the product.
189
+ # @param [String] parent
190
+ # Parent ID in the format `accounts/`account_id``. `account_id` - The ID of the
191
+ # Manufacturer Center account.
192
+ # @param [String] name
193
+ # Name in the format ``target_country`:`content_language`:`product_id``. `
194
+ # target_country` - The target country of the product as a CLDR territory code (
195
+ # for example, US). `content_language` - The content language of the product as
196
+ # a two-letter ISO 639-1 language code (for example, en). `product_id` - The ID
197
+ # of the product. For more information, see https://support.google.com/
198
+ # manufacturers/answer/6124116#id.
199
+ # @param [Google::Apis::ManufacturersV1::Attributes] attributes_object
200
+ # @param [String] fields
201
+ # Selector specifying which fields to include in a partial response.
202
+ # @param [String] quota_user
203
+ # Available to use for quota purposes for server-side applications. Can be any
204
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
205
+ # @param [Google::Apis::RequestOptions] options
206
+ # Request-specific options
207
+ #
208
+ # @yield [result, err] Result & error if block supplied
209
+ # @yieldparam result [Google::Apis::ManufacturersV1::Empty] parsed result object
210
+ # @yieldparam err [StandardError] error object if request failed
211
+ #
212
+ # @return [Google::Apis::ManufacturersV1::Empty]
213
+ #
214
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
215
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
216
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
217
+ def update_account_product(parent, name, attributes_object = nil, fields: nil, quota_user: nil, options: nil, &block)
218
+ command = make_simple_command(:put, 'v1/{+parent}/products/{+name}', options)
219
+ command.request_representation = Google::Apis::ManufacturersV1::Attributes::Representation
220
+ command.request_object = attributes_object
221
+ command.response_representation = Google::Apis::ManufacturersV1::Empty::Representation
222
+ command.response_class = Google::Apis::ManufacturersV1::Empty
223
+ command.params['parent'] = parent unless parent.nil?
224
+ command.params['name'] = name unless name.nil?
225
+ command.query['fields'] = fields unless fields.nil?
226
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
227
+ execute_or_queue_command(command, &block)
228
+ end
229
+
230
+ protected
231
+
232
+ def apply_command_defaults(command)
233
+ command.query['key'] = key unless key.nil?
234
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
235
+ end
236
+ end
237
+ end
238
+ end
239
+ end