growwer 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -5
  3. data/docs/CatalogueApi.md +4 -4
  4. data/docs/CreateSellerMediaRequest.md +38 -0
  5. data/docs/CreateSellerMediaRequestPostOffer.md +24 -0
  6. data/docs/ManagedServicesApi.md +2 -2
  7. data/docs/ProjectCatalogueMediaAllOfProject.md +3 -1
  8. data/docs/ProjectCatalogueMediaAllOfProjectAiKeywords.md +20 -0
  9. data/docs/SellerMedia.md +2 -0
  10. data/docs/SellerMediaPostOffer.md +7 -1
  11. data/docs/SellerMediasApi.md +148 -5
  12. data/docs/UpdateSellerMediaRequest.md +2 -0
  13. data/docs/UpdateSellerMediaRequestPostOffer.md +8 -2
  14. data/lib/growwer/api/catalogue_api.rb +4 -4
  15. data/lib/growwer/api/managed_services_api.rb +4 -4
  16. data/lib/growwer/api/seller_medias_api.rb +157 -4
  17. data/lib/growwer/api_client.rb +1 -1
  18. data/lib/growwer/models/create_seller_media_request.rb +447 -0
  19. data/lib/growwer/models/create_seller_media_request_post_offer.rb +273 -0
  20. data/lib/growwer/models/project_catalogue_media_all_of_project.rb +34 -5
  21. data/lib/growwer/models/project_catalogue_media_all_of_project_ai_keywords.rb +211 -0
  22. data/lib/growwer/models/seller_media.rb +29 -1
  23. data/lib/growwer/models/seller_media_post_offer.rb +99 -1
  24. data/lib/growwer/models/update_seller_media_request.rb +44 -1
  25. data/lib/growwer/models/update_seller_media_request_post_offer.rb +96 -12
  26. data/lib/growwer/version.rb +1 -1
  27. data/lib/growwer.rb +3 -0
  28. data/spec/models/create_seller_media_request_post_offer_spec.rb +62 -0
  29. data/spec/models/create_seller_media_request_spec.rb +100 -0
  30. data/spec/models/project_catalogue_media_all_of_project_ai_keywords_spec.rb +46 -0
  31. metadata +14 -2
@@ -93,6 +93,159 @@ module Growwer
93
93
  return data, status_code, headers
94
94
  end
95
95
 
