paso-net-http-spy 0.2.1.pre.p1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8be281cd4158d162cb4fb6690885f121fe6e2b61
4
+ data.tar.gz: bbcbfb32e7335ea386487a9d781c3eb459f0416d
5
+ SHA512:
6
+ metadata.gz: 4da3f4333411a88ee63dae55597e5b1aefd3ae301a42e5a3b429103831dafe35c885ff564a3145034ce3f959d062231fd853155332ceb5d71fe4278271da99e2
7
+ data.tar.gz: 62c7b4cb9c26d09952f60cf565e1c6042c80520d924a0f5685ddbc9b5b5a333b96faae48ce239c671372026e6bfc61f630560a823113bc8dc48c40d967578e93
@@ -0,0 +1,14 @@
1
+ # Just showing an example of something other than Twitter.
2
+ require 'rubygems'
3
+ require 'fogbugz-api' # sudo gem install austinmoody-fogbugz-api
4
+ require File.expand_path(File.join(File.dirname(__FILE__),'..','lib','spy'))
5
+
6
+ config = {:username => "yourusername",
7
+ :password => "yourpass",
8
+ :domain => "yourdomain.fogbugz.com"
9
+ }
10
+
11
+ Net::HTTP.http_logger_options = {:body => true, :trace => false}
12
+
13
+ @fogbugz = FogBugz.new(config[:domain],true) # create instance
14
+ @fogbugz.logon(config[:username],config[:password]) # logs into FogBugz and sets *token*
@@ -0,0 +1,8 @@
1
+ # Just showing an example of something other than Twitter.
2
+ # Garb lets you access the Google Analytics API
3
+ require 'rubygems'
4
+ require 'garb'
5
+ require File.expand_path(File.join(File.dirname(__FILE__),'..','lib','net-http-spy'))
6
+
7
+ Net::HTTP.http_logger_options = {:body => false, :trace => false, :verbose => false}
8
+ Garb::Session.login('yourgoogleusername', 'yourpassword')
@@ -0,0 +1,7 @@
1
+ # See where the external API calls take place within the gem you are using with the :trace option
2
+ require 'rubygems'
3
+ require 'twitter'
4
+ require File.expand_path(File.join(File.dirname(__FILE__),'..','lib','net-http-spy'))
5
+
6
+ Net::HTTP.http_logger_options = {:trace => true}
7
+ Twitter::Search.new('httparty').each { |r| r }
@@ -0,0 +1,8 @@
1
+ # By default the logger outputs to STDOUT, it's easy to change this to a file if you like
2
+ # Great to capture and then use for testing with tools like FakeWeb when combined with :body => true
3
+ require 'rubygems'
4
+ require 'twitter'
5
+ require File.expand_path(File.join(File.dirname(__FILE__),'..','lib','net-http-spy'))
6
+
7
+ Net::HTTP.http_logger = Logger.new('twitter.log')
8
+ Twitter::Search.new('httparty').each { |r| r }
@@ -0,0 +1,6 @@
1
+ # Simplist example. All you need to do is include the spy lib for it to start doing the right thing
2
+ require 'rubygems'
3
+ require 'twitter'
4
+ require File.expand_path(File.join(File.dirname(__FILE__),'..','lib','net-http-spy'))
5
+
6
+ Twitter::Search.new('httparty').each { |r| r }
@@ -0,0 +1,7 @@
1
+ # Net::HTTP has it's own logging/debug functionality. Turn on :verbose to show the full raw HTTP communication
2
+ require 'rubygems'
3
+ require 'twitter'
4
+ require File.expand_path(File.join(File.dirname(__FILE__),'..','lib','net-http-spy'))
5
+
6
+ Net::HTTP.http_logger_options = {:verbose => true}
7
+ Twitter::Search.new('httparty').each { |r| r }
@@ -0,0 +1,7 @@
1
+ # Display the full response/request body. Usually just the response code is shown.
2
+ require 'rubygems'
3
+ require 'twitter'
4
+ require File.expand_path(File.join(File.dirname(__FILE__),'..','lib','net-http-spy'))
5
+
6
+ Net::HTTP.http_logger_options = {:body => true}
7
+ Twitter::Search.new('httparty').each { |r| r }
data/readme.markdown ADDED
@@ -0,0 +1,61 @@
1
+ ## About
2
+
3
+ Ever wondered what HTTP requests the Ruby gem you are using to connect to a third party
4
+ API is making? Use HTTP Spy to see what is going on behind the scenes.
5
+
6
+ ## Installation
7
+
8
+ sudo gem install martinbtt-net-http-spy
9
+
10
+ ## Example Usage
11
+
12
+ require 'rubygems'
13
+ require 'twitter'
14
+ gem 'net-http-spy'
15
+ require 'net-http-spy'
16
+
17
+ Twitter::Search.new('httparty').each { |r| r }
18
+ # Outputs...
19
+ -- : CONNECT: ["search.twitter.com", 80]
20
+ -- : GET /search.json?q=httparty
21
+ -- : BODY: Net::HTTPOK
22
+
23
+
24
+ See the examples folder for more.
25
+
26
+ ## Further Options
27
+
28
+ Show the call trace to the originating line of code in the third party gem
29
+
30
+ Net::HTTP.http_logger_options = {:trace => true}
31
+
32
+ Output the body of the request
33
+
34
+ Net::HTTP.http_logger_options = {:body => true}
35
+
36
+ Show the full raw HTTP output
37
+
38
+ Net::HTTP.http_logger_options = {:verbose => true}
39
+
40
+ Change the logger. By default HTTP spy logs to STDOUT
41
+
42
+ Net::HTTP.http_logger = Logger.new('twitter.log')
43
+
44
+ ## Bonus Points
45
+
46
+ Use it to grab sample data for FakeWeb = testing goodness.
47
+
48
+ ## Notes
49
+
50
+ This is a pretty early release. I'm sure there is plenty that can be done to improve compatibility
51
+ as several libraries call Net::HTTP in a slightly different way.
52
+ Feel free to fork and send in pull requests/patches.
53
+
54
+ ## Find Me
55
+
56
+ Martin Sadler (martin -- at -- beyondthetype.com)
57
+
58
+ * Blog: http://www.beyondthetype.com
59
+ * Follow: http://twitter.com/martinbtt
60
+ * Code: http://github.com/martinbtt
61
+ * Recommend: http://www.workingwithrails.com/person/5152-martin-sadler
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: paso-net-http-spy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1.pre.p1
5
+ platform: ruby
6
+ authors:
7
+ - Martin Sadler
8
+ - Patrik Soderberg
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-11 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Ever wondered what HTTP requests the Ruby gem you are using to connect
15
+ to a third party API is making? Use HTTP Spy to see what is going on behind the
16
+ scenes.
17
+ email: patrik@booli.se
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files:
21
+ - readme.markdown
22
+ files:
23
+ - examples/fogbugz.rb
24
+ - examples/google.rb
25
+ - examples/twitter-calltrace.rb
26
+ - examples/twitter-customlog.rb
27
+ - examples/twitter-simple.rb
28
+ - examples/twitter-verbose.rb
29
+ - examples/twitter-withbody.rb
30
+ - readme.markdown
31
+ homepage: http://github.com/Paso/net-http-spy
32
+ licenses: []
33
+ metadata: {}
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 2.2.2
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: Ever wondered what HTTP requests the Ruby gem you are using to connect to
54
+ a third party API is making? Use HTTP Spy to see what is going on behind the scenes.
55
+ test_files: []