growwer 2.0.0 → 2.2.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 (209) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +61 -6
  3. data/docs/AccountApi.md +1 -1
  4. data/docs/AdvanceTestOrderRequest.md +18 -0
  5. data/docs/BalanceLowEventData.md +20 -0
  6. data/docs/BalanceLowEventDataWallet.md +20 -0
  7. data/docs/CatalogueApi.md +2 -2
  8. data/docs/CreateWebhookRequest.md +24 -0
  9. data/docs/GetMe200Response.md +3 -1
  10. data/docs/ListWebhookDeliveries200Response.md +20 -0
  11. data/docs/ListWebhooks200Response.md +20 -0
  12. data/docs/Money.md +4 -2
  13. data/docs/MoneyOrNull.md +4 -2
  14. data/docs/OrderCreateRequest.md +1 -1
  15. data/docs/OrderEventData.md +18 -0
  16. data/docs/SellerMedia.md +3 -1
  17. data/docs/SellerMediaCompetitiveFeesByLinkTypeInner.md +22 -0
  18. data/docs/SellerMediasApi.md +5 -5
  19. data/docs/TestHelpersApi.md +222 -0
  20. data/docs/TopUpTestWallet200Response.md +20 -0
  21. data/docs/TopUpTestWalletRequest.md +18 -0
  22. data/docs/UpdateWebhookRequest.md +26 -0
  23. data/docs/Webhook.md +38 -0
  24. data/docs/WebhookDelivery.md +32 -0
  25. data/docs/WebhookDeliveryAttempt.md +26 -0
  26. data/docs/WebhookEvent.md +28 -0
  27. data/docs/WebhookEventData.md +51 -0
  28. data/docs/WebhookEventType.md +15 -0
  29. data/docs/WebhookTestEventData.md +18 -0
  30. data/docs/WebhookWithSecret.md +40 -0
  31. data/docs/WebhooksApi.md +662 -0
  32. data/growwer.gemspec +1 -1
  33. data/lib/growwer/api/account_api.rb +3 -3
  34. data/lib/growwer/api/buyer_orders_api.rb +1 -1
  35. data/lib/growwer/api/buyer_wallet_api.rb +1 -1
  36. data/lib/growwer/api/catalogue_api.rb +5 -5
  37. data/lib/growwer/api/files_api.rb +1 -1
  38. data/lib/growwer/api/managed_services_api.rb +1 -1
  39. data/lib/growwer/api/projects_api.rb +1 -1
  40. data/lib/growwer/api/saved_filters_api.rb +1 -1
  41. data/lib/growwer/api/seller_account_api.rb +1 -1
  42. data/lib/growwer/api/seller_medias_api.rb +5 -5
  43. data/lib/growwer/api/seller_orders_api.rb +1 -1
  44. data/lib/growwer/api/seller_wallet_api.rb +1 -1
  45. data/lib/growwer/api/test_helpers_api.rb +254 -0
  46. data/lib/growwer/api/webhooks_api.rb +707 -0
  47. data/lib/growwer/api_client.rb +2 -2
  48. data/lib/growwer/api_error.rb +1 -1
  49. data/lib/growwer/api_model_base.rb +1 -1
  50. data/lib/growwer/configuration.rb +1 -1
  51. data/lib/growwer/models/advance_test_order_request.rb +189 -0
  52. data/lib/growwer/models/balance.rb +1 -1
  53. data/lib/growwer/models/balance_low_event_data.rb +192 -0
  54. data/lib/growwer/models/balance_low_event_data_wallet.rb +192 -0
  55. data/lib/growwer/models/catalogue_media.rb +1 -1
  56. data/lib/growwer/models/catalogue_media_flash_offer.rb +1 -1
  57. data/lib/growwer/models/catalogue_media_metrics.rb +1 -1
  58. data/lib/growwer/models/catalogue_offer.rb +1 -1
  59. data/lib/growwer/models/catalogue_offer_or_null.rb +1 -1
  60. data/lib/growwer/models/catalogue_post_offer.rb +1 -1
  61. data/lib/growwer/models/catalogue_post_offer_all_of_extras.rb +1 -1
  62. data/lib/growwer/models/catalogue_post_offer_all_of_extras_sensitive_topic.rb +1 -1
  63. data/lib/growwer/models/code_name.rb +1 -1
  64. data/lib/growwer/models/count_saved_filter_medias200_response.rb +1 -1
  65. data/lib/growwer/models/create_project_request.rb +1 -1
  66. data/lib/growwer/models/create_saved_filter_request.rb +1 -1
  67. data/lib/growwer/models/create_seller_media_request.rb +1 -1
  68. data/lib/growwer/models/create_seller_media_request_post_offer.rb +1 -1
  69. data/lib/growwer/models/create_webhook_request.rb +248 -0
  70. data/lib/growwer/models/error.rb +1 -1
  71. data/lib/growwer/models/get_buyer_wallet200_response.rb +1 -1
  72. data/lib/growwer/models/get_me200_response.rb +57 -20
  73. data/lib/growwer/models/get_me200_response_buyer.rb +1 -1
  74. data/lib/growwer/models/get_me200_response_catalogue.rb +1 -1
  75. data/lib/growwer/models/get_me200_response_managed_service.rb +1 -1
  76. data/lib/growwer/models/get_me200_response_seller.rb +2 -1
  77. data/lib/growwer/models/get_seller_wallet200_response.rb +1 -1
  78. data/lib/growwer/models/get_vocabulary200_response.rb +1 -1
  79. data/lib/growwer/models/get_vocabulary200_response_topics_inner.rb +1 -1
  80. data/lib/growwer/models/invoice.rb +1 -1
  81. data/lib/growwer/models/link_addition_order_briefing.rb +1 -1
  82. data/lib/growwer/models/link_addition_order_briefing_request.rb +1 -1
  83. data/lib/growwer/models/list_buyer_transactions200_response.rb +1 -1
  84. data/lib/growwer/models/list_flash_offers200_response.rb +1 -1
  85. data/lib/growwer/models/list_invoices200_response.rb +1 -1
  86. data/lib/growwer/models/list_managed_service_campaigns200_response.rb +1 -1
  87. data/lib/growwer/models/list_managed_service_proposals200_response.rb +1 -1
  88. data/lib/growwer/models/list_orders200_response.rb +1 -1
  89. data/lib/growwer/models/list_projects200_response.rb +1 -1
  90. data/lib/growwer/models/list_saved_filters200_response.rb +1 -1
  91. data/lib/growwer/models/list_seller_medias200_response.rb +1 -1
  92. data/lib/growwer/models/list_seller_orders200_response.rb +1 -1
  93. data/lib/growwer/models/list_seller_transactions200_response.rb +1 -1
  94. data/lib/growwer/models/list_webhook_deliveries200_response.rb +192 -0
  95. data/lib/growwer/models/list_webhooks200_response.rb +192 -0
  96. data/lib/growwer/models/list_withdrawals200_response.rb +1 -1
  97. data/lib/growwer/models/managed_service_campaign.rb +1 -1
  98. data/lib/growwer/models/managed_service_campaign_project.rb +1 -1
  99. data/lib/growwer/models/managed_service_campaign_proposal_counts.rb +1 -1
  100. data/lib/growwer/models/managed_service_campaign_strategy.rb +1 -1
  101. data/lib/growwer/models/managed_service_proposal.rb +1 -1
  102. data/lib/growwer/models/managed_service_proposal_briefing.rb +1 -1
  103. data/lib/growwer/models/managed_service_proposal_briefing_links_inner.rb +1 -1
  104. data/lib/growwer/models/managed_service_proposal_media.rb +1 -1
  105. data/lib/growwer/models/managed_service_proposal_review.rb +1 -1
  106. data/lib/growwer/models/managed_service_proposal_review_request.rb +1 -1
  107. data/lib/growwer/models/managed_service_proposal_review_request_reviews_inner.rb +1 -1
  108. data/lib/growwer/models/managed_service_proposals_estimate.rb +1 -1
  109. data/lib/growwer/models/managed_service_proposals_estimate_request.rb +1 -1
  110. data/lib/growwer/models/managed_service_request.rb +1 -1
  111. data/lib/growwer/models/managed_service_request_sent.rb +1 -1
  112. data/lib/growwer/models/money.rb +16 -6
  113. data/lib/growwer/models/money_or_null.rb +16 -6
  114. data/lib/growwer/models/order.rb +1 -1
  115. data/lib/growwer/models/order_action_reason.rb +1 -1
  116. data/lib/growwer/models/order_briefing.rb +1 -1
  117. data/lib/growwer/models/order_channel.rb +1 -1
  118. data/lib/growwer/models/order_create_request.rb +2 -2
  119. data/lib/growwer/models/order_delivery.rb +1 -1
  120. data/lib/growwer/models/order_draft.rb +1 -1
  121. data/lib/growwer/models/order_estimate.rb +1 -1
  122. data/lib/growwer/models/order_estimate_request.rb +1 -1
  123. data/lib/growwer/models/order_estimate_request_briefing.rb +1 -1
  124. data/lib/growwer/models/order_event_data.rb +165 -0
  125. data/lib/growwer/models/order_link.rb +1 -1
  126. data/lib/growwer/models/order_link_request.rb +1 -1
  127. data/lib/growwer/models/order_media.rb +1 -1
  128. data/lib/growwer/models/order_project.rb +1 -1
  129. data/lib/growwer/models/order_state_history_inner.rb +1 -1
  130. data/lib/growwer/models/order_state_history_inner_reason.rb +1 -1
  131. data/lib/growwer/models/post_order_briefing.rb +1 -1
  132. data/lib/growwer/models/post_order_briefing_request.rb +1 -1
  133. data/lib/growwer/models/project.rb +1 -1
  134. data/lib/growwer/models/project_catalogue_media.rb +1 -1
  135. data/lib/growwer/models/project_catalogue_media_all_of_project.rb +1 -1
  136. data/lib/growwer/models/project_catalogue_media_all_of_project_ai_keywords.rb +1 -1
  137. data/lib/growwer/models/put_seller_holiday200_response.rb +1 -1
  138. data/lib/growwer/models/put_seller_holiday_request.rb +1 -1
  139. data/lib/growwer/models/request_medias201_response.rb +1 -1
  140. data/lib/growwer/models/request_medias_request.rb +1 -1
  141. data/lib/growwer/models/saved_filter.rb +1 -1
  142. data/lib/growwer/models/saved_filter_notifications.rb +1 -1
  143. data/lib/growwer/models/seller_fees.rb +1 -1
  144. data/lib/growwer/models/seller_fees_or_null.rb +1 -1
  145. data/lib/growwer/models/seller_media.rb +18 -3
  146. data/lib/growwer/models/seller_media_competitive_fees_by_link_type_inner.rb +214 -0
  147. data/lib/growwer/models/seller_media_flash_offer.rb +1 -1
  148. data/lib/growwer/models/seller_media_link_addition_offer.rb +1 -1
  149. data/lib/growwer/models/seller_media_link_addition_offer_pricing_options_inner.rb +1 -1
  150. data/lib/growwer/models/seller_media_post_offer.rb +1 -1
  151. data/lib/growwer/models/seller_media_post_offer_pricing_options_inner.rb +1 -1
  152. data/lib/growwer/models/seller_order.rb +1 -1
  153. data/lib/growwer/models/seller_order_briefing.rb +1 -1
  154. data/lib/growwer/models/seller_order_channel.rb +1 -1
  155. data/lib/growwer/models/seller_order_draft.rb +1 -1
  156. data/lib/growwer/models/seller_order_draft_file.rb +1 -1
  157. data/lib/growwer/models/seller_order_post_delivery.rb +1 -1
  158. data/lib/growwer/models/seller_order_project.rb +1 -1
  159. data/lib/growwer/models/seller_order_refutation.rb +1 -1
  160. data/lib/growwer/models/seller_order_rejection.rb +1 -1
  161. data/lib/growwer/models/seller_order_rejection_reason.rb +1 -1
  162. data/lib/growwer/models/seller_post_order_briefing.rb +1 -1
  163. data/lib/growwer/models/seller_transaction.rb +1 -1
  164. data/lib/growwer/models/top_up_test_wallet200_response.rb +191 -0
  165. data/lib/growwer/models/top_up_test_wallet_request.rb +165 -0
  166. data/lib/growwer/models/transaction.rb +1 -1
  167. data/lib/growwer/models/update_project_request.rb +1 -1
  168. data/lib/growwer/models/update_seller_media_request.rb +1 -1
  169. data/lib/growwer/models/update_seller_media_request_extra_services_inner.rb +1 -1
  170. data/lib/growwer/models/update_seller_media_request_link_addition_offer.rb +1 -1
  171. data/lib/growwer/models/update_seller_media_request_link_addition_offer_pricing_options_inner.rb +1 -1
  172. data/lib/growwer/models/update_seller_media_request_post_offer.rb +1 -1
  173. data/lib/growwer/models/update_seller_media_request_post_offer_pricing_options_inner.rb +1 -1
  174. data/lib/growwer/models/update_webhook_request.rb +245 -0
  175. data/lib/growwer/models/upload_file201_response.rb +1 -1
  176. data/lib/growwer/models/webhook.rb +395 -0
  177. data/lib/growwer/models/webhook_delivery.rb +365 -0
  178. data/lib/growwer/models/webhook_delivery_attempt.rb +264 -0
  179. data/lib/growwer/models/webhook_event.rb +324 -0
  180. data/lib/growwer/models/webhook_event_data.rb +104 -0
  181. data/lib/growwer/models/webhook_event_type.rb +46 -0
  182. data/lib/growwer/models/webhook_test_event_data.rb +166 -0
  183. data/lib/growwer/models/webhook_with_secret.rb +413 -0
  184. data/lib/growwer/models/withdrawal.rb +1 -1
  185. data/lib/growwer/version.rb +2 -2
  186. data/lib/growwer.rb +22 -1
  187. data/spec/api/test_helpers_api_spec.rb +74 -0
  188. data/spec/api/webhooks_api_spec.rb +154 -0
  189. data/spec/models/advance_test_order_request_spec.rb +40 -0
  190. data/spec/models/balance_low_event_data_spec.rb +42 -0
  191. data/spec/models/balance_low_event_data_wallet_spec.rb +42 -0
  192. data/spec/models/create_webhook_request_spec.rb +54 -0
  193. data/spec/models/list_webhook_deliveries200_response_spec.rb +42 -0
  194. data/spec/models/list_webhooks200_response_spec.rb +42 -0
  195. data/spec/models/order_event_data_spec.rb +36 -0
  196. data/spec/models/seller_media_competitive_fees_by_link_type_inner_spec.rb +52 -0
  197. data/spec/models/top_up_test_wallet200_response_spec.rb +42 -0
  198. data/spec/models/top_up_test_wallet_request_spec.rb +36 -0
  199. data/spec/models/update_webhook_request_spec.rb +60 -0
  200. data/spec/models/webhook_delivery_attempt_spec.rb +64 -0
  201. data/spec/models/webhook_delivery_spec.rb +86 -0
  202. data/spec/models/webhook_event_data_spec.rb +32 -0
  203. data/spec/models/webhook_event_spec.rb +78 -0
  204. data/spec/models/webhook_event_type_spec.rb +30 -0
  205. data/spec/models/webhook_spec.rb +100 -0
  206. data/spec/models/webhook_test_event_data_spec.rb +36 -0
  207. data/spec/models/webhook_with_secret_spec.rb +106 -0
  208. data/spec/spec_helper.rb +1 -1
  209. metadata +86 -2
@@ -0,0 +1,413 @@
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`. Test mode: a test key (`gw_sk_test_` plus 43 characters) works on your account's test data alone, apart from the real catalogue: test projects, orders and files, and a test wallet that starts at 1,000.00 EUR. Every response to a test key carries `Growwer-Mode: test`, and an id of the other mode answers 404 as a missing object would. - A test order is validated and debited from the test wallet as a live one is. A simulated seller accepts it a minute later and delivers it two minutes after that; you approve the delivery or request an update. - The Test helpers top the test wallet up, move a test order on at once and reset your test data. A live key on them gets 403 `test_mode_only`. - A test key on the seller and managed service operations, on a project's catalogue writes and on media requests gets 403 `not_available_in_test_mode`. - Idempotency keys are scoped per mode: the same `Idempotency-Key` sent with a live and a test key never replays the other mode's response. Webhooks: a subscription receives the events of its mode, signed as Standard Webhooks. A subscription created with a live key gets the events of your orders and your wallet; one created with a test key gets those of your test orders and test wallet, with `mode: test`, and never a live event. `x-webhooks` lists every event Growwer POSTs and its payload; the WebhookEvent schema describes the headers, the signature and the retries. Every response carries `X-Request-Id`. Errors share one shape, `{code, message, requestId, details?}`. Money is integer cents plus a currency code (12500 is 125.00 EUR), answered with `amountDecimal`, the same amount as an exact decimal string (\"125.00\"); 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
+ # A subscription with its signing secret, which only create and rotate-secret answer.
18
+ class WebhookWithSecret < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ attr_accessor :url
22
+
23
+ attr_accessor :events
24
+
25
+ # With `balance.low`, the available buyer balance below which it fires; null otherwise.
26
+ attr_accessor :low_balance_threshold
27
+
28
+ attr_accessor :description
29
+
30
+ # Whether the subscription gets events.
31
+ attr_accessor :enabled
32
+
33
+ # Why it is disabled, null while enabled. `by_user`, through PATCH /webhooks/{id}; `endpoint_gone`, its endpoint answered 410; `failing`, every delivery failed for 5 days, and the account owner was emailed.
34
+ attr_accessor :disabled_reason
35
+
36
+ # Since when its deliveries have failed without one succeeding, null while they succeed. At 5 days it is disabled. The check runs at each failed attempt, so a subscription whose `failingSince` is already more than 5 days old, say one that had no event for a while, is disabled at its next failed attempt, without the retries that delivery would otherwise get.
37
+ attr_accessor :failing_since
38
+
39
+ # Until when the secret replaced by the last rotation still signs beside the new one, null when it no longer does.
40
+ attr_accessor :previous_secret_expires_at
41
+
42
+ attr_accessor :created_at
43
+
44
+ attr_accessor :updated_at
45
+
46
+ # The signing secret, `whsec_` and the base64 of 32 random bytes. Shown only in this answer, and absent when the request is replayed under its `Idempotency-Key` (or the MCP tool under its `requestId`), since the secret is never stored.
47
+ attr_accessor :secret
48
+
49
+ class EnumAttributeValidator
50
+ attr_reader :datatype
51
+ attr_reader :allowable_values
52
+
53
+ def initialize(datatype, allowable_values)
54
+ @allowable_values = allowable_values.map do |value|
55
+ case datatype.to_s
56
+ when /Integer/i
57
+ value.to_i
58
+ when /Float/i
59
+ value.to_f
60
+ else
61
+ value
62
+ end
63
+ end
64
+ end
65
+
66
+ def valid?(value)
67
+ !value || allowable_values.include?(value)
68
+ end
69
+ end
70
+
71
+ # Attribute mapping from ruby-style variable name to JSON key.
72
+ def self.attribute_map
73
+ {
74
+ :'id' => :'id',
75
+ :'url' => :'url',
76
+ :'events' => :'events',
77
+ :'low_balance_threshold' => :'lowBalanceThreshold',
78
+ :'description' => :'description',
79
+ :'enabled' => :'enabled',
80
+ :'disabled_reason' => :'disabledReason',
81
+ :'failing_since' => :'failingSince',
82
+ :'previous_secret_expires_at' => :'previousSecretExpiresAt',
83
+ :'created_at' => :'createdAt',
84
+ :'updated_at' => :'updatedAt',
85
+ :'secret' => :'secret'
86
+ }
87
+ end
88
+
89
+ # Returns attribute mapping this model knows about
90
+ def self.acceptable_attribute_map
91
+ attribute_map
92
+ end
93
+
94
+ # Returns all the JSON keys this model knows about
95
+ def self.acceptable_attributes
96
+ acceptable_attribute_map.values
97
+ end
98
+
99
+ # Attribute type mapping.
100
+ def self.openapi_types
101
+ {
102
+ :'id' => :'String',
103
+ :'url' => :'String',
104
+ :'events' => :'Array<WebhookEventType>',
105
+ :'low_balance_threshold' => :'MoneyOrNull',
106
+ :'description' => :'String',
107
+ :'enabled' => :'Boolean',
108
+ :'disabled_reason' => :'String',
109
+ :'failing_since' => :'Time',
110
+ :'previous_secret_expires_at' => :'Time',
111
+ :'created_at' => :'Time',
112
+ :'updated_at' => :'Time',
113
+ :'secret' => :'String'
114
+ }
115
+ end
116
+
117
+ # List of attributes with nullable: true
118
+ def self.openapi_nullable
119
+ Set.new([
120
+ :'low_balance_threshold',
121
+ :'description',
122
+ :'disabled_reason',
123
+ :'failing_since',
124
+ :'previous_secret_expires_at',
125
+ ])
126
+ end
127
+
128
+ # List of class defined in allOf (OpenAPI v3)
129
+ def self.openapi_all_of
130
+ [
131
+ :'Webhook'
132
+ ]
133
+ end
134
+
135
+ # Initializes the object
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ def initialize(attributes = {})
138
+ if (!attributes.is_a?(Hash))
139
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Growwer::WebhookWithSecret` initialize method"
140
+ end
141
+
142
+ # check to see if the attribute exists and convert string to symbol for hash key
143
+ acceptable_attribute_map = self.class.acceptable_attribute_map
144
+ attributes = attributes.each_with_object({}) { |(k, v), h|
145
+ if (!acceptable_attribute_map.key?(k.to_sym))
146
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Growwer::WebhookWithSecret`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
147
+ end
148
+ h[k.to_sym] = v
149
+ }
150
+
151
+ if attributes.key?(:'id')
152
+ self.id = attributes[:'id']
153
+ else
154
+ self.id = nil
155
+ end
156
+
157
+ if attributes.key?(:'url')
158
+ self.url = attributes[:'url']
159
+ else
160
+ self.url = nil
161
+ end
162
+
163
+ if attributes.key?(:'events')
164
+ if (value = attributes[:'events']).is_a?(Array)
165
+ self.events = value
166
+ end
167
+ else
168
+ self.events = nil
169
+ end
170
+
171
+ if attributes.key?(:'low_balance_threshold')
172
+ self.low_balance_threshold = attributes[:'low_balance_threshold']
173
+ else
174
+ self.low_balance_threshold = nil
175
+ end
176
+
177
+ if attributes.key?(:'description')
178
+ self.description = attributes[:'description']
179
+ else
180
+ self.description = nil
181
+ end
182
+
183
+ if attributes.key?(:'enabled')
184
+ self.enabled = attributes[:'enabled']
185
+ else
186
+ self.enabled = nil
187
+ end
188
+
189
+ if attributes.key?(:'disabled_reason')
190
+ self.disabled_reason = attributes[:'disabled_reason']
191
+ else
192
+ self.disabled_reason = nil
193
+ end
194
+
195
+ if attributes.key?(:'failing_since')
196
+ self.failing_since = attributes[:'failing_since']
197
+ else
198
+ self.failing_since = nil
199
+ end
200
+
201
+ if attributes.key?(:'previous_secret_expires_at')
202
+ self.previous_secret_expires_at = attributes[:'previous_secret_expires_at']
203
+ else
204
+ self.previous_secret_expires_at = nil
205
+ end
206
+
207
+ if attributes.key?(:'created_at')
208
+ self.created_at = attributes[:'created_at']
209
+ else
210
+ self.created_at = nil
211
+ end
212
+
213
+ if attributes.key?(:'updated_at')
214
+ self.updated_at = attributes[:'updated_at']
215
+ else
216
+ self.updated_at = nil
217
+ end
218
+
219
+ if attributes.key?(:'secret')
220
+ self.secret = attributes[:'secret']
221
+ end
222
+ end
223
+
224
+ # Show invalid properties with the reasons. Usually used together with valid?
225
+ # @return Array for valid properties with the reasons
226
+ def list_invalid_properties
227
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
228
+ invalid_properties = Array.new
229
+ if @id.nil?
230
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
231
+ end
232
+
233
+ if @url.nil?
234
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
235
+ end
236
+
237
+ if @events.nil?
238
+ invalid_properties.push('invalid value for "events", events cannot be nil.')
239
+ end
240
+
241
+ if @enabled.nil?
242
+ invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
243
+ end
244
+
245
+ if @created_at.nil?
246
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
247
+ end
248
+
249
+ if @updated_at.nil?
250
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
251
+ end
252
+
253
+ invalid_properties
254
+ end
255
+
256
+ # Check to see if the all the properties in the model are valid
257
+ # @return true if the model is valid
258
+ def valid?
259
+ warn '[DEPRECATED] the `valid?` method is obsolete'
260
+ return false if @id.nil?
261
+ return false if @url.nil?
262
+ return false if @events.nil?
263
+ return false if @enabled.nil?
264
+ disabled_reason_validator = EnumAttributeValidator.new('String', ["by_user", "endpoint_gone", "failing"])
265
+ return false unless disabled_reason_validator.valid?(@disabled_reason)
266
+ return false if @created_at.nil?
267
+ return false if @updated_at.nil?
268
+ true
269
+ end
270
+
271
+ # Custom attribute writer method with validation
272
+ # @param [Object] id Value to be assigned
273
+ def id=(id)
274
+ if id.nil?
275
+ fail ArgumentError, 'id cannot be nil'
276
+ end
277
+
278
+ @id = id
279
+ end
280
+
281
+ # Custom attribute writer method with validation
282
+ # @param [Object] url Value to be assigned
283
+ def url=(url)
284
+ if url.nil?
285
+ fail ArgumentError, 'url cannot be nil'
286
+ end
287
+
288
+ @url = url
289
+ end
290
+
291
+ # Custom attribute writer method with validation
292
+ # @param [Object] events Value to be assigned
293
+ def events=(events)
294
+ if events.nil?
295
+ fail ArgumentError, 'events cannot be nil'
296
+ end
297
+
298
+ @events = events
299
+ end
300
+
301
+ # Custom attribute writer method with validation
302
+ # @param [Object] enabled Value to be assigned
303
+ def enabled=(enabled)
304
+ if enabled.nil?
305
+ fail ArgumentError, 'enabled cannot be nil'
306
+ end
307
+
308
+ @enabled = enabled
309
+ end
310
+
311
+ # Custom attribute writer method checking allowed values (enum).
312
+ # @param [Object] disabled_reason Object to be assigned
313
+ def disabled_reason=(disabled_reason)
314
+ validator = EnumAttributeValidator.new('String', ["by_user", "endpoint_gone", "failing"])
315
+ unless validator.valid?(disabled_reason)
316
+ fail ArgumentError, "invalid value for \"disabled_reason\", must be one of #{validator.allowable_values}."
317
+ end
318
+ @disabled_reason = disabled_reason
319
+ end
320
+
321
+ # Custom attribute writer method with validation
322
+ # @param [Object] created_at Value to be assigned
323
+ def created_at=(created_at)
324
+ if created_at.nil?
325
+ fail ArgumentError, 'created_at cannot be nil'
326
+ end
327
+
328
+ @created_at = created_at
329
+ end
330
+
331
+ # Custom attribute writer method with validation
332
+ # @param [Object] updated_at Value to be assigned
333
+ def updated_at=(updated_at)
334
+ if updated_at.nil?
335
+ fail ArgumentError, 'updated_at cannot be nil'
336
+ end
337
+
338
+ @updated_at = updated_at
339
+ end
340
+
341
+ # Checks equality by comparing each attribute.
342
+ # @param [Object] Object to be compared
343
+ def ==(o)
344
+ return true if self.equal?(o)
345
+ self.class == o.class &&
346
+ id == o.id &&
347
+ url == o.url &&
348
+ events == o.events &&
349
+ low_balance_threshold == o.low_balance_threshold &&
350
+ description == o.description &&
351
+ enabled == o.enabled &&
352
+ disabled_reason == o.disabled_reason &&
353
+ failing_since == o.failing_since &&
354
+ previous_secret_expires_at == o.previous_secret_expires_at &&
355
+ created_at == o.created_at &&
356
+ updated_at == o.updated_at &&
357
+ secret == o.secret
358
+ end
359
+
360
+ # @see the `==` method
361
+ # @param [Object] Object to be compared
362
+ def eql?(o)
363
+ self == o
364
+ end
365
+
366
+ # Calculates hash code according to all attributes.
367
+ # @return [Integer] Hash code
368
+ def hash
369
+ [id, url, events, low_balance_threshold, description, enabled, disabled_reason, failing_since, previous_secret_expires_at, created_at, updated_at, secret].hash
370
+ end
371
+
372
+ # Builds the object from hash
373
+ # @param [Hash] attributes Model attributes in the form of hash
374
+ # @return [Object] Returns the model itself
375
+ def self.build_from_hash(attributes)
376
+ return nil unless attributes.is_a?(Hash)
377
+ attributes = attributes.transform_keys(&:to_sym)
378
+ transformed_hash = {}
379
+ openapi_types.each_pair do |key, type|
380
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
381
+ transformed_hash["#{key}"] = nil
382
+ elsif type =~ /\AArray<(.*)>/i
383
+ # check to ensure the input is an array given that the attribute
384
+ # is documented as an array but the input is not
385
+ if attributes[attribute_map[key]].is_a?(Array)
386
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
387
+ end
388
+ elsif !attributes[attribute_map[key]].nil?
389
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
390
+ end
391
+ end
392
+ new(transformed_hash)
393
+ end
394
+
395
+ # Returns the object in the form of hash
396
+ # @return [Hash] Returns the object in the form of hash
397
+ def to_hash
398
+ hash = {}
399
+ self.class.attribute_map.each_pair do |attr, param|
400
+ value = self.send(attr)
401
+ if value.nil?
402
+ is_nullable = self.class.openapi_nullable.include?(attr)
403
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
404
+ end
405
+
406
+ hash[param] = _to_hash(value)
407
+ end
408
+ hash
409
+ end
410
+
411
+ end
412
+
413
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Growwer API
3
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.
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`. Test mode: a test key (`gw_sk_test_` plus 43 characters) works on your account's test data alone, apart from the real catalogue: test projects, orders and files, and a test wallet that starts at 1,000.00 EUR. Every response to a test key carries `Growwer-Mode: test`, and an id of the other mode answers 404 as a missing object would. - A test order is validated and debited from the test wallet as a live one is. A simulated seller accepts it a minute later and delivers it two minutes after that; you approve the delivery or request an update. - The Test helpers top the test wallet up, move a test order on at once and reset your test data. A live key on them gets 403 `test_mode_only`. - A test key on the seller and managed service operations, on a project's catalogue writes and on media requests gets 403 `not_available_in_test_mode`. - Idempotency keys are scoped per mode: the same `Idempotency-Key` sent with a live and a test key never replays the other mode's response. Webhooks: a subscription receives the events of its mode, signed as Standard Webhooks. A subscription created with a live key gets the events of your orders and your wallet; one created with a test key gets those of your test orders and test wallet, with `mode: test`, and never a live event. `x-webhooks` lists every event Growwer POSTs and its payload; the WebhookEvent schema describes the headers, the signature and the retries. Every response carries `X-Request-Id`. Errors share one shape, `{code, message, requestId, details?}`. Money is integer cents plus a currency code (12500 is 125.00 EUR), answered with `amountDecimal`, the same amount as an exact decimal string (\"125.00\"); dates are ISO-8601.
5
5
 
6
6
  The version of the OpenAPI document: 1
7
7
  Contact: support@growwer.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Growwer API
3
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.
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`. Test mode: a test key (`gw_sk_test_` plus 43 characters) works on your account's test data alone, apart from the real catalogue: test projects, orders and files, and a test wallet that starts at 1,000.00 EUR. Every response to a test key carries `Growwer-Mode: test`, and an id of the other mode answers 404 as a missing object would. - A test order is validated and debited from the test wallet as a live one is. A simulated seller accepts it a minute later and delivers it two minutes after that; you approve the delivery or request an update. - The Test helpers top the test wallet up, move a test order on at once and reset your test data. A live key on them gets 403 `test_mode_only`. - A test key on the seller and managed service operations, on a project's catalogue writes and on media requests gets 403 `not_available_in_test_mode`. - Idempotency keys are scoped per mode: the same `Idempotency-Key` sent with a live and a test key never replays the other mode's response. Webhooks: a subscription receives the events of its mode, signed as Standard Webhooks. A subscription created with a live key gets the events of your orders and your wallet; one created with a test key gets those of your test orders and test wallet, with `mode: test`, and never a live event. `x-webhooks` lists every event Growwer POSTs and its payload; the WebhookEvent schema describes the headers, the signature and the retries. Every response carries `X-Request-Id`. Errors share one shape, `{code, message, requestId, details?}`. Money is integer cents plus a currency code (12500 is 125.00 EUR), answered with `amountDecimal`, the same amount as an exact decimal string (\"125.00\"); dates are ISO-8601.
5
5
 
6
6
  The version of the OpenAPI document: 1
7
7
  Contact: support@growwer.com
@@ -11,5 +11,5 @@ Generator version: 7.24.0
11
11
  =end
12
12
 
13
13
  module Growwer
14
- VERSION = '2.0.0'
14
+ VERSION = '2.2.0'
15
15
  end
data/lib/growwer.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Growwer API
3
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.
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`. Test mode: a test key (`gw_sk_test_` plus 43 characters) works on your account's test data alone, apart from the real catalogue: test projects, orders and files, and a test wallet that starts at 1,000.00 EUR. Every response to a test key carries `Growwer-Mode: test`, and an id of the other mode answers 404 as a missing object would. - A test order is validated and debited from the test wallet as a live one is. A simulated seller accepts it a minute later and delivers it two minutes after that; you approve the delivery or request an update. - The Test helpers top the test wallet up, move a test order on at once and reset your test data. A live key on them gets 403 `test_mode_only`. - A test key on the seller and managed service operations, on a project's catalogue writes and on media requests gets 403 `not_available_in_test_mode`. - Idempotency keys are scoped per mode: the same `Idempotency-Key` sent with a live and a test key never replays the other mode's response. Webhooks: a subscription receives the events of its mode, signed as Standard Webhooks. A subscription created with a live key gets the events of your orders and your wallet; one created with a test key gets those of your test orders and test wallet, with `mode: test`, and never a live event. `x-webhooks` lists every event Growwer POSTs and its payload; the WebhookEvent schema describes the headers, the signature and the retries. Every response carries `X-Request-Id`. Errors share one shape, `{code, message, requestId, details?}`. Money is integer cents plus a currency code (12500 is 125.00 EUR), answered with `amountDecimal`, the same amount as an exact decimal string (\"125.00\"); dates are ISO-8601.
5
5
 
6
6
  The version of the OpenAPI document: 1
7
7
  Contact: support@growwer.com
@@ -18,7 +18,10 @@ require 'growwer/version'
18
18
  require 'growwer/configuration'
19
19
 
20
20
  # Models
21
+ require 'growwer/models/advance_test_order_request'
21
22
  require 'growwer/models/balance'
23
+ require 'growwer/models/balance_low_event_data'
24
+ require 'growwer/models/balance_low_event_data_wallet'
22
25
  require 'growwer/models/catalogue_media'
23
26
  require 'growwer/models/catalogue_media_flash_offer'
24
27
  require 'growwer/models/catalogue_media_metrics'
@@ -33,6 +36,7 @@ require 'growwer/models/create_project_request'
33
36
  require 'growwer/models/create_saved_filter_request'
34
37
  require 'growwer/models/create_seller_media_request'
35
38
  require 'growwer/models/create_seller_media_request_post_offer'
39
+ require 'growwer/models/create_webhook_request'
36
40
  require 'growwer/models/error'
37
41
  require 'growwer/models/get_buyer_wallet200_response'
38
42
  require 'growwer/models/get_me200_response'
@@ -57,6 +61,8 @@ require 'growwer/models/list_saved_filters200_response'
57
61
  require 'growwer/models/list_seller_medias200_response'
58
62
  require 'growwer/models/list_seller_orders200_response'
59
63
  require 'growwer/models/list_seller_transactions200_response'
64
+ require 'growwer/models/list_webhook_deliveries200_response'
65
+ require 'growwer/models/list_webhooks200_response'
60
66
  require 'growwer/models/list_withdrawals200_response'
61
67
  require 'growwer/models/managed_service_campaign'
62
68
  require 'growwer/models/managed_service_campaign_project'
@@ -85,6 +91,7 @@ require 'growwer/models/order_draft'
85
91
  require 'growwer/models/order_estimate'
86
92
  require 'growwer/models/order_estimate_request'
87
93
  require 'growwer/models/order_estimate_request_briefing'
94
+ require 'growwer/models/order_event_data'
88
95
  require 'growwer/models/order_link'
89
96
  require 'growwer/models/order_link_request'
90
97
  require 'growwer/models/order_media'
@@ -106,6 +113,7 @@ require 'growwer/models/saved_filter_notifications'
106
113
  require 'growwer/models/seller_fees'
107
114
  require 'growwer/models/seller_fees_or_null'
108
115
  require 'growwer/models/seller_media'
116
+ require 'growwer/models/seller_media_competitive_fees_by_link_type_inner'
109
117
  require 'growwer/models/seller_media_flash_offer'
110
118
  require 'growwer/models/seller_media_link_addition_offer'
111
119
  require 'growwer/models/seller_media_link_addition_offer_pricing_options_inner'
@@ -123,6 +131,8 @@ require 'growwer/models/seller_order_rejection'
123
131
  require 'growwer/models/seller_order_rejection_reason'
124
132
  require 'growwer/models/seller_post_order_briefing'
125
133
  require 'growwer/models/seller_transaction'
134
+ require 'growwer/models/top_up_test_wallet200_response'
135
+ require 'growwer/models/top_up_test_wallet_request'
126
136
  require 'growwer/models/transaction'
127
137
  require 'growwer/models/update_project_request'
128
138
  require 'growwer/models/update_seller_media_request'
@@ -131,7 +141,16 @@ require 'growwer/models/update_seller_media_request_link_addition_offer'
131
141
  require 'growwer/models/update_seller_media_request_link_addition_offer_pricing_options_inner'
132
142
  require 'growwer/models/update_seller_media_request_post_offer'
133
143
  require 'growwer/models/update_seller_media_request_post_offer_pricing_options_inner'
144
+ require 'growwer/models/update_webhook_request'
134
145
  require 'growwer/models/upload_file201_response'
146
+ require 'growwer/models/webhook'
147
+ require 'growwer/models/webhook_delivery'
148
+ require 'growwer/models/webhook_delivery_attempt'
149
+ require 'growwer/models/webhook_event'
150
+ require 'growwer/models/webhook_event_data'
151
+ require 'growwer/models/webhook_event_type'
152
+ require 'growwer/models/webhook_test_event_data'
153
+ require 'growwer/models/webhook_with_secret'
135
154
  require 'growwer/models/withdrawal'
136
155
 
137
156
  # APIs
@@ -147,6 +166,8 @@ require 'growwer/api/seller_account_api'
147
166
  require 'growwer/api/seller_medias_api'
148
167
  require 'growwer/api/seller_orders_api'
149
168
  require 'growwer/api/seller_wallet_api'
169
+ require 'growwer/api/test_helpers_api'
170
+ require 'growwer/api/webhooks_api'
150
171
 
151
172
  module Growwer
152
173
  class << self
@@ -0,0 +1,74 @@
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`. Test mode: a test key (`gw_sk_test_` plus 43 characters) works on your account's test data alone, apart from the real catalogue: test projects, orders and files, and a test wallet that starts at 1,000.00 EUR. Every response to a test key carries `Growwer-Mode: test`, and an id of the other mode answers 404 as a missing object would. - A test order is validated and debited from the test wallet as a live one is. A simulated seller accepts it a minute later and delivers it two minutes after that; you approve the delivery or request an update. - The Test helpers top the test wallet up, move a test order on at once and reset your test data. A live key on them gets 403 `test_mode_only`. - A test key on the seller and managed service operations, on a project's catalogue writes and on media requests gets 403 `not_available_in_test_mode`. - Idempotency keys are scoped per mode: the same `Idempotency-Key` sent with a live and a test key never replays the other mode's response. Webhooks: a subscription receives the events of its mode, signed as Standard Webhooks. Your orders' events and `balance.low` are live: creating a subscription with a test key gets 403 `not_available_in_test_mode` for now. `x-webhooks` lists every event Growwer POSTs and its payload; the WebhookEvent schema describes the headers, the signature and the retries. 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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for Growwer::TestHelpersApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'TestHelpersApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = Growwer::TestHelpersApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of TestHelpersApi' do
30
+ it 'should create an instance of TestHelpersApi' do
31
+ expect(@api_instance).to be_instance_of(Growwer::TestHelpersApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for advance_test_order
36
+ # Advance a test order
37
+ # Test keys only. Moves one of your test orders at once to &#x60;to&#x60;, without waiting for the simulated seller: &#x60;accepted&#x60; or &#x60;rejected&#x60; (by the seller, from &#x60;pending_acceptance&#x60;), &#x60;draft_delivered&#x60; (the sample draft, from &#x60;pending_draft&#x60; or &#x60;pending_draft_update&#x60;), &#x60;draft_update_requested&#x60; (as if you sent the draft back, from &#x60;pending_draft_review&#x60;), &#x60;published&#x60; (delivered for your review, from &#x60;pending_order_delivery&#x60;, &#x60;scheduled&#x60; or &#x60;pending_order_delivery_update&#x60;), &#x60;update_requested&#x60; (as if you sent the delivery back, from &#x60;pending_order_delivery_review&#x60;) or &#x60;cancelled_by_growwer&#x60; (from any state that is not finished). The order and your test wallet change as that move changes them live, a rejection or a cancellation refunding the price, and the simulated seller carries on from the new state. A post with a future &#x60;scheduledPublicationDate&#x60; waits in &#x60;scheduled&#x60; until that date once the simulated seller delivers it; &#x60;published&#x60; skips the wait. A target its state does not allow answers 409 &#x60;invalid_transition&#x60; with the targets it allows. A live key gets 403 &#x60;test_mode_only&#x60;.
38
+ # @param id
39
+ # @param idempotency_key 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;.
40
+ # @param advance_test_order_request
41
+ # @param [Hash] opts the optional parameters
42
+ # @return [Order]
43
+ describe 'advance_test_order test' do
44
+ it 'should work' do
45
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
46
+ end
47
+ end
48
+
49
+ # unit tests for reset_test_data
50
+ # Reset your test data
51
+ # Test keys only. Deletes your test projects, orders and uploaded test files, and returns your test wallet to its opening balance of 1,000.00 EUR with no movements. Your API keys and webhook subscriptions stay, and nothing of your live account changes. It takes no body. A live key gets 403 &#x60;test_mode_only&#x60;.
52
+ # @param idempotency_key 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;.
53
+ # @param [Hash] opts the optional parameters
54
+ # @return [nil]
55
+ describe 'reset_test_data test' do
56
+ it 'should work' do
57
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
58
+ end
59
+ end
60
+
61
+ # unit tests for top_up_test_wallet
62
+ # Top up your test wallet
63
+ # Test keys only. Credits your test wallet, the buyer wallet a test key spends from, with fictitious money: more than nothing and at most 10,000.00 EUR per call. It never touches your real wallets, takes no payment and issues no invoice; the movement shows in GET /wallets/buyer/transactions for a test key as a confirmed &#x60;deposit&#x60;. A live key gets 403 &#x60;test_mode_only&#x60;.
64
+ # @param idempotency_key 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;.
65
+ # @param top_up_test_wallet_request
66
+ # @param [Hash] opts the optional parameters
67
+ # @return [TopUpTestWallet200Response]
68
+ describe 'top_up_test_wallet test' do
69
+ it 'should work' do
70
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
71
+ end
72
+ end
73
+
74
+ end