96
+ # Register a media you sell on
97
+ # Registers one of your medias, as the media create page does. The media is created with `state: pending_review` and Growwer reviews it in the background, as for a media registered on the web; GET /seller/medias/{id} shows its state. - `rootUrl` is the media's root URL; `typology` is `blog` or `press`. - `country` and `language` take the codes GET /vocabulary publishes; `topics` and `bannedTopics` take its topic ids, at most 100 each, and no topic may be both; `bannedTopics` left out bans none. - `postOffer.pricingOptions` lists every link type you offer for sponsored posts, at least one. Each option needs at least one fee, and every option must offer the same sides (written by you, written by the buyer or Growwer), as the page requires. Each fee is at least 1 EUR, sent in cents. - `postOffer.maximumLinks` is how many links a sponsored post may hold, 1 to 4; `postOffer.advertisingLabellingPolicy` whether posts are labelled as advertising, `never` when left out; `postOffer.promotedSocialNetworks` the social networks posts are promoted on, none when left out. - `linkAdditionOffer.pricingOptions` lists the link types you offer for adding a link to an existing article; left out, `null` or an empty list offers none. - `extraServices` lists the extra services you offer, none when left out. It is sent at the top level, although GET /seller/medias/{id} reads it inside `postOffer`. - `acceptMediaPublishingTerms` and `declareMediaOwnership` must be `true`: they accept the media publishing terms and declare that you own or manage the media, as the page's checkboxes do, and are recorded as your consents for the media. A media registered already, by you or by anyone else, is refused with 409 `media_already_registered`, and each such refusal counts toward a daily limit of refusals (429 `media_duplicate_limit_reached` once reached); medias not registered yet are never limited by it. To register many medias, call this operation once per media, each call with its own `Idempotency-Key` and its own answer (201, 409, 422 or 429); there is no batch operation. The request limits apply to the loop as to any calls (600 requests per minute per user and 300 per key), and each 409 `media_already_registered` counts toward the daily limit of refusals as it does for a single call. Retry a call that got no answer with its same `Idempotency-Key`, as for any write.
98
+ # @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
99
+ # @param create_seller_media_request [CreateSellerMediaRequest]
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [SellerMedia]
102
+ def create_seller_media(idempotency_key, create_seller_media_request, opts = {})
103
+ data, _status_code, _headers = create_seller_media_with_http_info(idempotency_key, create_seller_media_request, opts)
104
+ data
105
+ end
106
+
107
+ # Register a media you sell on
108
+ # Registers one of your medias, as the media create page does. The media is created with `state: pending_review` and Growwer reviews it in the background, as for a media registered on the web; GET /seller/medias/{id} shows its state. - `rootUrl` is the media's root URL; `typology` is `blog` or `press`. - `country` and `language` take the codes GET /vocabulary publishes; `topics` and `bannedTopics` take its topic ids, at most 100 each, and no topic may be both; `bannedTopics` left out bans none. - `postOffer.pricingOptions` lists every link type you offer for sponsored posts, at least one. Each option needs at least one fee, and every option must offer the same sides (written by you, written by the buyer or Growwer), as the page requires. Each fee is at least 1 EUR, sent in cents. - `postOffer.maximumLinks` is how many links a sponsored post may hold, 1 to 4; `postOffer.advertisingLabellingPolicy` whether posts are labelled as advertising, `never` when left out; `postOffer.promotedSocialNetworks` the social networks posts are promoted on, none when left out. - `linkAdditionOffer.pricingOptions` lists the link types you offer for adding a link to an existing article; left out, `null` or an empty list offers none. - `extraServices` lists the extra services you offer, none when left out. It is sent at the top level, although GET /seller/medias/{id} reads it inside `postOffer`. - `acceptMediaPublishingTerms` and `declareMediaOwnership` must be `true`: they accept the media publishing terms and declare that you own or manage the media, as the page's checkboxes do, and are recorded as your consents for the media. A media registered already, by you or by anyone else, is refused with 409 `media_already_registered`, and each such refusal counts toward a daily limit of refusals (429 `media_duplicate_limit_reached` once reached); medias not registered yet are never limited by it. To register many medias, call this operation once per media, each call with its own `Idempotency-Key` and its own answer (201, 409, 422 or 429); there is no batch operation. The request limits apply to the loop as to any calls (600 requests per minute per user and 300 per key), and each 409 `media_already_registered` counts toward the daily limit of refusals as it does for a single call. Retry a call that got no answer with its same `Idempotency-Key`, as for any write.
109
+ # @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
110
+ # @param create_seller_media_request [CreateSellerMediaRequest]
111
+ # @param [Hash] opts the optional parameters
112
+ # @return [Array<(SellerMedia, Integer, Hash)>] SellerMedia data, response status code and response headers
113
+ def create_seller_media_with_http_info(idempotency_key, create_seller_media_request, opts = {})
114
+ if @api_client.config.debugging
115
+ @api_client.config.logger.debug 'Calling API: SellerMediasApi.create_seller_media ...'
116
+ end
117
+ # verify the required parameter 'idempotency_key' is set
118
+ if @api_client.config.client_side_validation && idempotency_key.nil?
119
+ fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling SellerMediasApi.create_seller_media"
120
+ end
121
+ if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
122
+ fail ArgumentError, 'invalid value for "idempotency_key" when calling SellerMediasApi.create_seller_media, the character length must be smaller than or equal to 255.'
123
+ end
124
+
125
+ # verify the required parameter 'create_seller_media_request' is set
126
+ if @api_client.config.client_side_validation && create_seller_media_request.nil?
127
+ fail ArgumentError, "Missing the required parameter 'create_seller_media_request' when calling SellerMediasApi.create_seller_media"
128
+ end
129
+ # resource path
130
+ local_var_path = '/api/v1/seller/medias'
131
+
132
+ # query parameters
133
+ query_params = opts[:query_params] || {}
134
+
135
+ # header parameters
136
+ header_params = opts[:header_params] || {}
137
+ # HTTP header 'Accept' (if needed)
138
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
139
+ # HTTP header 'Content-Type'
140
+ content_type = @api_client.select_header_content_type(['application/json'])
141
+ if !content_type.nil?
142
+ header_params['Content-Type'] = content_type
143
+ end
144
+ header_params[:'Idempotency-Key'] = idempotency_key
145
+
146
+ # form parameters
147
+ form_params = opts[:form_params] || {}
148
+
149
+ # http body (model)
150
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_seller_media_request)
151
+
152
+ # return_type
153
+ return_type = opts[:debug_return_type] || 'SellerMedia'
154
+
155
+ # auth_names
156
+ auth_names = opts[:debug_auth_names] || ['apiKey']
157
+
158
+ new_options = opts.merge(
159
+ :operation => :"SellerMediasApi.create_seller_media",
160
+ :header_params => header_params,
161
+ :query_params => query_params,
162
+ :form_params => form_params,
163
+ :body => post_body,
164
+ :auth_names => auth_names,
165
+ :return_type => return_type
166
+ )
167
+
168
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
169
+ if @api_client.config.debugging
170
+ @api_client.config.logger.debug "API called: SellerMediasApi#create_seller_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
171
+ end
172
+ return data, status_code, headers
173
+ end
174
+
175
+ # Delete a media you sell on
176
+ # Deletes one of your medias, in any state, as the media delete button does. The media must have no order in progress: close or reject its orders first. The API never cancels an order for you, and an order placed while the delete runs is refused, never cancelled. What goes with the media, as on the web: - A running flash offer ends with it, and its managed-service proposals are deleted. - Its finished orders stay, with the media's URL; they read `media.id` null. - Buyers' favourites and discards of the domain stay, as they are kept by domain. - The catalogue search drops the media shortly after the 204, as the search index updates asynchronously. Repeating the call with the same `Idempotency-Key` answers the same 204 with `Idempotent-Replayed: true`; a new key after the delete answers 404.
177
+ # @param id [String]
178
+ # @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (&#x60;!&#x60; to &#x60;~&#x60;); any other value answers 400 &#x60;invalid_idempotency_key&#x60;.
179
+ # @param [Hash] opts the optional parameters
180
+ # @return [nil]
181
+ def delete_seller_media(id, idempotency_key, opts = {})
182
+ delete_seller_media_with_http_info(id, idempotency_key, opts)
183
+ nil
184
+ end
185
+
186
+ # Delete a media you sell on
187
+ # Deletes one of your medias, in any state, as the media delete button does. The media must have no order in progress: close or reject its orders first. The API never cancels an order for you, and an order placed while the delete runs is refused, never cancelled. What goes with the media, as on the web: - A running flash offer ends with it, and its managed-service proposals are deleted. - Its finished orders stay, with the media&#39;s URL; they read &#x60;media.id&#x60; null. - Buyers&#39; favourites and discards of the domain stay, as they are kept by domain. - The catalogue search drops the media shortly after the 204, as the search index updates asynchronously. Repeating the call with the same &#x60;Idempotency-Key&#x60; answers the same 204 with &#x60;Idempotent-Replayed: true&#x60;; a new key after the delete answers 404.
188
+ # @param id [String]
189
+ # @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (&#x60;!&#x60; to &#x60;~&#x60;); any other value answers 400 &#x60;invalid_idempotency_key&#x60;.
190
+ # @param [Hash] opts the optional parameters
191
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
192
+ def delete_seller_media_with_http_info(id, idempotency_key, opts = {})
193
+ if @api_client.config.debugging
194
+ @api_client.config.logger.debug 'Calling API: SellerMediasApi.delete_seller_media ...'
195
+ end
196
+ # verify the required parameter 'id' is set
197
+ if @api_client.config.client_side_validation && id.nil?
198
+ fail ArgumentError, "Missing the required parameter 'id' when calling SellerMediasApi.delete_seller_media"
199
+ end
200
+ # verify the required parameter 'idempotency_key' is set
201
+ if @api_client.config.client_side_validation && idempotency_key.nil?
202
+ fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling SellerMediasApi.delete_seller_media"
203
+ end
204
+ if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
205
+ fail ArgumentError, 'invalid value for "idempotency_key" when calling SellerMediasApi.delete_seller_media, the character length must be smaller than or equal to 255.'
206
+ end
207
+
208
+ # resource path
209
+ local_var_path = '/api/v1/seller/medias/{id}'.sub('{id}', CGI.escape(id.to_s))
210
+
211
+ # query parameters
212
+ query_params = opts[:query_params] || {}
213
+
214
+ # header parameters
215
+ header_params = opts[:header_params] || {}
216
+ # HTTP header 'Accept' (if needed)
217
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
218
+ header_params[:'Idempotency-Key'] = idempotency_key
219
+
220
+ # form parameters
221
+ form_params = opts[:form_params] || {}
222
+
223
+ # http body (model)
224
+ post_body = opts[:debug_body]
225
+
226
+ # return_type
227
+ return_type = opts[:debug_return_type]
228
+
229
+ # auth_names
230
+ auth_names = opts[:debug_auth_names] || ['apiKey']
231
+
232
+ new_options = opts.merge(
233
+ :operation => :"SellerMediasApi.delete_seller_media",
234
+ :header_params => header_params,
235
+ :query_params => query_params,
236
+ :form_params => form_params,
237
+ :body => post_body,
238
+ :auth_names => auth_names,
239
+ :return_type => return_type
240
+ )
241
+
242
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
243
+ if @api_client.config.debugging
244
+ @api_client.config.logger.debug "API called: SellerMediasApi#delete_seller_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
245
+ end
246
+ return data, status_code, headers
247
+ end
248
+
96
249
  # Get a media you sell on
97
250
  # One of your medias, with your fees, its extras, the competitive fees Growwer suggests and how it performs. Another seller's media is not found.
98
251
  # @param id [String]
@@ -241,8 +394,8 @@ module Growwer
241
394
  return data, status_code, headers
242
395
  end
243
396
 
244
- # Edit the fees of a media you sell on
245
- # Sets the fees of one of your medias, as the media edit page saves them. Send only the sections you change: a section you send replaces that section wholly, a section you leave out stays as it is. - `postOffer.pricingOptions` lists every link type you offer for sponsored posts, at least one. A link type you leave out is no longer offered. Each option needs at least one fee, and every option must offer the same sides (written by you, written by the buyer or Growwer), as the page requires. Each fee is at least 1 EUR. - `linkAdditionOffer.pricingOptions` lists the link types you offer for adding a link to an existing article; `null` or an empty list stops offering link additions. - `extraServices` is the full list of extra services you offer; an empty list removes them all. The fees are your base fees, the ones GET /seller/medias/{id} returns: while a flash offer runs, its discount keeps applying on top of them, and `currentCost` shows the result. `currentCost` may be sent back as read and is ignored. Characteristics, topics and comments are not edited here. As on the page, a change of the post offer's price may cancel the managed-service proposals accepted for the media whose price it changes, and raising the price above the best competitor's tells Growwer's support team. A restricted seller account may edit its fees.
397
+ # Edit the offer of a media you sell on
398
+ # Sets the fees, extra services, typology and post offer characteristics of one of your medias, as the media edit page saves them. Send only the fields you change: a field you send replaces that field wholly, a field you leave out stays as it is, inside `postOffer` too (sending only `postOffer.maximumLinks` keeps your fees). - `typology` is `blog` or `press`. - `postOffer.pricingOptions` lists every link type you offer for sponsored posts, at least one. A link type you leave out is no longer offered. Each option needs at least one fee, and every option must offer the same sides (written by you, written by the buyer or Growwer), as the page requires. Each fee is at least 1 EUR. - `postOffer.maximumLinks` is how many links a sponsored post may hold, 1 to 4; `postOffer.advertisingLabellingPolicy` whether posts are labelled as advertising (`always` or `never`); `postOffer.promotedSocialNetworks` the full list of social networks posts are promoted on, each once (an empty list for none). - `linkAdditionOffer.pricingOptions` lists the link types you offer for adding a link to an existing article; `null` or an empty list stops offering link additions. - `extraServices` is the full list of extra services you offer; an empty list removes them all. It is sent at the top level, although GET /seller/medias/{id} reads it inside `postOffer`. The fees are your base fees, the ones GET /seller/medias/{id} returns: while a flash offer runs, its discount keeps applying on top of them, and `currentCost` shows the result. `currentCost` may be sent back as read and is ignored. Country, language, topics and comments are not edited here. As on the page, a change of the post offer's price may cancel the managed-service proposals accepted for the media whose price it changes, and raising the price above the best competitor's tells Growwer's support team. A restricted seller account may edit its offer.
246
399
  # @param id [String]
