bunny_app 2.0.4 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0679df10d54f538c211fe1ed824c1b537d859f009ceb9131f2bb8165e14ebd8
4
- data.tar.gz: 40ebd43e2d84bd49d9f4c224dad09d48d6a5ba07b8a6c5a67d97d1ae27db0a66
3
+ metadata.gz: df32cc341007dd7b79cd16df32165f963b8b2c564aec339b40263722379d8db8
4
+ data.tar.gz: af8134359490b8032fa3c8e358b49b0fd341132c89dab08ac3c2b81b4b99fd41
5
5
  SHA512:
6
- metadata.gz: f573c0bcb3569634e4cf14590bef2bf54d9630a4425392a11a1c12b3046c182a78bb4284410645d14866ce4bfa683eaf4eb41a92fca2ecc130d1a071dd58c185
7
- data.tar.gz: dd07c19832a5e5e81f9c4e562de088560e175214e41f2ed3bc09ac583336249fab5a3f4fc9da3d87a147df41ecb7246f5ac4f3888e5a130d9a36f62ffcfc10db
6
+ metadata.gz: 3d718112141ebe74e575d77f49c8b9ac6d32d2bf561585ffd9e8d574c963a09bbba4567268d33c3e8bd2a186135e08b7af612a52b49f432c78f8bdd5d19f1bbd
7
+ data.tar.gz: d028771adc4bfd0924147fcc308bdcad1397c80acb7bca6cb2cead0fc0be7df5227f657c8308cf7fcd6f65a54a1a64518d35d925ad22b4ef80debf88d7c81630
data/README.md CHANGED
@@ -4,10 +4,10 @@ Ruby SDK for Bunny
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Run `bundle add bunny_app` or add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'bunnyapp'
10
+ gem 'bunny_app'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -19,7 +19,7 @@ $ bundle
19
19
  Or install it yourself as:
20
20
 
21
21
  ```sh
22
- $ gem install bunnyapp
22
+ $ gem install bunny_app
23
23
  ```
24
24
 
25
25
  ## Getting Started
@@ -153,9 +153,9 @@ This gem requires Ruby 2.5+
153
153
 
154
154
  ## Development
155
155
 
156
- Run `bin/setup` to install dependencies.
156
+ Run `bundle install` to install dependencies.
157
157
 
158
- Run `rake spec` to run the tests.
158
+ Run `bundle exec rake spec` to run the tests.
159
159
 
160
160
  You can also run `bin/console` for an interactive prompt that will allow you to experiment.
161
161
 
@@ -12,6 +12,7 @@ module BunnyApp
12
12
  def initialize
13
13
  self.class.base_uri BunnyApp.base_uri
14
14
  self.class.default_options.update(verify: verify_ssl)
15
+ self.class.default_timeout 3 # seconds
15
16
 
16
17
  BunnyApp.access_token ||= fetch_access_token
