stigg 0.1.0.pre.alpha.1

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 (230) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +45 -0
  4. data/README.md +233 -0
  5. data/SECURITY.md +23 -0
  6. data/lib/stigg/client.rb +72 -0
  7. data/lib/stigg/errors.rb +228 -0
  8. data/lib/stigg/file_part.rb +58 -0
  9. data/lib/stigg/internal/my_cursor_id_page.rb +82 -0
  10. data/lib/stigg/internal/transport/base_client.rb +570 -0
  11. data/lib/stigg/internal/transport/pooled_net_requester.rb +210 -0
  12. data/lib/stigg/internal/type/array_of.rb +168 -0
  13. data/lib/stigg/internal/type/base_model.rb +529 -0
  14. data/lib/stigg/internal/type/base_page.rb +55 -0
  15. data/lib/stigg/internal/type/boolean.rb +77 -0
  16. data/lib/stigg/internal/type/converter.rb +327 -0
  17. data/lib/stigg/internal/type/enum.rb +131 -0
  18. data/lib/stigg/internal/type/file_input.rb +110 -0
  19. data/lib/stigg/internal/type/hash_of.rb +188 -0
  20. data/lib/stigg/internal/type/request_parameters.rb +42 -0
  21. data/lib/stigg/internal/type/union.rb +237 -0
  22. data/lib/stigg/internal/type/unknown.rb +81 -0
  23. data/lib/stigg/internal/util.rb +920 -0
  24. data/lib/stigg/internal.rb +20 -0
  25. data/lib/stigg/models/v1/coupon_create_params.rb +221 -0
  26. data/lib/stigg/models/v1/coupon_create_response.rb +317 -0
  27. data/lib/stigg/models/v1/coupon_list_params.rb +40 -0
  28. data/lib/stigg/models/v1/coupon_list_response.rb +324 -0
  29. data/lib/stigg/models/v1/coupon_retrieve_params.rb +16 -0
  30. data/lib/stigg/models/v1/coupon_retrieve_response.rb +317 -0
  31. data/lib/stigg/models/v1/customer_archive_params.rb +16 -0
  32. data/lib/stigg/models/v1/customer_create_params.rb +185 -0
  33. data/lib/stigg/models/v1/customer_list_params.rb +40 -0
  34. data/lib/stigg/models/v1/customer_list_response.rb +223 -0
  35. data/lib/stigg/models/v1/customer_response.rb +216 -0
  36. data/lib/stigg/models/v1/customer_retrieve_params.rb +16 -0
  37. data/lib/stigg/models/v1/customer_unarchive_params.rb +16 -0
  38. data/lib/stigg/models/v1/customer_update_params.rb +107 -0
  39. data/lib/stigg/models/v1/customers/payment_method_attach_params.rb +197 -0
  40. data/lib/stigg/models/v1/customers/payment_method_detach_params.rb +18 -0
  41. data/lib/stigg/models/v1/customers/promotional_create_params.rb +294 -0
  42. data/lib/stigg/models/v1/customers/promotional_create_response.rb +268 -0
  43. data/lib/stigg/models/v1/customers/promotional_revoke_params.rb +24 -0
  44. data/lib/stigg/models/v1/customers/promotional_revoke_response.rb +268 -0
  45. data/lib/stigg/models/v1/customers/usage_retrieve_params.rb +56 -0
  46. data/lib/stigg/models/v1/customers/usage_retrieve_response.rb +145 -0
  47. data/lib/stigg/models/v1/subscription_create_params.rb +214 -0
  48. data/lib/stigg/models/v1/subscription_create_response.rb +338 -0
  49. data/lib/stigg/models/v1/subscription_delegate_params.rb +24 -0
  50. data/lib/stigg/models/v1/subscription_delegate_response.rb +274 -0
  51. data/lib/stigg/models/v1/subscription_list_params.rb +60 -0
  52. data/lib/stigg/models/v1/subscription_list_response.rb +281 -0
  53. data/lib/stigg/models/v1/subscription_migrate_params.rb +37 -0
  54. data/lib/stigg/models/v1/subscription_migrate_response.rb +274 -0
  55. data/lib/stigg/models/v1/subscription_preview_params.rb +644 -0
  56. data/lib/stigg/models/v1/subscription_preview_response.rb +431 -0
  57. data/lib/stigg/models/v1/subscription_retrieve_params.rb +16 -0
  58. data/lib/stigg/models/v1/subscription_retrieve_response.rb +274 -0
  59. data/lib/stigg/models/v1/subscription_transfer_params.rb +28 -0
  60. data/lib/stigg/models/v1/subscription_transfer_response.rb +274 -0
  61. data/lib/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_params.rb +18 -0
  62. data/lib/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_response.rb +32 -0
  63. data/lib/stigg/models/v1/subscriptions/future_update_cancel_schedule_params.rb +18 -0
  64. data/lib/stigg/models/v1/subscriptions/future_update_cancel_schedule_response.rb +32 -0
  65. data/lib/stigg/models/v1_create_event_params.rb +87 -0
  66. data/lib/stigg/models/v1_create_event_response.rb +16 -0
  67. data/lib/stigg/models/v1_create_usage_params.rb +96 -0
  68. data/lib/stigg/models/v1_create_usage_response.rb +112 -0
  69. data/lib/stigg/models.rb +47 -0
  70. data/lib/stigg/request_options.rb +77 -0
  71. data/lib/stigg/resources/v1/coupons.rb +95 -0
  72. data/lib/stigg/resources/v1/customers/payment_method.rb +67 -0
  73. data/lib/stigg/resources/v1/customers/promotional.rb +69 -0
  74. data/lib/stigg/resources/v1/customers/usage.rb +59 -0
  75. data/lib/stigg/resources/v1/customers.rb +177 -0
  76. data/lib/stigg/resources/v1/subscriptions/future_update.rb +56 -0
  77. data/lib/stigg/resources/v1/subscriptions.rb +241 -0
  78. data/lib/stigg/resources/v1.rb +70 -0
  79. data/lib/stigg/version.rb +5 -0
  80. data/lib/stigg.rb +108 -0
  81. data/manifest.yaml +17 -0
  82. data/rbi/stigg/client.rbi +49 -0
  83. data/rbi/stigg/errors.rbi +205 -0
  84. data/rbi/stigg/file_part.rbi +37 -0
  85. data/rbi/stigg/internal/my_cursor_id_page.rbi +19 -0
  86. data/rbi/stigg/internal/transport/base_client.rbi +297 -0
  87. data/rbi/stigg/internal/transport/pooled_net_requester.rbi +82 -0
  88. data/rbi/stigg/internal/type/array_of.rbi +104 -0
  89. data/rbi/stigg/internal/type/base_model.rbi +299 -0
  90. data/rbi/stigg/internal/type/base_page.rbi +42 -0
  91. data/rbi/stigg/internal/type/boolean.rbi +58 -0
  92. data/rbi/stigg/internal/type/converter.rbi +204 -0
  93. data/rbi/stigg/internal/type/enum.rbi +82 -0
  94. data/rbi/stigg/internal/type/file_input.rbi +58 -0
  95. data/rbi/stigg/internal/type/hash_of.rbi +104 -0
  96. data/rbi/stigg/internal/type/request_parameters.rbi +29 -0
  97. data/rbi/stigg/internal/type/union.rbi +126 -0
  98. data/rbi/stigg/internal/type/unknown.rbi +58 -0
  99. data/rbi/stigg/internal/util.rbi +478 -0
  100. data/rbi/stigg/internal.rbi +16 -0
  101. data/rbi/stigg/models/v1/coupon_create_params.rbi +758 -0
  102. data/rbi/stigg/models/v1/coupon_create_response.rbi +986 -0
  103. data/rbi/stigg/models/v1/coupon_list_params.rbi +70 -0
  104. data/rbi/stigg/models/v1/coupon_list_response.rbi +983 -0
  105. data/rbi/stigg/models/v1/coupon_retrieve_params.rbi +29 -0
  106. data/rbi/stigg/models/v1/coupon_retrieve_response.rbi +986 -0
  107. data/rbi/stigg/models/v1/customer_archive_params.rbi +29 -0
  108. data/rbi/stigg/models/v1/customer_create_params.rbi +376 -0
  109. data/rbi/stigg/models/v1/customer_list_params.rbi +70 -0
  110. data/rbi/stigg/models/v1/customer_list_response.rbi +447 -0
  111. data/rbi/stigg/models/v1/customer_response.rbi +423 -0
  112. data/rbi/stigg/models/v1/customer_retrieve_params.rbi +29 -0
  113. data/rbi/stigg/models/v1/customer_unarchive_params.rbi +29 -0
  114. data/rbi/stigg/models/v1/customer_update_params.rbi +226 -0
  115. data/rbi/stigg/models/v1/customers/payment_method_attach_params.rbi +769 -0
  116. data/rbi/stigg/models/v1/customers/payment_method_detach_params.rbi +34 -0
  117. data/rbi/stigg/models/v1/customers/promotional_create_params.rbi +639 -0
  118. data/rbi/stigg/models/v1/customers/promotional_create_response.rbi +495 -0
  119. data/rbi/stigg/models/v1/customers/promotional_revoke_params.rbi +42 -0
  120. data/rbi/stigg/models/v1/customers/promotional_revoke_response.rbi +497 -0
  121. data/rbi/stigg/models/v1/customers/usage_retrieve_params.rbi +84 -0
  122. data/rbi/stigg/models/v1/customers/usage_retrieve_response.rbi +353 -0
  123. data/rbi/stigg/models/v1/subscription_create_params.rbi +394 -0
  124. data/rbi/stigg/models/v1/subscription_create_response.rbi +668 -0
  125. data/rbi/stigg/models/v1/subscription_delegate_params.rbi +48 -0
  126. data/rbi/stigg/models/v1/subscription_delegate_response.rbi +535 -0
  127. data/rbi/stigg/models/v1/subscription_list_params.rbi +94 -0
  128. data/rbi/stigg/models/v1/subscription_list_response.rbi +543 -0
  129. data/rbi/stigg/models/v1/subscription_migrate_params.rbi +99 -0
  130. data/rbi/stigg/models/v1/subscription_migrate_response.rbi +535 -0
  131. data/rbi/stigg/models/v1/subscription_preview_params.rbi +1786 -0
  132. data/rbi/stigg/models/v1/subscription_preview_response.rbi +929 -0
  133. data/rbi/stigg/models/v1/subscription_retrieve_params.rbi +32 -0
  134. data/rbi/stigg/models/v1/subscription_retrieve_response.rbi +535 -0
  135. data/rbi/stigg/models/v1/subscription_transfer_params.rbi +50 -0
  136. data/rbi/stigg/models/v1/subscription_transfer_response.rbi +535 -0
  137. data/rbi/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_params.rbi +34 -0
  138. data/rbi/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_response.rbi +79 -0
  139. data/rbi/stigg/models/v1/subscriptions/future_update_cancel_schedule_params.rbi +34 -0
  140. data/rbi/stigg/models/v1/subscriptions/future_update_cancel_schedule_response.rbi +79 -0
  141. data/rbi/stigg/models/v1_create_event_params.rbi +160 -0
  142. data/rbi/stigg/models/v1_create_event_response.rbi +23 -0
  143. data/rbi/stigg/models/v1_create_usage_params.rbi +177 -0
  144. data/rbi/stigg/models/v1_create_usage_response.rbi +150 -0
  145. data/rbi/stigg/models.rbi +9 -0
  146. data/rbi/stigg/request_options.rbi +55 -0
  147. data/rbi/stigg/resources/v1/coupons.rbi +79 -0
  148. data/rbi/stigg/resources/v1/customers/payment_method.rbi +54 -0
  149. data/rbi/stigg/resources/v1/customers/promotional.rbi +53 -0
  150. data/rbi/stigg/resources/v1/customers/usage.rbi +45 -0
  151. data/rbi/stigg/resources/v1/customers.rbi +138 -0
  152. data/rbi/stigg/resources/v1/subscriptions/future_update.rbi +40 -0
  153. data/rbi/stigg/resources/v1/subscriptions.rbi +199 -0
  154. data/rbi/stigg/resources/v1.rbi +49 -0
  155. data/rbi/stigg/version.rbi +5 -0
  156. data/sig/stigg/client.rbs +26 -0
  157. data/sig/stigg/errors.rbs +117 -0
  158. data/sig/stigg/file_part.rbs +21 -0
  159. data/sig/stigg/internal/my_cursor_id_page.rbs +11 -0
  160. data/sig/stigg/internal/transport/base_client.rbs +133 -0
  161. data/sig/stigg/internal/transport/pooled_net_requester.rbs +48 -0
  162. data/sig/stigg/internal/type/array_of.rbs +48 -0
  163. data/sig/stigg/internal/type/base_model.rbs +102 -0
  164. data/sig/stigg/internal/type/base_page.rbs +24 -0
  165. data/sig/stigg/internal/type/boolean.rbs +26 -0
  166. data/sig/stigg/internal/type/converter.rbs +79 -0
  167. data/sig/stigg/internal/type/enum.rbs +32 -0
  168. data/sig/stigg/internal/type/file_input.rbs +25 -0
  169. data/sig/stigg/internal/type/hash_of.rbs +48 -0
  170. data/sig/stigg/internal/type/request_parameters.rbs +17 -0
  171. data/sig/stigg/internal/type/union.rbs +52 -0
  172. data/sig/stigg/internal/type/unknown.rbs +26 -0
  173. data/sig/stigg/internal/util.rbs +185 -0
  174. data/sig/stigg/internal.rbs +9 -0
  175. data/sig/stigg/models/v1/coupon_create_params.rbs +323 -0
  176. data/sig/stigg/models/v1/coupon_create_response.rbs +392 -0
  177. data/sig/stigg/models/v1/coupon_list_params.rbs +40 -0
  178. data/sig/stigg/models/v1/coupon_list_response.rbs +399 -0
  179. data/sig/stigg/models/v1/coupon_retrieve_params.rbs +17 -0
  180. data/sig/stigg/models/v1/coupon_retrieve_response.rbs +394 -0
  181. data/sig/stigg/models/v1/customer_archive_params.rbs +17 -0
  182. data/sig/stigg/models/v1/customer_create_params.rbs +169 -0
  183. data/sig/stigg/models/v1/customer_list_params.rbs +40 -0
  184. data/sig/stigg/models/v1/customer_list_response.rbs +198 -0
  185. data/sig/stigg/models/v1/customer_response.rbs +188 -0
  186. data/sig/stigg/models/v1/customer_retrieve_params.rbs +17 -0
  187. data/sig/stigg/models/v1/customer_unarchive_params.rbs +17 -0
  188. data/sig/stigg/models/v1/customer_update_params.rbs +110 -0
  189. data/sig/stigg/models/v1/customers/payment_method_attach_params.rbs +315 -0
  190. data/sig/stigg/models/v1/customers/payment_method_detach_params.rbs +19 -0
  191. data/sig/stigg/models/v1/customers/promotional_create_params.rbs +234 -0
  192. data/sig/stigg/models/v1/customers/promotional_create_response.rbs +209 -0
  193. data/sig/stigg/models/v1/customers/promotional_revoke_params.rbs +27 -0
  194. data/sig/stigg/models/v1/customers/promotional_revoke_response.rbs +209 -0
  195. data/sig/stigg/models/v1/customers/usage_retrieve_params.rbs +54 -0
  196. data/sig/stigg/models/v1/customers/usage_retrieve_response.rbs +134 -0
  197. data/sig/stigg/models/v1/subscription_create_params.rbs +199 -0
  198. data/sig/stigg/models/v1/subscription_create_response.rbs +283 -0
  199. data/sig/stigg/models/v1/subscription_delegate_params.rbs +26 -0
  200. data/sig/stigg/models/v1/subscription_delegate_response.rbs +224 -0
  201. data/sig/stigg/models/v1/subscription_list_params.rbs +58 -0
  202. data/sig/stigg/models/v1/subscription_list_response.rbs +229 -0
  203. data/sig/stigg/models/v1/subscription_migrate_params.rbs +43 -0
  204. data/sig/stigg/models/v1/subscription_migrate_response.rbs +224 -0
  205. data/sig/stigg/models/v1/subscription_preview_params.rbs +821 -0
  206. data/sig/stigg/models/v1/subscription_preview_response.rbs +466 -0
  207. data/sig/stigg/models/v1/subscription_retrieve_params.rbs +17 -0
  208. data/sig/stigg/models/v1/subscription_retrieve_response.rbs +224 -0
  209. data/sig/stigg/models/v1/subscription_transfer_params.rbs +26 -0
  210. data/sig/stigg/models/v1/subscription_transfer_response.rbs +224 -0
  211. data/sig/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_params.rbs +19 -0
  212. data/sig/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_response.rbs +34 -0
  213. data/sig/stigg/models/v1/subscriptions/future_update_cancel_schedule_params.rbs +19 -0
  214. data/sig/stigg/models/v1/subscriptions/future_update_cancel_schedule_response.rbs +34 -0
  215. data/sig/stigg/models/v1_create_event_params.rbs +80 -0
  216. data/sig/stigg/models/v1_create_event_response.rbs +13 -0
  217. data/sig/stigg/models/v1_create_usage_params.rbs +90 -0
  218. data/sig/stigg/models/v1_create_usage_response.rbs +85 -0
  219. data/sig/stigg/models.rbs +7 -0
  220. data/sig/stigg/request_options.rbs +34 -0
  221. data/sig/stigg/resources/v1/coupons.rbs +32 -0
  222. data/sig/stigg/resources/v1/customers/payment_method.rbs +25 -0
  223. data/sig/stigg/resources/v1/customers/promotional.rbs +23 -0
  224. data/sig/stigg/resources/v1/customers/usage.rbs +21 -0
  225. data/sig/stigg/resources/v1/customers.rbs +58 -0
  226. data/sig/stigg/resources/v1/subscriptions/future_update.rbs +21 -0
  227. data/sig/stigg/resources/v1/subscriptions.rbs +76 -0
  228. data/sig/stigg/resources/v1.rbs +23 -0
  229. data/sig/stigg/version.rbs +3 -0
  230. metadata +301 -0
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Models
5
+ # @see Stigg::Resources::V1#create_event
6
+ class V1CreateEventParams < Stigg::Internal::Type::BaseModel
7
+ extend Stigg::Internal::Type::RequestParameters::Converter
8
+ include Stigg::Internal::Type::RequestParameters
9
+
10
+ # @!attribute events
11
+ # A list of usage events to report
12
+ #
13
+ # @return [Array<Stigg::Models::V1CreateEventParams::Event>]
14
+ required :events, -> { Stigg::Internal::Type::ArrayOf[Stigg::V1CreateEventParams::Event] }
15
+
16
+ # @!method initialize(events:, request_options: {})
17
+ # @param events [Array<Stigg::Models::V1CreateEventParams::Event>] A list of usage events to report
18
+ #
19
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}]
20
+
21
+ class Event < Stigg::Internal::Type::BaseModel
22
+ # @!attribute customer_id
23
+ # Customer id
24
+ #
25
+ # @return [String]
26
+ required :customer_id, String, api_name: :customerId
27
+
28
+ # @!attribute event_name
29
+ # The name of the usage event
30
+ #
31
+ # @return [String]
32
+ required :event_name, String, api_name: :eventName
33
+
34
+ # @!attribute idempotency_key
35
+ # Idempotency key
36
+ #
37
+ # @return [String]
38
+ required :idempotency_key, String, api_name: :idempotencyKey
39
+
40
+ # @!attribute dimensions
41
+ # Dimensions associated with the usage event
42
+ #
43
+ # @return [Hash{Symbol=>String, Float, Boolean}, nil]
44
+ optional :dimensions,
45
+ -> { Stigg::Internal::Type::HashOf[union: Stigg::V1CreateEventParams::Event::Dimension] }
46
+
47
+ # @!attribute resource_id
48
+ # Resource id
49
+ #
50
+ # @return [String, nil]
51
+ optional :resource_id, String, api_name: :resourceId, nil?: true
52
+
53
+ # @!attribute timestamp
54
+ # Timestamp
55
+ #
56
+ # @return [Time, nil]
57
+ optional :timestamp, Time
58
+
59
+ # @!method initialize(customer_id:, event_name:, idempotency_key:, dimensions: nil, resource_id: nil, timestamp: nil)
60
+ # @param customer_id [String] Customer id
61
+ #
62
+ # @param event_name [String] The name of the usage event
63
+ #
64
+ # @param idempotency_key [String] Idempotency key
65
+ #
66
+ # @param dimensions [Hash{Symbol=>String, Float, Boolean}] Dimensions associated with the usage event
67
+ #
68
+ # @param resource_id [String, nil] Resource id
69
+ #
70
+ # @param timestamp [Time] Timestamp
71
+
72
+ module Dimension
73
+ extend Stigg::Internal::Type::Union
74
+
75
+ variant String
76
+
77
+ variant Float
78
+
79
+ variant Stigg::Internal::Type::Boolean
80
+
81
+ # @!method self.variants
82
+ # @return [Array(String, Float, Boolean)]
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Models
5
+ # @see Stigg::Resources::V1#create_event
6
+ class V1CreateEventResponse < Stigg::Internal::Type::BaseModel
7
+ # @!attribute data
8
+ #
9
+ # @return [Object]
10
+ required :data, Stigg::Internal::Type::Unknown
11
+
12
+ # @!method initialize(data:)
13
+ # @param data [Object]
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Models
5
+ # @see Stigg::Resources::V1#create_usage
6
+ class V1CreateUsageParams < Stigg::Internal::Type::BaseModel
7
+ extend Stigg::Internal::Type::RequestParameters::Converter
8
+ include Stigg::Internal::Type::RequestParameters
9
+
10
+ # @!attribute usages
11
+ # A list of usage reports to be submitted in bulk
12
+ #
13
+ # @return [Array<Stigg::Models::V1CreateUsageParams::Usage>]
14
+ required :usages, -> { Stigg::Internal::Type::ArrayOf[Stigg::V1CreateUsageParams::Usage] }
15
+
16
+ # @!method initialize(usages:, request_options: {})
17
+ # @param usages [Array<Stigg::Models::V1CreateUsageParams::Usage>] A list of usage reports to be submitted in bulk
18
+ #
19
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}]
20
+
21
+ class Usage < Stigg::Internal::Type::BaseModel
22
+ # @!attribute customer_id
23
+ # Customer id
24
+ #
25
+ # @return [String]
26
+ required :customer_id, String, api_name: :customerId
27
+
28
+ # @!attribute feature_id
29
+ # Feature id
30
+ #
31
+ # @return [String]
32
+ required :feature_id, String, api_name: :featureId
33
+
34
+ # @!attribute value
35
+ # The value to report for usage
36
+ #
37
+ # @return [Integer]
38
+ required :value, Integer
39
+
40
+ # @!attribute created_at
41
+ # Timestamp of when the record was created
42
+ #
43
+ # @return [Time, nil]
44
+ optional :created_at, Time, api_name: :createdAt
45
+
46
+ # @!attribute dimensions
47
+ # Additional dimensions for the usage report
48
+ #
49
+ # @return [Hash{Symbol=>String}, nil]
50
+ optional :dimensions, Stigg::Internal::Type::HashOf[String]
51
+
52
+ # @!attribute resource_id
53
+ # Resource id
54
+ #
55
+ # @return [String, nil]
56
+ optional :resource_id, String, api_name: :resourceId, nil?: true
57
+
58
+ # @!attribute update_behavior
59
+ # The method by which the usage value should be updated
60
+ #
61
+ # @return [Symbol, Stigg::Models::V1CreateUsageParams::Usage::UpdateBehavior, nil]
62
+ optional :update_behavior,
63
+ enum: -> { Stigg::V1CreateUsageParams::Usage::UpdateBehavior },
64
+ api_name: :updateBehavior
65
+
66
+ # @!method initialize(customer_id:, feature_id:, value:, created_at: nil, dimensions: nil, resource_id: nil, update_behavior: nil)
67
+ # @param customer_id [String] Customer id
68
+ #
69
+ # @param feature_id [String] Feature id
70
+ #
71
+ # @param value [Integer] The value to report for usage
72
+ #
73
+ # @param created_at [Time] Timestamp of when the record was created
74
+ #
75
+ # @param dimensions [Hash{Symbol=>String}] Additional dimensions for the usage report
76
+ #
77
+ # @param resource_id [String, nil] Resource id
78
+ #
79
+ # @param update_behavior [Symbol, Stigg::Models::V1CreateUsageParams::Usage::UpdateBehavior] The method by which the usage value should be updated
80
+
81
+ # The method by which the usage value should be updated
82
+ #
83
+ # @see Stigg::Models::V1CreateUsageParams::Usage#update_behavior
84
+ module UpdateBehavior
85
+ extend Stigg::Internal::Type::Enum
86
+
87
+ DELTA = :DELTA
88
+ SET = :SET
89
+
90
+ # @!method self.values
91
+ # @return [Array<Symbol>]
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Models
5
+ # @see Stigg::Resources::V1#create_usage
6
+ class V1CreateUsageResponse < Stigg::Internal::Type::BaseModel
7
+ # @!attribute data
8
+ #
9
+ # @return [Array<Stigg::Models::V1CreateUsageResponse::Data>]
10
+ required :data, -> { Stigg::Internal::Type::ArrayOf[Stigg::Models::V1CreateUsageResponse::Data] }
11
+
12
+ # @!method initialize(data:)
13
+ # @param data [Array<Stigg::Models::V1CreateUsageResponse::Data>]
14
+
15
+ class Data < Stigg::Internal::Type::BaseModel
16
+ # @!attribute id
17
+ # Unique identifier for the entity
18
+ #
19
+ # @return [String]
20
+ required :id, String
21
+
22
+ # @!attribute created_at
23
+ # Timestamp of when the record was created
24
+ #
25
+ # @return [Time]
26
+ required :created_at, Time, api_name: :createdAt
27
+
28
+ # @!attribute customer_id
29
+ # Customer id
30
+ #
31
+ # @return [String]
32
+ required :customer_id, String, api_name: :customerId
33
+
34
+ # @!attribute feature_id
35
+ # Feature id
36
+ #
37
+ # @return [String]
38
+ required :feature_id, String, api_name: :featureId
39
+
40
+ # @!attribute timestamp
41
+ # Timestamp
42
+ #
43
+ # @return [Time]
44
+ required :timestamp, Time
45
+
46
+ # @!attribute value
47
+ # The usage measurement record
48
+ #
49
+ # @return [Float]
50
+ required :value, Float
51
+
52
+ # @!attribute current_usage
53
+ # The current measured usage value
54
+ #
55
+ # @return [Float, nil]
56
+ optional :current_usage, Float, api_name: :currentUsage, nil?: true
57
+
58
+ # @!attribute next_reset_date
59
+ # The date when the next usage reset will occur
60
+ #
61
+ # @return [Time, nil]
62
+ optional :next_reset_date, Time, api_name: :nextResetDate, nil?: true
63
+
64
+ # @!attribute resource_id
65
+ # Resource id
66
+ #
67
+ # @return [String, nil]
68
+ optional :resource_id, String, api_name: :resourceId, nil?: true
69
+
70
+ # @!attribute usage_period_end
71
+ # The end date of the usage period in which this measurement resides (for
72
+ # entitlements with a reset period)
73
+ #
74
+ # @return [Time, nil]
75
+ optional :usage_period_end, Time, api_name: :usagePeriodEnd, nil?: true
76
+
77
+ # @!attribute usage_period_start
78
+ # The start date of the usage period in which this measurement resides (for
79
+ # entitlements with a reset period)
80
+ #
81
+ # @return [Time, nil]
82
+ optional :usage_period_start, Time, api_name: :usagePeriodStart, nil?: true
83
+
84
+ # @!method initialize(id:, created_at:, customer_id:, feature_id:, timestamp:, value:, current_usage: nil, next_reset_date: nil, resource_id: nil, usage_period_end: nil, usage_period_start: nil)
85
+ # Some parameter documentations has been truncated, see
86
+ # {Stigg::Models::V1CreateUsageResponse::Data} for more details.
87
+ #
88
+ # @param id [String] Unique identifier for the entity
89
+ #
90
+ # @param created_at [Time] Timestamp of when the record was created
91
+ #
92
+ # @param customer_id [String] Customer id
93
+ #
94
+ # @param feature_id [String] Feature id
95
+ #
96
+ # @param timestamp [Time] Timestamp
97
+ #
98
+ # @param value [Float] The usage measurement record
99
+ #
100
+ # @param current_usage [Float, nil] The current measured usage value
101
+ #
102
+ # @param next_reset_date [Time, nil] The date when the next usage reset will occur
103
+ #
104
+ # @param resource_id [String, nil] Resource id
105
+ #
106
+ # @param usage_period_end [Time, nil] The end date of the usage period in which this measurement resides (for entitlem
107
+ #
108
+ # @param usage_period_start [Time, nil] The start date of the usage period in which this measurement resides (for entitl
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ [Stigg::Internal::Type::BaseModel, *Stigg::Internal::Type::BaseModel.subclasses].each do |cls|
5
+ cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, Stigg::Internal::AnyHash) } }
6
+ end
7
+
8
+ Stigg::Internal::Util.walk_namespaces(Stigg::Models).each do |mod|
9
+ case mod
10
+ in Stigg::Internal::Type::Enum | Stigg::Internal::Type::Union
11
+ mod.constants.each do |name|
12
+ case mod.const_get(name)
13
+ in true | false
14
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
15
+ mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
16
+ in Integer
17
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
18
+ mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
19
+ in Float
20
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
21
+ mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
22
+ in Symbol
23
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
24
+ mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
25
+ else
26
+ end
27
+ end
28
+ else
29
+ end
30
+ end
31
+
32
+ Stigg::Internal::Util.walk_namespaces(Stigg::Models)
33
+ .lazy
34
+ .grep(Stigg::Internal::Type::Union)
35
+ .each do |mod|
36
+ const = :Variants
37
+ next if mod.sorbet_constant_defined?(const)
38
+
39
+ mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
40
+ end
41
+
42
+ V1 = Stigg::Models::V1
43
+
44
+ V1CreateEventParams = Stigg::Models::V1CreateEventParams
45
+
46
+ V1CreateUsageParams = Stigg::Models::V1CreateUsageParams
47
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ # Specify HTTP behaviour to use for a specific request. These options supplement
5
+ # or override those provided at the client level.
6
+ #
7
+ # When making a request, you can pass an actual {RequestOptions} instance, or
8
+ # simply pass a Hash with symbol keys matching the attributes on this class.
9
+ class RequestOptions < Stigg::Internal::Type::BaseModel
10
+ # @api private
11
+ #
12
+ # @param opts [Stigg::RequestOptions, Hash{Symbol=>Object}]
13
+ #
14
+ # @raise [ArgumentError]
15
+ def self.validate!(opts)
16
+ case opts
17
+ in Stigg::RequestOptions | Hash
18
+ opts.to_h.each_key do |k|
19
+ unless fields.include?(k)
20
+ raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}")
21
+ end
22
+ end
23
+ else
24
+ raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}")
25
+ end
26
+ end
27
+
28
+ # @!attribute idempotency_key
29
+ # Idempotency key to send with request and all associated retries. Will only be
30
+ # sent for write requests.
31
+ #
32
+ # @return [String, nil]
33
+ optional :idempotency_key, String
34
+
35
+ # @!attribute extra_query
36
+ # Extra query params to send with the request. These are `.merge`’d into any
37
+ # `query` given at the client level.
38
+ #
39
+ # @return [Hash{String=>Array<String>, String, nil}, nil]
40
+ optional :extra_query, Stigg::Internal::Type::HashOf[Stigg::Internal::Type::ArrayOf[String]]
41
+
42
+ # @!attribute extra_headers
43
+ # Extra headers to send with the request. These are `.merged`’d into any
44
+ # `extra_headers` given at the client level.
45
+ #
46
+ # @return [Hash{String=>String, nil}, nil]
47
+ optional :extra_headers, Stigg::Internal::Type::HashOf[String, nil?: true]
48
+
49
+ # @!attribute extra_body
50
+ # Extra data to send with the request. These are deep merged into any data
51
+ # generated as part of the normal request.
52
+ #
53
+ # @return [Object, nil]
54
+ optional :extra_body, Stigg::Internal::Type::HashOf[Stigg::Internal::Type::Unknown]
55
+
56
+ # @!attribute max_retries
57
+ # Maximum number of retries to attempt after a failed initial request.
58
+ #
59
+ # @return [Integer, nil]
60
+ optional :max_retries, Integer
61
+
62
+ # @!attribute timeout
63
+ # Request timeout in seconds.
64
+ #
65
+ # @return [Float, nil]
66
+ optional :timeout, Float
67
+
68
+ # @!method initialize(values = {})
69
+ # Returns a new instance of RequestOptions.
70
+ #
71
+ # @param values [Hash{Symbol=>Object}]
72
+
73
+ define_sorbet_constant!(:OrHash) do
74
+ T.type_alias { T.any(Stigg::RequestOptions, Stigg::Internal::AnyHash) }
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Resources
5
+ class V1
6
+ class Coupons
7
+ # Create a new Coupon
8
+ #
9
+ # @overload create(id:, amounts_off:, description:, duration_in_months:, name:, percent_off:, additional_meta_data: nil, request_options: {})
10
+ #
11
+ # @param id [String] The unique identifier for the entity
12
+ #
13
+ # @param amounts_off [Array<Stigg::Models::V1::CouponCreateParams::AmountsOff>, nil] Fixed amount discounts in different currencies
14
+ #
15
+ # @param description [String, nil] Description of the coupon
16
+ #
17
+ # @param duration_in_months [Integer, nil] Duration of the coupon validity in months
18
+ #
19
+ # @param name [String] Name of the coupon
20
+ #
21
+ # @param percent_off [Float, nil] Percentage discount off the original price
22
+ #
23
+ # @param additional_meta_data [Object] Metadata associated with the entity
24
+ #
25
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
26
+ #
27
+ # @return [Stigg::Models::V1::CouponCreateResponse]
28
+ #
29
+ # @see Stigg::Models::V1::CouponCreateParams
30
+ def create(params)
31
+ parsed, options = Stigg::V1::CouponCreateParams.dump_request(params)
32
+ @client.request(
33
+ method: :post,
34
+ path: "api/v1/coupons",
35
+ body: parsed,
36
+ model: Stigg::Models::V1::CouponCreateResponse,
37
+ options: options
38
+ )
39
+ end
40
+
41
+ # Get a single Coupon by id
42
+ #
43
+ # @overload retrieve(id, request_options: {})
44
+ #
45
+ # @param id [String]
46
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
47
+ #
48
+ # @return [Stigg::Models::V1::CouponRetrieveResponse]
49
+ #
50
+ # @see Stigg::Models::V1::CouponRetrieveParams
51
+ def retrieve(id, params = {})
52
+ @client.request(
53
+ method: :get,
54
+ path: ["api/v1/coupons/%1$s", id],
55
+ model: Stigg::Models::V1::CouponRetrieveResponse,
56
+ options: params[:request_options]
57
+ )
58
+ end
59
+
60
+ # Get a list of Coupons
61
+ #
62
+ # @overload list(ending_before: nil, limit: nil, starting_after: nil, request_options: {})
63
+ #
64
+ # @param ending_before [String] Ending before this UUID for pagination
65
+ #
66
+ # @param limit [Integer] Items per page
67
+ #
68
+ # @param starting_after [String] Starting after this UUID for pagination
69
+ #
70
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
71
+ #
72
+ # @return [Stigg::Models::V1::CouponListResponse]
73
+ #
74
+ # @see Stigg::Models::V1::CouponListParams
75
+ def list(params = {})
76
+ parsed, options = Stigg::V1::CouponListParams.dump_request(params)
77
+ @client.request(
78
+ method: :get,
79
+ path: "api/v1/coupons",
80
+ query: parsed.transform_keys(ending_before: "endingBefore", starting_after: "startingAfter"),
81
+ model: Stigg::Models::V1::CouponListResponse,
82
+ options: options
83
+ )
84
+ end
85
+
86
+ # @api private
87
+ #
88
+ # @param client [Stigg::Client]
89
+ def initialize(client:)
90
+ @client = client
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Resources
5
+ class V1
6
+ class Customers
7
+ class PaymentMethod
8
+ # Perform payment-method attachment on a Customer
9
+ #
10
+ # @overload attach(id, integration_id:, payment_method_id:, vendor_identifier:, billing_currency: nil, request_options: {})
11
+ #
12
+ # @param id [String]
13
+ #
14
+ # @param integration_id [String] Integration details
15
+ #
16
+ # @param payment_method_id [String] Billing provider payment method id
17
+ #
18
+ # @param vendor_identifier [Symbol, Stigg::Models::V1::Customers::PaymentMethodAttachParams::VendorIdentifier] The vendor identifier of integration
19
+ #
20
+ # @param billing_currency [Symbol, Stigg::Models::V1::Customers::PaymentMethodAttachParams::BillingCurrency, nil]
21
+ #
22
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
23
+ #
24
+ # @return [Stigg::Models::V1::CustomerResponse]
25
+ #
26
+ # @see Stigg::Models::V1::Customers::PaymentMethodAttachParams
27
+ def attach(id, params)
28
+ parsed, options = Stigg::V1::Customers::PaymentMethodAttachParams.dump_request(params)
29
+ @client.request(
30
+ method: :post,
31
+ path: ["api/v1/customers/%1$s/payment-method", id],
32
+ body: parsed,
33
+ model: Stigg::V1::CustomerResponse,
34
+ options: options
35
+ )
36
+ end
37
+
38
+ # Perform payment-method detachment on a Customer
39
+ #
40
+ # @overload detach(id, request_options: {})
41
+ #
42
+ # @param id [String]
43
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
44
+ #
45
+ # @return [Stigg::Models::V1::CustomerResponse]
46
+ #
47
+ # @see Stigg::Models::V1::Customers::PaymentMethodDetachParams
48
+ def detach(id, params = {})
49
+ @client.request(
50
+ method: :delete,
51
+ path: ["api/v1/customers/%1$s/payment-method", id],
52
+ model: Stigg::V1::CustomerResponse,
53
+ options: params[:request_options]
54
+ )
55
+ end
56
+
57
+ # @api private
58
+ #
59
+ # @param client [Stigg::Client]
60
+ def initialize(client:)
61
+ @client = client
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Resources
5
+ class V1
6
+ class Customers
7
+ class Promotional
8
+ # Create a new Promotional Entitlements
9
+ #
10
+ # @overload create(customer_id, promotional_entitlements:, request_options: {})
11
+ #
12
+ # @param customer_id [String] The unique identifier of the entitlement customer
13
+ #
14
+ # @param promotional_entitlements [Array<Stigg::Models::V1::Customers::PromotionalCreateParams::PromotionalEntitlement>] Promotional entitlements to grant
15
+ #
16
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
17
+ #
18
+ # @return [Stigg::Models::V1::Customers::PromotionalCreateResponse]
19
+ #
20
+ # @see Stigg::Models::V1::Customers::PromotionalCreateParams
21
+ def create(customer_id, params)
22
+ parsed, options = Stigg::V1::Customers::PromotionalCreateParams.dump_request(params)
23
+ @client.request(
24
+ method: :post,
25
+ path: ["api/v1/customers/%1$s/promotional", customer_id],
26
+ body: parsed,
27
+ model: Stigg::Models::V1::Customers::PromotionalCreateResponse,
28
+ options: options
29
+ )
30
+ end
31
+
32
+ # Perform revocation on a Promotional Entitlement
33
+ #
34
+ # @overload revoke(feature_id, customer_id:, request_options: {})
35
+ #
36
+ # @param feature_id [String] The unique identifier of the entitlement feature
37
+ #
38
+ # @param customer_id [String] The unique identifier of the entitlement customer
39
+ #
40
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
41
+ #
42
+ # @return [Stigg::Models::V1::Customers::PromotionalRevokeResponse]
43
+ #
44
+ # @see Stigg::Models::V1::Customers::PromotionalRevokeParams
45
+ def revoke(feature_id, params)
46
+ parsed, options = Stigg::V1::Customers::PromotionalRevokeParams.dump_request(params)
47
+ customer_id =
48
+ parsed.delete(:customer_id) do
49
+ raise ArgumentError.new("missing required path argument #{_1}")
50
+ end
51
+ @client.request(
52
+ method: :delete,
53
+ path: ["api/v1/customers/%1$s/promotional/featureId/%2$s", customer_id, feature_id],
54
+ model: Stigg::Models::V1::Customers::PromotionalRevokeResponse,
55
+ options: options
56
+ )
57
+ end
58
+
59
+ # @api private
60
+ #
61
+ # @param client [Stigg::Client]
62
+ def initialize(client:)
63
+ @client = client
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end