247
400
  # @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (&#x60;!&#x60; to &#x60;~&#x60;); any other value answers 400 &#x60;invalid_idempotency_key&#x60;.
248
401
  # @param update_seller_media_request [UpdateSellerMediaRequest]
@@ -253,8 +406,8 @@ module Growwer
253
406
  data
254
407
  end
255
408
 
256
- # Edit the fees of a media you sell on
257
- # Sets the fees of one of your medias, as the media edit page saves them. Send only the sections you change: a section you send replaces that section wholly, a section you leave out stays as it is. - &#x60;postOffer.pricingOptions&#x60; lists every link type you offer for sponsored posts, at least one. A link type you leave out is no longer offered. Each option needs at least one fee, and every option must offer the same sides (written by you, written by the buyer or Growwer), as the page requires. Each fee is at least 1 EUR. - &#x60;linkAdditionOffer.pricingOptions&#x60; lists the link types you offer for adding a link to an existing article; &#x60;null&#x60; or an empty list stops offering link additions. - &#x60;extraServices&#x60; is the full list of extra services you offer; an empty list removes them all. The fees are your base fees, the ones GET /seller/medias/{id} returns: while a flash offer runs, its discount keeps applying on top of them, and &#x60;currentCost&#x60; shows the result. &#x60;currentCost&#x60; may be sent back as read and is ignored. Characteristics, topics and comments are not edited here. As on the page, a change of the post offer&#39;s price may cancel the managed-service proposals accepted for the media whose price it changes, and raising the price above the best competitor&#39;s tells Growwer&#39;s support team. A restricted seller account may edit its fees.
409
+ # Edit the offer of a media you sell on
410
+ # Sets the fees, extra services, typology and post offer characteristics of one of your medias, as the media edit page saves them. Send only the fields you change: a field you send replaces that field wholly, a field you leave out stays as it is, inside &#x60;postOffer&#x60; too (sending only &#x60;postOffer.maximumLinks&#x60; keeps your fees). - &#x60;typology&#x60; is &#x60;blog&#x60; or &#x60;press&#x60;. - &#x60;postOffer.pricingOptions&#x60; lists every link type you offer for sponsored posts, at least one. A link type you leave out is no longer offered. Each option needs at least one fee, and every option must offer the same sides (written by you, written by the buyer or Growwer), as the page requires. Each fee is at least 1 EUR. - &#x60;postOffer.maximumLinks&#x60; is how many links a sponsored post may hold, 1 to 4; &#x60;postOffer.advertisingLabellingPolicy&#x60; whether posts are labelled as advertising (&#x60;always&#x60; or &#x60;never&#x60;); &#x60;postOffer.promotedSocialNetworks&#x60; the full list of social networks posts are promoted on, each once (an empty list for none). - &#x60;linkAdditionOffer.pricingOptions&#x60; lists the link types you offer for adding a link to an existing article; &#x60;null&#x60; or an empty list stops offering link additions. - &#x60;extraServices&#x60; is the full list of extra services you offer; an empty list removes them all. It is sent at the top level, although GET /seller/medias/{id} reads it inside &#x60;postOffer&#x60;. The fees are your base fees, the ones GET /seller/medias/{id} returns: while a flash offer runs, its discount keeps applying on top of them, and &#x60;currentCost&#x60; shows the result. &#x60;currentCost&#x60; may be sent back as read and is ignored. Country, language, topics and comments are not edited here. As on the page, a change of the post offer&#39;s price may cancel the managed-service proposals accepted for the media whose price it changes, and raising the price above the best competitor&#39;s tells Growwer&#39;s support team. A restricted seller account may edit its offer.
258
411
  # @param id [String]
