bunny_app 1.25.0 → 1.28.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: '019de290c7ea498f815013ec4361ed8d6f6b4282df2a569efbe2115d38767e1e'
4
- data.tar.gz: 53307b39bff195f94f016c5df7a7450be01dc81ce35d49e68a44fd9ad623f0b6
3
+ metadata.gz: 7c77683e4ecd747af7b3ba4d99b748daa52b201e715024a2962dde274d582757
4
+ data.tar.gz: 82c6c503f29bea682bb4e5259ec903f929d97d28e427ff01c7efcf5547b6c657
5
5
  SHA512:
6
- metadata.gz: 882dd75a55c66339e07d1cd5ad7cd35812ccd691be9930358e26700c67d441b096353bfb7b2baa274590086449da6efcc274d540a4d60a389204c6e2574c8d33
7
- data.tar.gz: 4c6021936e7628efb492179b0c4da2b24ae1b3606280b8627ddfc4ee496d4ae0189b291e05f56b799adc086996e915bbf45f2f271f2c2272479fa25c15912d7d
6
+ metadata.gz: dc4090284779f66caf383539cd9ac12d906deec95618aa5175e9ff5e3e5d98249b98209b4d32a8c910478bc550493b3d099f9a1ad894215f34625289373ed764
7
+ data.tar.gz: 4dd2c033e29ec4f1f9f7381048ff0fb13a0a7846a06ca54b0d4ba7c74246d96deb600d6b0e7f0778ed0f067b59d15209a0c084f9cf2ebbc4923336e66a32dc06
data/README.md CHANGED
@@ -75,6 +75,14 @@ response = BunnyApp::Subscription.create(
75
75
  )
76
76
  ```
77
77
 
78
+ ### Get a portal session token for use with Bunny.js
79
+
80
+ ```ruby
81
+ response = BunnyApp::PortalSession.create(
82
+ tenant_code: "123456"
83
+ )
84
+ ```
85
+
78
86
  ### Track feature usage
79
87
 
80
88
  If you have usage based billing or just want to track feature usage then use this method.
@@ -19,6 +19,8 @@ module BunnyApp
19
19
  'Content-Type' => 'application/json',
20
20
  'Authorization' => "Bearer #{BunnyApp.access_token}"
21
21
  }
22
+
23
+ @headers['Host'] = host_header unless host_header.nil?
22
24
  end
23
25
 
24
26
  def fetch_access_token
@@ -89,5 +91,9 @@ module BunnyApp
89
91
  def verify_ssl
90
92
  return true unless ENV['IGNORE_SSL']
91
93
  end
94
+
95
+ def host_header
96
+ ENV.fetch('BUNNY_HOST_HEADER', nil)
97
+ end
92
98
  end
93
99
  end
@@ -0,0 +1,20 @@
1
+ module BunnyApp
2
+ class PortalSession
3
+ @portal_session_create_mutation = <<-'GRAPHQL'
4
+ mutation portalSessionCreate ($tenantCode: String!) {
5
+ portalSessionCreate (tenantCode: $tenantCode) {
6
+ token
7
+ errors
8
+ }
9
+ }
10
+ GRAPHQL
11
+
12
+ def self.create(tenant_code:)
13
+ variables = {
14
+ tenantCode: tenant_code
15
+ }
16
+
17
+ Client.new.query(@portal_session_create_mutation, variables)
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BunnyApp
4
- VERSION = '1.25.0'
4
+ VERSION = '1.28.0'
5
5
  end
data/lib/bunny_app.rb CHANGED
@@ -6,6 +6,7 @@ require 'bunny_app/platform'
6
6
  require 'bunny_app/tenant'
7
7
  require 'bunny_app/subscription'
8
8
  require 'bunny_app/webhook'
9
+ require 'bunny_app/portal_session'
9
10
 
10
11
  module BunnyApp
11
12
  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: 1.25.0
4
+ version: 1.28.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-01-16 00:00:00.000000000 Z
12
+ date: 2023-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -140,6 +140,7 @@ files:
140
140
  - lib/bunny_app/client.rb
141
141
  - lib/bunny_app/errors.rb
142
142
  - lib/bunny_app/platform.rb
143
+ - lib/bunny_app/portal_session.rb
143
144
  - lib/bunny_app/subscription.rb
144
145
  - lib/bunny_app/tenant.rb
145
146
  - lib/bunny_app/usage.rb