stigg-api-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,608 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Fragment
5
+ PlanFragment = <<~GRAPHQL
6
+ fragment PlanFragment on Plan {
7
+ id: refId
8
+ displayName
9
+ description
10
+ metadata: additionalMetaData
11
+ product {
12
+ id: refId
13
+ displayName
14
+ description
15
+ }
16
+ basePlan {
17
+ id: refId
18
+ displayName
19
+ }
20
+ entitlements {
21
+ ...PackageEntitlementFragment
22
+ }
23
+ inheritedEntitlements {
24
+ ...PackageEntitlementFragment
25
+ }
26
+ compatibleAddons {
27
+ ...AddonFragment
28
+ }
29
+ prices {
30
+ ...PriceFragment
31
+ }
32
+ pricingType
33
+ defaultTrialConfig {
34
+ duration
35
+ units
36
+ }
37
+ }
38
+ GRAPHQL
39
+
40
+ TotalPriceFragment = <<~GRAPHQL
41
+ fragment TotalPriceFragment on CustomerSubscriptionTotalPrice {
42
+ subTotal {
43
+ amount
44
+ currency
45
+ }
46
+ total {
47
+ amount
48
+ currency
49
+ }
50
+ }
51
+ GRAPHQL
52
+
53
+ PriceFragment = <<~GRAPHQL
54
+ fragment PriceFragment on Price {
55
+ billingModel
56
+ billingPeriod
57
+ price {
58
+ amount
59
+ currency
60
+ }
61
+ feature {
62
+ ...FeatureFragment
63
+ }
64
+ }
65
+ GRAPHQL
66
+
67
+ PackageEntitlementFragment = <<~GRAPHQL
68
+ fragment PackageEntitlementFragment on PackageEntitlement {
69
+ usageLimit
70
+ hasUnlimitedUsage
71
+ featureId
72
+ resetPeriod
73
+ feature {
74
+ ...FeatureFragment
75
+ }
76
+ }
77
+ GRAPHQL
78
+
79
+ AddonFragment = <<~GRAPHQL
80
+ fragment AddonFragment on Addon {
81
+ id: refId
82
+ displayName
83
+ description
84
+ metadata: additionalMetaData
85
+ entitlements {
86
+ ...PackageEntitlementFragment
87
+ }
88
+ pricingType
89
+ }
90
+ GRAPHQL
91
+
92
+ SubscriptionFragment = <<~GRAPHQL
93
+ fragment SubscriptionFragment on CustomerSubscription {
94
+ id: refId
95
+ status
96
+ startDate
97
+ endDate
98
+ trialEndDate
99
+ cancellationDate
100
+ effectiveEndDate
101
+ currentBillingPeriodEnd
102
+ metadata: additionalMetaData
103
+ billingId
104
+ billingLinkUrl
105
+ prices {
106
+ usageLimit
107
+ price {
108
+ ...PriceFragment
109
+ }
110
+ }
111
+ totalPrice {
112
+ ...TotalPriceFragment
113
+ }
114
+ pricingType
115
+ plan {
116
+ ...PlanFragment
117
+ }
118
+ addons {
119
+ id
120
+ quantity
121
+ addon {
122
+ ...AddonFragment
123
+ }
124
+ }
125
+ }
126
+ GRAPHQL
127
+
128
+ PromotionalEntitlementFragment = <<~GRAPHQL
129
+ fragment PromotionalEntitlementFragment on PromotionalEntitlement {
130
+ status
131
+ usageLimit
132
+ featureId
133
+ hasUnlimitedUsage
134
+ resetPeriod
135
+ endDate
136
+ isVisible
137
+ feature {
138
+ ...FeatureFragment
139
+ }
140
+ }
141
+ GRAPHQL
142
+
143
+ CouponFragment = <<~GRAPHQL
144
+ fragment CouponFragment on Coupon {
145
+ id: refId
146
+ name
147
+ description
148
+ type
149
+ discountValue
150
+ metadata: additionalMetaData
151
+ createdAt
152
+ updatedAt
153
+ billingId
154
+ billingLinkUrl
155
+ status
156
+ }
157
+ GRAPHQL
158
+
159
+ CustomerFragment = <<~GRAPHQL
160
+ fragment CustomerFragment on Customer {
161
+ id: refId
162
+ name
163
+ email
164
+ createdAt
165
+ updatedAt
166
+ subscriptions {
167
+ ...SubscriptionFragment
168
+ }
169
+ promotionalEntitlements {
170
+ ...PromotionalEntitlementFragment
171
+ }
172
+ hasPaymentMethod
173
+ coupon {
174
+ ...CouponFragment
175
+ }
176
+ billingId
177
+ metadata: additionalMetaData
178
+ }
179
+ GRAPHQL
180
+
181
+ SlimSubscriptionFragment = <<~GRAPHQL
182
+ fragment SlimSubscriptionFragment on CustomerSubscription {
183
+ id: refId
184
+ status
185
+ metadata: additionalMetaData
186
+ billingId
187
+ billingLinkUrl
188
+ effectiveEndDate
189
+ currentBillingPeriodEnd
190
+ pricingType
191
+ prices {
192
+ usageLimit
193
+ price {
194
+ ...PriceFragment
195
+ }
196
+ }
197
+ totalPrice {
198
+ ...TotalPriceFragment
199
+ }
200
+ plan {
201
+ id: refId
202
+ }
203
+ addons {
204
+ quantity
205
+ addon {
206
+ id: refId
207
+ }
208
+ }
209
+ customer {
210
+ id: refId
211
+ }
212
+ }
213
+ GRAPHQL
214
+
215
+ PaywallPlanFragment = <<~GRAPHQL
216
+ fragment PaywallPlanFragment on Plan {
217
+ id: refId
218
+ description
219
+ displayName
220
+ product {
221
+ id: refId
222
+ displayName
223
+ description
224
+ }
225
+ basePlan {
226
+ id: refId
227
+ displayName
228
+ }
229
+ entitlements {
230
+ ...PaywallPackageEntitlementFragment
231
+ }
232
+ metadata: additionalMetaData
233
+ inheritedEntitlements {
234
+ ...PaywallPackageEntitlementFragment
235
+ }
236
+ prices {
237
+ ...PaywallPriceFragment
238
+ }
239
+ pricingType
240
+ defaultTrialConfig {
241
+ duration
242
+ units
243
+ }
244
+ compatibleAddons {
245
+ ...PaywallAddonFragment
246
+ }
247
+ }
248
+ GRAPHQL
249
+
250
+ FeatureFragment = <<~GRAPHQL
251
+ fragment FeatureFragment on Feature {
252
+ id: refId
253
+ featureType
254
+ meterType
255
+ featureUnits
256
+ featureUnitsPlural
257
+ displayName
258
+ description
259
+ }
260
+ GRAPHQL
261
+
262
+ EntitlementFeatureFragment = <<~GRAPHQL
263
+ fragment EntitlementFeatureFragment on EntitlementFeature {
264
+ id: refId
265
+ featureType
266
+ meterType
267
+ featureUnits
268
+ featureUnitsPlural
269
+ displayName
270
+ description
271
+ }
272
+ GRAPHQL
273
+
274
+ PaywallPackageEntitlementFragment = <<~GRAPHQL
275
+ fragment PaywallPackageEntitlementFragment on PackageEntitlement {
276
+ usageLimit
277
+ hasUnlimitedUsage
278
+ featureId
279
+ resetPeriod
280
+ feature {
281
+ ...FeatureFragment
282
+ }
283
+ }
284
+ GRAPHQL
285
+
286
+ PaywallPriceFragment = <<~GRAPHQL
287
+ fragment PaywallPriceFragment on Price {
288
+ billingModel
289
+ billingPeriod
290
+ price {
291
+ amount
292
+ currency
293
+ }
294
+ feature {
295
+ ...FeatureFragment
296
+ }
297
+ }
298
+ GRAPHQL
299
+
300
+ PaywallAddonFragment = <<~GRAPHQL
301
+ fragment PaywallAddonFragment on Addon {
302
+ id: refId
303
+ displayName
304
+ description
305
+ entitlements {
306
+ ...PaywallPackageEntitlementFragment
307
+ }
308
+ prices {
309
+ ...PaywallPriceFragment
310
+ }
311
+ metadata: additionalMetaData
312
+ pricingType
313
+ }
314
+ GRAPHQL
315
+
316
+ SubscriptionPreviewFragment = <<~GRAPHQL
317
+ fragment SubscriptionPreviewFragment on SubscriptionPreview {
318
+ subTotal {
319
+ amount
320
+ currency
321
+ }
322
+ total {
323
+ amount
324
+ currency
325
+ }
326
+ billingPeriodRange {
327
+ start
328
+ end
329
+ }
330
+ proration {
331
+ prorationDate
332
+ credit {
333
+ amount
334
+ currency
335
+ }
336
+ debit {
337
+ amount
338
+ currency
339
+ }
340
+ }
341
+ }
342
+ GRAPHQL
343
+
344
+ EntitlementFragment = <<~GRAPHQL
345
+ fragment EntitlementFragment on Entitlement {
346
+ isGranted
347
+ accessDeniedReason
348
+ customerId
349
+ usageLimit
350
+ hasUnlimitedUsage
351
+ currentUsage
352
+ requestedUsage
353
+ nextResetDate
354
+ resetPeriod
355
+ feature {
356
+ ...EntitlementFeatureFragment
357
+ }
358
+ resetPeriodConfiguration {
359
+ ... on MonthlyResetPeriodConfig {
360
+ monthlyAccordingTo
361
+ }
362
+ ... on WeeklyResetPeriodConfig {
363
+ weeklyAccordingTo
364
+ }
365
+ }
366
+ }
367
+ GRAPHQL
368
+ end
369
+
370
+ module Mutation
371
+ CreateCustomer = <<~GRAPHQL
372
+ mutation ($input: CustomerInput!) {
373
+ createCustomer: createOneCustomer(input: $input) {
374
+ ...CustomerFragment
375
+ }
376
+ }
377
+ #{Fragment::CustomerFragment}
378
+ #{Fragment::SubscriptionFragment}
379
+ #{Fragment::PriceFragment}
380
+ #{Fragment::FeatureFragment}
381
+ #{Fragment::TotalPriceFragment}
382
+ #{Fragment::PlanFragment}
383
+ #{Fragment::PackageEntitlementFragment}
384
+ #{Fragment::AddonFragment}
385
+ #{Fragment::PromotionalEntitlementFragment}
386
+ #{Fragment::CouponFragment}
387
+ GRAPHQL
388
+
389
+ ProvisionCustomer = <<~GRAPHQL
390
+ mutation ($input: ProvisionCustomerInput!) {
391
+ provisionCustomer(input: $input) {
392
+ customer {
393
+ ...CustomerFragment
394
+ }
395
+ subscriptionStrategyDecision
396
+ subscription {
397
+ ...SlimSubscriptionFragment
398
+ }
399
+ }
400
+ }
401
+ #{Fragment::CustomerFragment}
402
+ #{Fragment::SubscriptionFragment}
403
+ #{Fragment::PriceFragment}
404
+ #{Fragment::FeatureFragment}
405
+ #{Fragment::TotalPriceFragment}
406
+ #{Fragment::PlanFragment}
407
+ #{Fragment::PackageEntitlementFragment}
408
+ #{Fragment::AddonFragment}
409
+ #{Fragment::PromotionalEntitlementFragment}
410
+ #{Fragment::CouponFragment}
411
+ #{Fragment::SlimSubscriptionFragment}
412
+ GRAPHQL
413
+
414
+ ImportCustomer = <<~GRAPHQL
415
+ mutation ($input: ImportCustomerInput!) {
416
+ importCustomer: importOneCustomer(input: $input) {
417
+ ...CustomerFragment
418
+ }
419
+ }
420
+ #{Fragment::CustomerFragment}
421
+ #{Fragment::SubscriptionFragment}
422
+ #{Fragment::PriceFragment}
423
+ #{Fragment::FeatureFragment}
424
+ #{Fragment::TotalPriceFragment}
425
+ #{Fragment::PlanFragment}
426
+ #{Fragment::PackageEntitlementFragment}
427
+ #{Fragment::AddonFragment}
428
+ #{Fragment::PromotionalEntitlementFragment}
429
+ #{Fragment::CouponFragment}
430
+ GRAPHQL
431
+
432
+ UpdateCustomer = <<~GRAPHQL
433
+ mutation ($input: UpdateCustomerInput!) {
434
+ updateCustomer: updateOneCustomer(input: $input) {
435
+ ...CustomerFragment
436
+ }
437
+ }
438
+ #{Fragment::CustomerFragment}
439
+ #{Fragment::SubscriptionFragment}
440
+ #{Fragment::PriceFragment}
441
+ #{Fragment::FeatureFragment}
442
+ #{Fragment::TotalPriceFragment}
443
+ #{Fragment::PlanFragment}
444
+ #{Fragment::PackageEntitlementFragment}
445
+ #{Fragment::AddonFragment}
446
+ #{Fragment::PromotionalEntitlementFragment}
447
+ #{Fragment::CouponFragment}
448
+ GRAPHQL
449
+
450
+ CreateSubscription = <<~GRAPHQL
451
+ mutation ($input: SubscriptionInput!) {
452
+ createSubscription(subscription: $input) {
453
+ ...SlimSubscriptionFragment
454
+ }
455
+ }
456
+ #{Fragment::SlimSubscriptionFragment}
457
+ #{Fragment::PriceFragment}
458
+ #{Fragment::FeatureFragment}
459
+ #{Fragment::TotalPriceFragment}
460
+ GRAPHQL
461
+
462
+ ProvisionSubscription = <<~GRAPHQL
463
+ mutation ($input: ProvisionSubscription!) {
464
+ provisionSubscription(input: $input) {
465
+ checkoutUrl
466
+ status
467
+ subscription {
468
+ ...SlimSubscriptionFragment
469
+ }
470
+ }
471
+ }
472
+ #{Fragment::SlimSubscriptionFragment}
473
+ #{Fragment::PriceFragment}
474
+ #{Fragment::FeatureFragment}
475
+ #{Fragment::TotalPriceFragment}
476
+ GRAPHQL
477
+
478
+ UpdateSubscription = <<~GRAPHQL
479
+ mutation ($input: UpdateSubscriptionInput!) {
480
+ updateSubscription: updateOneSubscription(input: $input) {
481
+ ...SlimSubscriptionFragment
482
+ }
483
+ }
484
+ #{Fragment::SlimSubscriptionFragment}
485
+ #{Fragment::PriceFragment}
486
+ #{Fragment::FeatureFragment}
487
+ #{Fragment::TotalPriceFragment}
488
+ GRAPHQL
489
+
490
+ CancelSubscription = <<~GRAPHQL
491
+ mutation ($input: SubscriptionCancellationInput!) {
492
+ cancelSubscription(input: $input) {
493
+ ...SlimSubscriptionFragment
494
+ }
495
+ }
496
+ #{Fragment::SlimSubscriptionFragment}
497
+ #{Fragment::PriceFragment}
498
+ #{Fragment::FeatureFragment}
499
+ #{Fragment::TotalPriceFragment}
500
+ GRAPHQL
501
+
502
+ InitiateCheckout = <<~GRAPHQL
503
+ mutation ($input: InitiateCheckoutInput!) {
504
+ initiateCheckout(input: $input) {
505
+ id
506
+ checkoutUrl
507
+ checkoutBillingId
508
+ }
509
+ }
510
+ GRAPHQL
511
+
512
+ EstimateSubscription = <<~GRAPHQL
513
+ mutation ($input: EstimateSubscriptionInput!) {
514
+ estimateSubscription(input: $input) {
515
+ ...SubscriptionPreviewFragment
516
+ }
517
+ }
518
+ #{Fragment::SubscriptionPreviewFragment}
519
+ GRAPHQL
520
+
521
+ EstimateSubscriptionUpdate = <<~GRAPHQL
522
+ mutation ($input: EstimateSubscriptionUpdateInput!) {
523
+ estimateSubscriptionUpdate(input: $input) {
524
+ ...SubscriptionPreviewFragment
525
+ }
526
+ }
527
+ #{Fragment::SubscriptionPreviewFragment}
528
+ GRAPHQL
529
+
530
+ ReportUsage = <<~GRAPHQL
531
+ mutation ($input: UsageMeasurementCreateInput!) {
532
+ createUsageMeasurement(usageMeasurement: $input) {
533
+ id
534
+ }
535
+ }
536
+ GRAPHQL
537
+ end
538
+
539
+ module Query
540
+ GetCustomerById = <<~GRAPHQL
541
+ query ($customerId: String) {
542
+ customers(filter: { refId: { eq: $customerId } }) {
543
+ edges {
544
+ node {
545
+ ...CustomerFragment
546
+ }
547
+ }
548
+ }
549
+ }
550
+ #{Fragment::CustomerFragment}
551
+ #{Fragment::SubscriptionFragment}
552
+ #{Fragment::PriceFragment}
553
+ #{Fragment::FeatureFragment}
554
+ #{Fragment::TotalPriceFragment}
555
+ #{Fragment::PlanFragment}
556
+ #{Fragment::PackageEntitlementFragment}
557
+ #{Fragment::AddonFragment}
558
+ #{Fragment::PromotionalEntitlementFragment}
559
+ #{Fragment::CouponFragment}
560
+ GRAPHQL
561
+
562
+ GetCoupons = <<~GRAPHQL
563
+ query {
564
+ coupons(filter: { status: { eq: ACTIVE } }, paging: { first: 50 }) {
565
+ edges {
566
+ node {
567
+ ...CouponFragment
568
+ }
569
+ }
570
+ }
571
+ }
572
+ #{Fragment::CouponFragment}
573
+ GRAPHQL
574
+
575
+ GetPaywall = <<~GRAPHQL
576
+ query ($input: GetPaywallInput!) {
577
+ getPaywall(input: $input) {
578
+ ...PaywallPlanFragment
579
+ }
580
+ }
581
+ #{Fragment::PaywallPlanFragment}
582
+ #{Fragment::PaywallPackageEntitlementFragment}
583
+ #{Fragment::FeatureFragment}
584
+ #{Fragment::PaywallPriceFragment}
585
+ #{Fragment::PaywallAddonFragment}
586
+ GRAPHQL
587
+
588
+ GetEntitlements = <<~GRAPHQL
589
+ query ($query: FetchEntitlementsQuery!) {
590
+ entitlements: cachedEntitlements(query: $query) {
591
+ ...EntitlementFragment
592
+ }
593
+ }
594
+ #{Fragment::EntitlementFragment}
595
+ #{Fragment::EntitlementFeatureFragment}
596
+ GRAPHQL
597
+
598
+ GetEntitlement = <<~GRAPHQL
599
+ query ($query: FetchEntitlementQuery!) {
600
+ entitlement(query: $query) {
601
+ ...EntitlementFragment
602
+ }
603
+ }
604
+ #{Fragment::EntitlementFragment}
605
+ #{Fragment::EntitlementFeatureFragment}
606
+ GRAPHQL
607
+ end
608
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ VERSION = "0.1.0"
5
+ end
data/lib/stigg.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "stigg/generated/operations"
4
+ require "stigg/version"
5
+ require "stigg/client"
data/package.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "@stigg/api-client-ruby",
3
+ "version": "0.0.1"
4
+ }
data/project.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "$schema": "../../node_modules/nx/schemas/project-schema.json"
3
+ }