17
18
  @headers = {
@@ -92,7 +93,7 @@ module BunnyApp
92
93
  end
93
94
 
94
95
  def verify_ssl
95
- return true unless ENV['IGNORE_SSL']
96
+ true unless ENV['IGNORE_SSL']
96
97
  end
97
98
 
98
99
  def host_header
@@ -1,6 +1,6 @@
1
1
  module BunnyApp
2
2
  class FeatureUsage
3
- @feature_usage_create_mutation = <<-'GRAPHQL'
3
+ @feature_usage_create_mutation = <<-GRAPHQL
4
4
  mutation featureUsageCreate ($attributes: FeatureUsageAttributes!) {
5
5
  featureUsageCreate (attributes: $attributes) {
6
6
  errors
@@ -8,10 +8,8 @@ module BunnyApp
8
8
  id
9
9
  quantity
10
10
  usageAt
11
- tenant {
11
+ subscription {
12
12
  id
13
- code
14
- name
15
13
  }
16
14
  feature {
17
15
  id
@@ -23,18 +21,20 @@ module BunnyApp
23
21
  }
24
22
  GRAPHQL
25
23
 
26
- def self.create(quantity:, feature_code:, tenant_code:, usage_at: nil)
24
+ def self.create(quantity:, feature_code:, subscription_id:, usage_at: nil)
27
25
  variables = {
28
26
  attributes: {
29
27
  quantity:,
30
28
  featureCode: feature_code,
31
- tenantCode: tenant_code
29
+ subscriptionId: subscription_id
32
30
  }
33
31
  }
34
32
 
35
33
  variables[:attributes][:usageAt] = usage_at unless usage_at.nil?
36
34
 
37
35
  res = Client.new.query(@feature_usage_create_mutation, variables)
36
+ raise ResponseError, res['data']['featureUsageCreate']['errors'].join(',') if res['data']['featureUsageCreate']['errors']
37
+
38
38
  res['data']['featureUsageCreate']['featureUsage']
39
39
  end
40
40
  end
@@ -22,6 +22,8 @@ module BunnyApp
22
22
  }
23
23
 
24
24
  res = Client.new.query(@platform_create_mutation, variables)
25
+ raise ResponseError, res['data']['platformCreate']['errors'].join(',') if res['data']['platformCreate']['errors']
26
+
25
27
  res['data']['platformCreate']['platform']
26
28
  end
27
29
  end
@@ -17,6 +17,8 @@ module BunnyApp
17
17
  }
18
18
 
19
19
  res = Client.new.query(@portal_session_create_mutation, variables)
20
+ raise ResponseError, res['data']['portalSessionCreate']['errors'].join(',') if res['data']['portalSessionCreate']['errors']
21
+
20
22
  res['data']['portalSessionCreate']['token']
21
23
  end
22
24
  end
@@ -1,6 +1,6 @@
1
1
  module BunnyApp
2
2
  class Subscription
3
- @subscription_create_mutation = <<-'GRAPHQL'
3
+ @subscription_create_mutation = <<-GRAPHQL
4
4
  mutation subscriptionCreate ($attributes: SubscriptionAttributes!) {
5
5
  subscriptionCreate (attributes: $attributes) {
6
6
  subscription {
@@ -39,7 +39,7 @@ module BunnyApp
39
39
  }
40
40
  GRAPHQL
41
41
 
42
- @subscription_cancel_mutation = <<-'GRAPHQL'
42
+ @subscription_cancel_mutation = <<-GRAPHQL
43
43
  mutation subscriptionCancel ($ids: [ID!]!) {
44
44
  subscriptionCancel (ids: $ids) {
45
45
  errors
@@ -78,6 +78,8 @@ module BunnyApp
78
78
  end
79
79
 
80
80
  res = Client.new.query(@subscription_create_mutation, variables)
81
+ raise ResponseError, res['data']['subscriptionCreate']['errors'].join(',') if res['data']['subscriptionCreate']['errors']
82
+
81
83
  res['data']['subscriptionCreate']['subscription']
82
84
  end
83
85
 
@@ -86,7 +88,8 @@ module BunnyApp
86
88
  ids: [subscription_id]
87
89
  }
88
90
 
89
- Client.new.query(@subscription_cancel_mutation, variables)
91
+ res = Client.new.query(@subscription_cancel_mutation, variables)
92
+ raise ResponseError, res['data']['subscriptionCancel']['errors'].join(',') if res['data']['subscriptionCancel']['errors']
90
93
 
91
94
  true
92
95
  end
@@ -52,6 +52,8 @@ module BunnyApp
52
52
  }
53
53
 
54
54
  res = Client.new.query(@tenant_create_mutation, variables)
55
+ raise ResponseError, res['data']['tenantCreate']['errors'].join(',') if res['data']['tenantCreate']['errors']
56
+
55
57
  res['data']['tenantCreate']['tenant']
56
58
  end
57
59
 
@@ -61,6 +63,7 @@ module BunnyApp
61
63
  }
62
64
 
63
65
  res = Client.new.query(@tenant_query, variables)
66
+
64
67
  res['data']['tenant']
65
68
  end
66
69
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BunnyApp
4
- VERSION = '2.0.4'
4
+ VERSION = '2.2.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunny_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bunny
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-12-18 00:00:00.000000000 Z
12
+ date: 2024-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty