bunny_app 1.24.0 → 1.26.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.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/bunny_app/client.rb +5 -1
- data/lib/bunny_app/portal_session.rb +20 -0
- data/lib/bunny_app/version.rb +1 -1
- data/lib/bunny_app.rb +1 -0
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c4a0f74a46c3e5505608ea9389c134bd7e3a8a0fa6393fe897c3eda833bef8d3
         | 
| 4 | 
            +
              data.tar.gz: a341f3d6e05c48d8bb56b153a3a15249203278dda2f9e21e32070129837d9b79
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d2a1c374be36a3bc46afd029156b9cfcc037a3ce0bba6118649d5355427ea26704c90e1cc2df66221ec6dabde86bb059b2c0346897dead83da3954fe624c9c95
         | 
| 7 | 
            +
              data.tar.gz: 59552af3c0b3b70e6be6f666f8ebf6ba2e80c854230ee5fcdfdfce3ff6cbaf3772443d5ac9b27947585d434e1d4b4fb9a1d39f044f58eb4967db492d9fc267e4
         | 
    
        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.
         | 
    
        data/lib/bunny_app/client.rb
    CHANGED
    
    | @@ -58,7 +58,11 @@ module BunnyApp | |
| 58 58 |  | 
| 59 59 | 
             
                  case res.code.to_s
         | 
| 60 60 | 
             
                  when /2[0-9][0-9]/ # HTTP 2xx
         | 
| 61 | 
            -
                    JSON.parse(res.body)
         | 
| 61 | 
            +
                    response_body = JSON.parse(res.body)
         | 
| 62 | 
            +
                    raise ResponseError, response_body['errors'] if response_body['errors']
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                    response_body
         | 
| 65 | 
            +
             | 
| 62 66 | 
             
                  when /401/ # Access Token Expired
         | 
| 63 67 | 
             
                    raise AuthorizationError, 'Invalid access token' unless BunnyApp.retryable
         | 
| 64 68 | 
             
                    raise AuthorizationError, 'Invalid api credentials' if retries >= 1
         | 
| @@ -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
         | 
    
        data/lib/bunny_app/version.rb
    CHANGED
    
    
    
        data/lib/bunny_app.rb
    CHANGED
    
    
    
        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. | 
| 4 | 
            +
              version: 1.26.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- | 
| 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
         |