webhook_recorder 0.1.1 → 0.1.2
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 +9 -1
 - data/lib/webhook_recorder/server.rb +11 -7
 - data/lib/webhook_recorder/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8b52dac69987e158793165b4e2f79dc717f4275b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 3f146964b5d2167c309b852a988009d274b8a0e2
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f34b50e2af54821947a4dd2eb18d65c67c6a9f1cc5230e68ffd71a2490fc5b0b8b46a81ba86643fcc8e91a168b0ec62cd97e3c0ba20aeb598e7dd6e2b5b200d4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0e014994d632414c5550bbbeb538f09867748a9223e08a06778fbdda00d3627b0a73efec1b15b6049faaf6d8451da6450df0fe309053b26a08abd06c82dd5d96
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -10,7 +10,7 @@ Read the intro blog post [here](http://siliconsenthil.in/blog/2017/04/02/so-you- 
     | 
|
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            ## Dependency
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            This uses [ngrok](https://ngrok.com) to publish URL that's accessible via internet.
         
     | 
| 
      
 13 
     | 
    
         
            +
            This uses [ngrok](https://ngrok.com) to publish URL that's accessible via internet. Ensure it'a available in `PATH`.
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            ## Installation
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
         @@ -52,6 +52,14 @@ it 'should respond as defined as response_config' do 
     | 
|
| 
       52 
52 
     | 
    
         
             
            end
         
     | 
| 
       53 
53 
     | 
    
         
             
            ```
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
      
 55 
     | 
    
         
            +
            * If you don't want to expose the stub server to internet and test only locally, you toggle the behavior with
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 58 
     | 
    
         
            +
              WebhookRecorder::Server.open(@port, response_config, false) do |server|
         
     | 
| 
      
 59 
     | 
    
         
            +
                # server.http_url and server.https_url will be nil
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
            ```
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
       55 
63 
     | 
    
         
             
            ## Development
         
     | 
| 
       56 
64 
     | 
    
         | 
| 
       57 
65 
     | 
    
         
             
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
         @@ -6,23 +6,27 @@ require 'active_support/core_ext/hash' 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            module WebhookRecorder
         
     | 
| 
       8 
8 
     | 
    
         
             
              class Server
         
     | 
| 
       9 
     | 
    
         
            -
                attr_accessor :recorded_reqs, :http_url, :https_url, :response_config, 
     | 
| 
      
 9 
     | 
    
         
            +
                attr_accessor :recorded_reqs, :http_url, :https_url, :response_config,
         
     | 
| 
      
 10 
     | 
    
         
            +
                              :port, :http_expose, :log_verbose
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                def initialize(port, response_config, log_verbose = false)
         
     | 
| 
      
 12 
     | 
    
         
            +
                def initialize(port, response_config, http_expose = true, log_verbose = false)
         
     | 
| 
       12 
13 
     | 
    
         
             
                  self.port = port
         
     | 
| 
       13 
14 
     | 
    
         
             
                  self.response_config = response_config
         
     | 
| 
       14 
15 
     | 
    
         
             
                  self.recorded_reqs = []
         
     | 
| 
      
 16 
     | 
    
         
            +
                  self.http_expose = http_expose
         
     | 
| 
       15 
17 
     | 
    
         
             
                  self.log_verbose = log_verbose
         
     | 
| 
       16 
18 
     | 
    
         
             
                  @started = false
         
     | 
| 
       17 
19 
     | 
    
         
             
                end
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                def self.open(port, response_config, log_verbose=false)
         
     | 
| 
       20 
     | 
    
         
            -
                  server = new(port, response_config, log_verbose)
         
     | 
| 
      
 21 
     | 
    
         
            +
                def self.open(port, response_config, http_expose = true, log_verbose=false)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  server = new(port, response_config, http_expose, log_verbose)
         
     | 
| 
       21 
23 
     | 
    
         
             
                  server.start
         
     | 
| 
       22 
24 
     | 
    
         
             
                  server.wait
         
     | 
| 
       23 
     | 
    
         
            -
                   
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
                  if server.http_expose
         
     | 
| 
      
 26 
     | 
    
         
            +
                    Ngrok::Tunnel.start(port: port, authtoken: ENV['NGROK_AUTH_TOKEN'])
         
     | 
| 
      
 27 
     | 
    
         
            +
                    server.http_url = Ngrok::Tunnel.ngrok_url
         
     | 
| 
      
 28 
     | 
    
         
            +
                    server.https_url = Ngrok::Tunnel.ngrok_url_https
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
       26 
30 
     | 
    
         
             
                  yield server
         
     | 
| 
       27 
31 
     | 
    
         
             
                ensure
         
     | 
| 
       28 
32 
     | 
    
         
             
                  server.recorded_reqs.clear
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: webhook_recorder
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Senthil V S
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-04-17 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     |