bunny_app 2.1.0 → 2.2.1

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: 713f2dd54e42a46e2bde441a09420de5e685a00f35f0683d156a0bc25e53b1a5
4
- data.tar.gz: adf590d8fe14df2b06399e3d1c55e1dfe3866956f5e9ce8f3596e6f451ac6637
3
+ metadata.gz: a451c27fb58140099b53c1c9985f85b0ab4a55b57f0ad96af05da34532e60ac7
4
+ data.tar.gz: 36a6c657382727881bf2a09e2d00e280c88d7dce22f673422ffc5f27567c8d2c
5
5
  SHA512:
6
- metadata.gz: 31fd8695d7c7b5215ecfc7420304d5a8430c95a9880dab644cf421dc0e1efa5c9c929960c6510c58efb0a6a484b78b7fbd506baba50098245e505955c642fd4e
7
- data.tar.gz: 9167b52dd6dea36438f5c05aa93de5cc554918b5baa43517c59ca213fb5bca61670d9ad1ab982832ae8c7c26e6b1e1d8d0c8e123ec99bbefdf32c95cc7f029e6
6
+ metadata.gz: b2b7d1ba642c751efe60d675bef3041c504141086647c8a40a9f1fbdf6961efb37e4d9a83d641694e665ea8f9a65c0346b54214ca0c8e7ce2b5a610599d1665e
7
+ data.tar.gz: 4f43bbd3c43e7b7fc3ffe52c71de05496b72d1ec04fcc73768901eeb57f257564813eed73d2bf429bea4ffe3dd1bc2b312a521ba9c1e047c4a4367c750a812ea
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
 
@@ -164,3 +164,19 @@ Set IGNORE_SSL when running locally to ignore ssl warnings.
164
164
  ```sh
165
165
  > IGNORE_SSL=true bin/console
166
166
  ```
167
+
168
+ ## Publish to Ruby gems
169
+
170
+ Update `version.rb` with a new version number then build the gem
171
+
172
+ ```sh
173
+ gem build
174
+ ```
175
+
176
+ Then publish using the new build number
177
+
178
+ ```sh
179
+ gem push bunny_app-x.x.x.gem
180
+ ```
181
+
182
+ The rubygems account for publishing is protected by MFA and currently managed by @richet
@@ -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 = {
@@ -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,12 +21,12 @@ 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
 
@@ -1,12 +1,12 @@
1
1
  module BunnyApp
2
2
  class PortalSession
3
- @portal_session_create_mutation = <<-'GRAPHQL'
4
- mutation portalSessionCreate ($tenantCode: String!) {
5
- portalSessionCreate (tenantCode: $tenantCode) {
6
- token
7
- errors
3
+ @portal_session_create_mutation = <<-GRAPHQL
4
+ mutation portalSessionCreate ($tenantCode: String!, $returnUrl: String!) {
5
+ portalSessionCreate (tenantCode: $tenantCode, returnUrl: $returnUrl) {
6
+ token
7
+ errors
8
+ }
8
9
  }
9
- }
10
10
  GRAPHQL
11
11
 
12
12
  def self.create(tenant_code:, expiry_hours: 24, return_url: nil)
@@ -0,0 +1,26 @@
1
+ module BunnyApp
2
+ class TenantMetrics
3
+ @tenant_metrics_update_mutation = <<-'GRAPHQL'
4
+ mutation tenantMetricsUpdate ($code: String!, $attributes: TenantMetricsAttributes!) {
5
+ tenantMetricsUpdate (code: $code, attributes: $attributes) {
6
+ errors
7
+ }
8
+ }
9
+ GRAPHQL
10
+
11
+ def self.update(code:, last_login:, user_count:, utilization_metrics: {})
12
+ variables = {
13
+ code:,
14
+ attributes: {
15
+ lastLogin: last_login,
16
+ userCount: user_count,
17
+ utilizationMetrics: utilization_metrics
18
+ }
19
+ }
20
+
21
+ Client.new.query(@tenant_metrics_update_mutation, variables)
22
+
23
+ true
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BunnyApp
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.1'
5
5
  end
data/lib/bunny_app.rb CHANGED
@@ -7,6 +7,7 @@ require 'bunny_app/tenant'
7
7
  require 'bunny_app/subscription'
8
8
  require 'bunny_app/webhook'
9
9
  require 'bunny_app/portal_session'
10
+ require 'bunny_app/tenant_metrics'
10
11
 
11
12
  module BunnyApp
12
13
  class << self
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.1.0
4
+ version: 2.2.1
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: 2024-01-16 00:00:00.000000000 Z
12
+ date: 2024-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -144,6 +144,7 @@ files:
144
144
  - lib/bunny_app/portal_session.rb
145
145
  - lib/bunny_app/subscription.rb
146
146
  - lib/bunny_app/tenant.rb
147
+ - lib/bunny_app/tenant_metrics.rb
147
148
  - lib/bunny_app/version.rb
148
149
  - lib/bunny_app/webhook.rb
149
150
  - lib/generators/bunny_app/install_generator.rb