259
412
  # @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (&#x60;!&#x60; to &#x60;~&#x60;); any other value answers 400 &#x60;invalid_idempotency_key&#x60;.
260
413
  # @param update_seller_media_request [UpdateSellerMediaRequest]
@@ -34,7 +34,7 @@ module Growwer
34
34
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
35
35
  def initialize(config = Configuration.default)
36
36
  @config = config
37
- @user_agent = "growwer-ruby/1.0.2"
37
+ @user_agent = "growwer-ruby/1.1.0"
38
38
  @default_headers = {
39
39
  'Content-Type' => 'application/json',
40
40
  'User-Agent' => @user_agent
@@ -0,0 +1,447 @@
1
+ =begin
2
+ #Growwer API
3
+
4
+ #The Growwer customer API. Authenticate every call with an API key created on your profile page, sent as `Authorization: Bearer <key>`. A read key can call every GET operation; writes need a read and write key and an `Idempotency-Key` header. Idempotency: use a new `Idempotency-Key` (1 to 255 printable ASCII characters without spaces) for each operation and reuse it only to retry that same operation. Keys belong to your account, not to one API key. - A successful write is stored for 30 days: a retry with the same key and the same request replays its response with `Idempotent-Replayed: true` and does nothing again. - A refused write (4xx) has no effect and releases its key: once you fix the cause, retry with the same key and the write runs. - A failed write (5xx) may have taken effect, so it is never run again under its key: a retry gets 409 `idempotency_outcome_unknown`. Check whether it took effect before retrying with a new key. - A retry while the first request is still running gets 409 `idempotency_request_in_progress`. A request still running after 5 minutes is treated as failed: a retry gets 409 `idempotency_outcome_unknown`. - The same key with a different request (method, path, query or body) gets 409 `idempotency_key_reused`. A write without the header gets 400 `idempotency_key_required`. Every response carries `X-Request-Id`. Errors share one shape, `{code, message, requestId, details?}`. Money is integer cents plus a currency code and dates are ISO-8601.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@growwer.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Growwer
17
+ class CreateSellerMediaRequest < ApiModelBase
18
+ attr_accessor :root_url
19
+
20
+ attr_accessor :typology
21
+
22
+ # A country code from GET /vocabulary.
23
+ attr_accessor :country
24
+
25
+ # A language code from GET /vocabulary.
26
+ attr_accessor :language
27
+
28
+ # Topic ids from GET /vocabulary.
29
+ attr_accessor :topics
30
+
31
+ # The topic ids from GET /vocabulary the media refuses.
32
+ attr_accessor :banned_topics
33
+
34
+ attr_accessor :post_offer
35
+
36
+ attr_accessor :link_addition_offer
37
+
38
+ attr_accessor :extra_services
39
+
40
+ # Must be true: you accept the media publishing terms.
41
+ attr_accessor :accept_media_publishing_terms
42
+
43
+ # Must be true: you own or manage this media.
44
+ attr_accessor :declare_media_ownership
45
+
46
+ class EnumAttributeValidator
47
+ attr_reader :datatype
48
+ attr_reader :allowable_values
49
+
50
+ def initialize(datatype, allowable_values)
51
+ @allowable_values = allowable_values.map do |value|
52
+ case datatype.to_s
53
+ when /Integer/i
54
+ value.to_i
55
+ when /Float/i
56
+ value.to_f
57
+ else
58
+ value
59
+ end
60
+ end
61
+ end
62
+
63
+ def valid?(value)
64
+ !value || allowable_values.include?(value)
65
+ end
66
+ end
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+ :'root_url' => :'rootUrl',
72
+ :'typology' => :'typology',
73
+ :'country' => :'country',
74
+ :'language' => :'language',
75
+ :'topics' => :'topics',
76
+ :'banned_topics' => :'bannedTopics',
77
+ :'post_offer' => :'postOffer',
78
+ :'link_addition_offer' => :'linkAdditionOffer',
79
+ :'extra_services' => :'extraServices',
80
+ :'accept_media_publishing_terms' => :'acceptMediaPublishingTerms',
81
+ :'declare_media_ownership' => :'declareMediaOwnership'
82
+ }
83
+ end
84
+
85
+ # Returns attribute mapping this model knows about
86
+ def self.acceptable_attribute_map
87
+ attribute_map
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ acceptable_attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'root_url' => :'String',
99
+ :'typology' => :'String',
100
+ :'country' => :'String',
101
+ :'language' => :'String',
102
+ :'topics' => :'Array<Integer>',
103
+ :'banned_topics' => :'Array<Integer>',
104
+ :'post_offer' => :'CreateSellerMediaRequestPostOffer',
105
+ :'link_addition_offer' => :'UpdateSellerMediaRequestLinkAdditionOffer',
106
+ :'extra_services' => :'Array<UpdateSellerMediaRequestExtraServicesInner>',
107
+ :'accept_media_publishing_terms' => :'Boolean',
108
+ :'declare_media_ownership' => :'Boolean'
109
+ }
110
+ end
111
+
112
+ # List of attributes with nullable: true
113
+ def self.openapi_nullable
114
+ Set.new([
115
+ :'link_addition_offer',
116
+ ])
117
+ end
118
+
119
+ # Initializes the object
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ def initialize(attributes = {})
122
+ if (!attributes.is_a?(Hash))
123
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Growwer::CreateSellerMediaRequest` initialize method"
124
+ end
125
+
126
+ # check to see if the attribute exists and convert string to symbol for hash key
127
+ acceptable_attribute_map = self.class.acceptable_attribute_map
128
+ attributes = attributes.each_with_object({}) { |(k, v), h|
129
+ if (!acceptable_attribute_map.key?(k.to_sym))
130
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Growwer::CreateSellerMediaRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
131
+ end
132
+ h[k.to_sym] = v
133
+ }
134
+
135
+ if attributes.key?(:'root_url')
136
+ self.root_url = attributes[:'root_url']
137
+ else
138
+ self.root_url = nil
139
+ end
140
+
141
+ if attributes.key?(:'typology')
142
+ self.typology = attributes[:'typology']
143
+ else
144
+ self.typology = nil
145
+ end
146
+
147
+ if attributes.key?(:'country')
148
+ self.country = attributes[:'country']
149
+ else
150
+ self.country = nil
151
+ end
152
+
153
+ if attributes.key?(:'language')
154
+ self.language = attributes[:'language']
155
+ else
156
+ self.language = nil
157
+ end
158
+
159
+ if attributes.key?(:'topics')
160
+ if (value = attributes[:'topics']).is_a?(Array)
161
+ self.topics = value
162
+ end
163
+ else
164
+ self.topics = nil
165
+ end
166
+
167
+ if attributes.key?(:'banned_topics')
168
+ if (value = attributes[:'banned_topics']).is_a?(Array)
169
+ self.banned_topics = value
170
+ end
171
+ end
172
+
173
+ if attributes.key?(:'post_offer')
174
+ self.post_offer = attributes[:'post_offer']
175
+ else
176
+ self.post_offer = nil
177
+ end
178
+
179
+ if attributes.key?(:'link_addition_offer')
180
+ self.link_addition_offer = attributes[:'link_addition_offer']
181
+ end
182
+
183
+ if attributes.key?(:'extra_services')
184
+ if (value = attributes[:'extra_services']).is_a?(Array)
185
+ self.extra_services = value
186
+ end
187
+ end
188
+
189
+ if attributes.key?(:'accept_media_publishing_terms')
190
+ self.accept_media_publishing_terms = attributes[:'accept_media_publishing_terms']
191
+ else
192
+ self.accept_media_publishing_terms = nil
193
+ end
194
+
195
+ if attributes.key?(:'declare_media_ownership')
196
+ self.declare_media_ownership = attributes[:'declare_media_ownership']
197
+ else
198
+ self.declare_media_ownership = nil
199
+ end
200
+ end
201
+
202
+ # Show invalid properties with the reasons. Usually used together with valid?
203
+ # @return Array for valid properties with the reasons
204
+ def list_invalid_properties
205
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
206
+ invalid_properties = Array.new
207
+ if @root_url.nil?
208
+ invalid_properties.push('invalid value for "root_url", root_url cannot be nil.')
209
+ end
210
+
211
+ if @typology.nil?
212
+ invalid_properties.push('invalid value for "typology", typology cannot be nil.')
213
+ end
214
+
215
+ if @country.nil?
216
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
217
+ end
218
+
219
+ if @language.nil?
220
+ invalid_properties.push('invalid value for "language", language cannot be nil.')
221
+ end
222
+
223
+ if @topics.nil?
224
+ invalid_properties.push('invalid value for "topics", topics cannot be nil.')
225
+ end
226
+
227
+ if @topics.length > 100
228
+ invalid_properties.push('invalid value for "topics", number of items must be less than or equal to 100.')
229
+ end
230
+
231
+ if @topics.length < 1
232
+ invalid_properties.push('invalid value for "topics", number of items must be greater than or equal to 1.')
233
+ end
234
+
235
+ if !@banned_topics.nil? && @banned_topics.length > 100
236
+ invalid_properties.push('invalid value for "banned_topics", number of items must be less than or equal to 100.')
237
+ end
238
+
239
+ if @post_offer.nil?
240
+ invalid_properties.push('invalid value for "post_offer", post_offer cannot be nil.')
241
+ end
242
+
243
+ if @accept_media_publishing_terms.nil?
244
+ invalid_properties.push('invalid value for "accept_media_publishing_terms", accept_media_publishing_terms cannot be nil.')
245
+ end
246
+
247
+ if @declare_media_ownership.nil?
248
+ invalid_properties.push('invalid value for "declare_media_ownership", declare_media_ownership cannot be nil.')
249
+ end
250
+
251
+ invalid_properties
252
+ end
253
+
254
+ # Check to see if the all the properties in the model are valid
255
+ # @return true if the model is valid
256
+ def valid?
257
+ warn '[DEPRECATED] the `valid?` method is obsolete'
258
+ return false if @root_url.nil?
259
+ return false if @typology.nil?
260
+ typology_validator = EnumAttributeValidator.new('String', ["blog", "press"])
261
+ return false unless typology_validator.valid?(@typology)
262
+ return false if @country.nil?
263
+ return false if @language.nil?
264
+ return false if @topics.nil?
265
+ return false if @topics.length > 100
266
+ return false if @topics.length < 1
267
+ return false if !@banned_topics.nil? && @banned_topics.length > 100
268
+ return false if @post_offer.nil?
269
+ return false if @accept_media_publishing_terms.nil?
270
+ return false if @declare_media_ownership.nil?
271
+ true
272
+ end
273
+
274
+ # Custom attribute writer method with validation
275
+ # @param [Object] root_url Value to be assigned
276
+ def root_url=(root_url)
277
+ if root_url.nil?
278
+ fail ArgumentError, 'root_url cannot be nil'
279
+ end
280
+
281
+ @root_url = root_url
282
+ end
283
+
284
+ # Custom attribute writer method checking allowed values (enum).
285
+ # @param [Object] typology Object to be assigned
286
+ def typology=(typology)
287
+ validator = EnumAttributeValidator.new('String', ["blog", "press"])
288
+ unless validator.valid?(typology)
289
+ fail ArgumentError, "invalid value for \"typology\", must be one of #{validator.allowable_values}."
290
+ end
291
+ @typology = typology
292
+ end
293
+
294
+ # Custom attribute writer method with validation
295
+ # @param [Object] country Value to be assigned
296
+ def country=(country)
297
+ if country.nil?
298
+ fail ArgumentError, 'country cannot be nil'
299
+ end
300
+
301
+ @country = country
302
+ end
303
+
304
+ # Custom attribute writer method with validation
305
+ # @param [Object] language Value to be assigned
306
+ def language=(language)
307
+ if language.nil?
308
+ fail ArgumentError, 'language cannot be nil'
309
+ end
310
+
311
+ @language = language
312
+ end
313
+
314
+ # Custom attribute writer method with validation
315
+ # @param [Object] topics Value to be assigned
316
+ def topics=(topics)
317
+ if topics.nil?
318
+ fail ArgumentError, 'topics cannot be nil'
319
+ end
320
+
321
+ if topics.length > 100
322
+ fail ArgumentError, 'invalid value for "topics", number of items must be less than or equal to 100.'
323
+ end
324
+
325
+ if topics.length < 1
326
+ fail ArgumentError, 'invalid value for "topics", number of items must be greater than or equal to 1.'
327
+ end
328
+
329
+ @topics = topics
330
+ end
331
+
332
+ # Custom attribute writer method with validation
333
+ # @param [Object] banned_topics Value to be assigned
334
+ def banned_topics=(banned_topics)
335
+ if banned_topics.nil?
336
+ fail ArgumentError, 'banned_topics cannot be nil'
337
+ end
338
+
339
+ if banned_topics.length > 100
340
+ fail ArgumentError, 'invalid value for "banned_topics", number of items must be less than or equal to 100.'
341
+ end
342
+
343
+ @banned_topics = banned_topics
344
+ end
345
+
346
+ # Custom attribute writer method with validation
347
+ # @param [Object] post_offer Value to be assigned
348
+ def post_offer=(post_offer)
349
+ if post_offer.nil?
350
+ fail ArgumentError, 'post_offer cannot be nil'
351
+ end
352
+
353
+ @post_offer = post_offer
354
+ end
355
+
356
+ # Custom attribute writer method with validation
357
+ # @param [Object] accept_media_publishing_terms Value to be assigned
358
+ def accept_media_publishing_terms=(accept_media_publishing_terms)
359
+ if accept_media_publishing_terms.nil?
360
+ fail ArgumentError, 'accept_media_publishing_terms cannot be nil'
361
+ end
362
+
363
+ @accept_media_publishing_terms = accept_media_publishing_terms
364
+ end
365
+
366
+ # Custom attribute writer method with validation
367
+ # @param [Object] declare_media_ownership Value to be assigned
368
+ def declare_media_ownership=(declare_media_ownership)
369
+ if declare_media_ownership.nil?
370
+ fail ArgumentError, 'declare_media_ownership cannot be nil'
371
+ end
372
+
373
+ @declare_media_ownership = declare_media_ownership
374
+ end
375
+
376
+ # Checks equality by comparing each attribute.
377
+ # @param [Object] Object to be compared
378
+ def ==(o)
379
+ return true if self.equal?(o)
380
+ self.class == o.class &&
381
+ root_url == o.root_url &&
382
+ typology == o.typology &&
383
+ country == o.country &&
384
+ language == o.language &&
385
+ topics == o.topics &&
386
+ banned_topics == o.banned_topics &&
387
+ post_offer == o.post_offer &&
388
+ link_addition_offer == o.link_addition_offer &&
389
+ extra_services == o.extra_services &&
390
+ accept_media_publishing_terms == o.accept_media_publishing_terms &&
391
+ declare_media_ownership == o.declare_media_ownership
392
+ end
393
+
394
+ # @see the `==` method
395
+ # @param [Object] Object to be compared
396
+ def eql?(o)
397
+ self == o
398
+ end
399
+
400
+ # Calculates hash code according to all attributes.
401
+ # @return [Integer] Hash code
402
+ def hash
403
+ [root_url, typology, country, language, topics, banned_topics, post_offer, link_addition_offer, extra_services, accept_media_publishing_terms, declare_media_ownership].hash
404
+ end
405
+
406
+ # Builds the object from hash
407
+ # @param [Hash] attributes Model attributes in the form of hash
408
+ # @return [Object] Returns the model itself
409
+ def self.build_from_hash(attributes)
410
+ return nil unless attributes.is_a?(Hash)
411
+ attributes = attributes.transform_keys(&:to_sym)
412
+ transformed_hash = {}
413
+ openapi_types.each_pair do |key, type|
414
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
415
+ transformed_hash["#{key}"] = nil
416
+ elsif type =~ /\AArray<(.*)>/i
417
+ # check to ensure the input is an array given that the attribute
418
+ # is documented as an array but the input is not
419
+ if attributes[attribute_map[key]].is_a?(Array)
420
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
421
+ end
422
+ elsif !attributes[attribute_map[key]].nil?
423
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
424
+ end
425
+ end
426
+ new(transformed_hash)
427
+ end
428
+
429
+ # Returns the object in the form of hash
430
+ # @return [Hash] Returns the object in the form of hash
431
+ def to_hash
432
+ hash = {}
433
+ self.class.attribute_map.each_pair do |attr, param|
434
+ value = self.send(attr)
435
+ if value.nil?
436
+ is_nullable = self.class.openapi_nullable.include?(attr)
437
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
438
+ end
439
+
440
+ hash[param] = _to_hash(value)
441
+ end
442
+ hash
443
+ end
444
+
445
+ end
446
+
447
+ end