putsreq 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 2233f1887f2d66ec4416dcc4c6937b1a9d1eab81
4
- data.tar.gz: 6500ca8c733fb660af701cceacc16620bd464276
3
+ metadata.gz: 1d06503d7f311af6ea6889c942724186869f9f40
4
+ data.tar.gz: 35f4b09443af29f865ab6b27492aa3f98d6a5b07
5
5
  SHA512:
6
- metadata.gz: 67d1e14299208eb8513007077ba9b5ff565bb7c362195226cb3e8cf768af8f4f8b77c67019c1da8a09f89b1083319569b3636b07f8f726850d4fd98f11ef96cd
7
- data.tar.gz: 2ea2c421ef5537f821236d8b7496dae189e187432d3a55997356bf6aa14e2d4290e7a028bb5db156f9b3209cdb2c153deaf608c5668623ce4335b0265fdfefa1
6
+ metadata.gz: 32c23e0ad1396408aa4353a32b402a1dabd145e2069354a51fc91742aef9f9257f4fb79042f6a57e274136fbfdea64776f2cc68acce25c7f8a8955451437b4f7
7
+ data.tar.gz: 43c51f6fc3337fa44e126c265564d9af1d208489aeb6cbe83ad2b7ce937ee27158d36bc45d7917abc2136f3277ae33747d07a570863999df261e7f50eefbc0ea
data/README.md CHANGED
@@ -111,6 +111,20 @@ request.body = parsedBody;
111
111
  request.forwardTo = 'http://example.com/api';
112
112
  ```
113
113
 
114
+ ### CLI
115
+
116
+ Want to test a Webhook calls against your localhost? PutsReq makes it easy!
117
+
118
+ ```shell
119
+ gem install putsreq
120
+
121
+ putsreq forward --to http://localhost:3000 --token YOUR-TOKEN
122
+ Listening requests from YOUR-TOKEN
123
+ Forwarding to http://localhost:3000
124
+ Press CTRL+c to terminate
125
+ 2016-12-21 20:49:54 -0200 POST 200
126
+ ```
127
+
114
128
  ### Ajax
115
129
 
116
130
  PutsReq supports [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), so you can use it to test your Ajax calls.
@@ -3,7 +3,7 @@
3
3
  <div class="">
4
4
  <header>
5
5
  <%= image_tag 'logo.png' %>
6
- <h3><em>PutsReq</em> lets you record HTTP requests and simulate responses like no other tool available. Try it now!</h3>
6
+ <h3><em>PutsReq</em> lets you record HTTP requests and fake responses like no other tool available. Try it now!</h3>
7
7
  <%= form_for :bucket, url: buckets_path do |f| %>
8
8
  <button class="btn btn-primary btn-large">Create a PutsReq</button>
9
9
  <em>
@@ -27,18 +27,12 @@
27
27
  </ul>
28
28
  </div>
29
29
  <% end %>
30
- <h4>Record the requests sent or received</h4>
31
- <p>Change your target URL to a PutsReq URL, then you will be able to inspect all headers and body being sent.
32
- You can also debug callbacks from external services by configuring a PutsReq URL instead of your Webhook URL.</p>
33
- <h4 class="tm20">Simulate responses</h4>
34
- <p>PutsReq is the easiest way to simulate/stub HTTP responses. You can define the response status, headers and body with JavaScript using the <a href="https://github.com/phstc/putsreq#response-builder">Response Builder</a>.
35
- If you don't want to test against the real API, but you know how to simulate (mock) the response, you can do that using a Response Builder.</p>
36
- <p>Some use cases:</p>
37
- <ul>
38
- <li>Get the real response once then create a Response Builder simulating it and use PutsReq for the next calls.</li>
39
- <li>Use PutsReq for your integration tests to verify if your application is making the HTTP requests as expected <a href="https://github.com/phstc/putsreq_integration_sample/blob/master/spec/acceptance/create_user_spec.rb">by checking the last recorded request</a>.</li>
40
- <li>To benchmark by checking the First and Last request timestamps, or by checking the numbers of requests made within a period.</li>
41
- </ul>
30
+ <h4>Record requests</h4>
31
+ <p>Change your target URL to a PutsReq URL to start recording your requests.</p>
32
+ <h4 class="tm20">Fake responses</h4>
33
+ <p>PutsReq is the easiest way to fake HTTP responses. You can define the response status, headers and body you want using <a href="https://github.com/phstc/putsreq#response-builder">JavaScript</a>.
34
+ <h4 class="tm20">Forward requests</h4>
35
+ <p>You can easily <a href="https://github.com/phstc/putsreq#forwardto">forward requests to another URL</a>, including <a href="https://github.com/phstc/putsreq#CLI">localhost</a>.
42
36
  </section>
43
37
  </div>
44
38
  </div>
@@ -28,10 +28,12 @@ class PutsReqCLI < Thor
28
28
  method_option :token, desc: 'PutsReq token', required: true
29
29
  method_option :to, desc: 'destination URL', required: true
30
30
  def forward
31
+ trap('SIGINT', 'EXIT')
32
+
31
33
  token = parse_bucket_token(options[:token])
32
34
  to = options[:to]
33
35
 
34
- puts "Starting to listen requests from #{token}"
36
+ puts "Listening requests from #{token}"
35
37
  puts "Forwarding to #{to}"
36
38
  puts "Press CTRL+c to terminate"
37
39
 
@@ -1,3 +1,3 @@
1
1
  module PutsReq
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: putsreq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Cantero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-29 00:00:00.000000000 Z
11
+ date: 2016-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor