monster_mash 0.1.4 → 0.2.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.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ gem 'typhoeus', '>= 0.2.0'
2
+
3
+ group :test do
4
+ gem 'rspec', '1.3.1'
5
+ gem 'json'
6
+ gem 'vcr', '>= 1.3.0'
7
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,15 @@
1
+ GEM
2
+ specs:
3
+ json (1.4.6)
4
+ rspec (1.3.1)
5
+ typhoeus (0.2.0)
6
+ vcr (1.3.0)
7
+
8
+ PLATFORMS
9
+ ruby
10
+
11
+ DEPENDENCIES
12
+ json
13
+ rspec (= 1.3.1)
14
+ typhoeus (>= 0.2.0)
15
+ vcr (>= 1.3.0)
data/README.markdown CHANGED
@@ -84,6 +84,34 @@ To make parallel (non-blocking) calls, you need an instance of Typhoeus::Hydra:
84
84
  # blocks until all 10 queries complete.
85
85
  hydra.run
86
86
 
87
+ Calling helper methods from a handler block
88
+ -------------------------------------------
89
+
90
+ monster_mash will correctly delegate method calls from your handler block to your API class. Example:
91
+
92
+ class GoogleJson < MonsterMash::Base
93
+ VERSION = '1.0'
94
+
95
+ # Creates a method called +search+ that takes
96
+ # a single +query+ parameter.
97
+ get(:search) do |query|
98
+ uri "http://ajax.googleapis.com/ajax/services/search/web"
99
+ params 'v' => VERSION,
100
+ 'q' => query,
101
+ 'rsz' => 'large'
102
+ handler do |response|
103
+ json = JSON.parse(response.body)
104
+
105
+ # Calls the correct method on GoogleJson.
106
+ parse_results(json)
107
+ end
108
+ end
109
+
110
+ def self.parse_results(json)
111
+ json['responseData']['results']
112
+ end
113
+ end
114
+
87
115
  Setting defaults
88
116
  ----------------
89
117
 
data/Rakefile CHANGED
@@ -10,9 +10,9 @@ begin
10
10
  gem.email = "dbalatero@gmail.com"
11
11
  gem.homepage = "http://github.com/dbalatero/monster_mash"
12
12
  gem.authors = ["David Balatero"]
13
- gem.add_dependency "typhoeus", ">= 0.1.25"
14
- gem.add_development_dependency "rspec", ">= 1.2.9"
15
- gem.add_development_dependency "typhoeus_spec_cache", ">= 0.2.2"
13
+ gem.add_dependency "typhoeus", ">= 0.2.0"
14
+ gem.add_development_dependency "rspec", "1.3.1"
15
+ gem.add_development_dependency "vcr", ">= 1.3.0"
16
16
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
17
  end
18
18
  Jeweler::GemcutterTasks.new
@@ -20,17 +20,10 @@ rescue LoadError
20
20
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
21
  end
22
22
 
23
- require 'spec/rake/spectask'
24
- Spec::Rake::SpecTask.new(:spec) do |spec|
25
- spec.libs << 'lib' << 'spec'
26
- spec.spec_files = FileList['spec/**/*_spec.rb']
27
- end
28
-
29
- Spec::Rake::SpecTask.new(:rcov) do |spec|
30
- spec.libs << 'lib' << 'spec'
31
- spec.pattern = 'spec/**/*_spec.rb'
32
- spec.rcov = true
33
- spec.rcov_opts = ['--exclude', 'spec,lib/monster_mash/instance_exec.rb']
23
+ require 'rspec/core/rake_task'
24
+ RSpec::Core::RakeTask.new do |t|
25
+ t.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
26
+ t.pattern = 'spec/**/*_spec.rb'
34
27
  end
35
28
 
36
29
  task :spec => :check_dependencies
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.2.0
@@ -88,6 +88,7 @@ module MonsterMash
88
88
  # Create the request with defaults.
89
89
  request = MonsterMash::Request.new(http_method)
90
90
  request.apply_defaults(defaults)
91
+ request.caller_klass = self
91
92
 
92
93
  # Add in user-set values.
93
94
  request.execute_dsl(*args, &setup_block)
@@ -4,6 +4,7 @@ module MonsterMash
4
4
  class Request
5
5
  attr_accessor :options
6
6
  attr_accessor :errors
7
+ attr_accessor :caller_klass
7
8
 
8
9
  # Creates a new Request wrapper object.
9
10
  #
@@ -16,6 +17,18 @@ module MonsterMash
16
17
  execute_dsl(*args, &block)
17
18
  end
18
19
 
20
+ def method_missing(method, *args, &block)
21
+ if caller_klass && caller_klass.respond_to?(method)
22
+ caller_klass.send(method, *args, &block)
23
+ else
24
+ super
25
+ end
26
+ end
27
+
28
+ def respond_to?(method)
29
+ (caller_klass && caller_klass.respond_to?(method)) || super
30
+ end
31
+
19
32
  def apply_defaults(default_blocks)
20
33
  default_blocks.each { |block| execute_dsl(&block) }
21
34
  end
data/monster_mash.gemspec CHANGED
@@ -5,23 +5,24 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{monster_mash}
8
- s.version = "0.1.4"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Balatero"]
12
- s.date = %q{2010-07-20}
12
+ s.date = %q{2010-11-30}
13
13
  s.description = %q{Provides a fun HTTP interface on top of Typhoeus!}
14
14
  s.email = %q{dbalatero@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.markdown",
18
- "README.markdown.html",
19
- "TODO"
18
+ "README.markdown.html"
20
19
  ]
21
20
  s.files = [
22
21
  ".document",
23
22
  ".gitignore",
24
23
  "CHANGELOG.markdown",
24
+ "Gemfile",
25
+ "Gemfile.lock",
25
26
  "LICENSE",
26
27
  "README.markdown",
27
28
  "Rakefile",
@@ -31,8 +32,9 @@ Gem::Specification.new do |s|
31
32
  "lib/monster_mash/instance_exec.rb",
32
33
  "lib/monster_mash/request.rb",
33
34
  "monster_mash.gemspec",
34
- "spec/cache/errors/578ef7e62373286feb3e35a6042555a6c0dcde08.cache",
35
- "spec/cache/google/cfd676f5f3b7aefc1b4a9038eb4a4de00d2608c8.cache",
35
+ "spec/fixtures/vcr_cassettes/google/delegation.yml",
36
+ "spec/fixtures/vcr_cassettes/google/error_propagation.yml",
37
+ "spec/fixtures/vcr_cassettes/google/valid.yml",
36
38
  "spec/monster_mash/base_spec.rb",
37
39
  "spec/monster_mash/request_spec.rb",
38
40
  "spec/spec.opts",
@@ -41,7 +43,7 @@ Gem::Specification.new do |s|
41
43
  s.homepage = %q{http://github.com/dbalatero/monster_mash}
42
44
  s.rdoc_options = ["--charset=UTF-8"]
43
45
  s.require_paths = ["lib"]
44
- s.rubygems_version = %q{1.3.6}
46
+ s.rubygems_version = %q{1.3.7}
45
47
  s.summary = %q{Provides a fun HTTP interface on top of Typhoeus!}
46
48
  s.test_files = [
47
49
  "spec/monster_mash/base_spec.rb",
@@ -53,19 +55,19 @@ Gem::Specification.new do |s|
53
55
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
56
  s.specification_version = 3
55
57
 
56
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
57
- s.add_runtime_dependency(%q<typhoeus>, [">= 0.1.25"])
58
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
59
- s.add_development_dependency(%q<typhoeus_spec_cache>, [">= 0.2.2"])
58
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
59
+ s.add_runtime_dependency(%q<typhoeus>, [">= 0.2.0"])
60
+ s.add_development_dependency(%q<rspec>, ["= 1.3.1"])
61
+ s.add_development_dependency(%q<vcr>, [">= 1.3.0"])
60
62
  else
61
- s.add_dependency(%q<typhoeus>, [">= 0.1.25"])
62
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
63
- s.add_dependency(%q<typhoeus_spec_cache>, [">= 0.2.2"])
63
+ s.add_dependency(%q<typhoeus>, [">= 0.2.0"])
64
+ s.add_dependency(%q<rspec>, ["= 1.3.1"])
65
+ s.add_dependency(%q<vcr>, [">= 1.3.0"])
64
66
  end
65
67
  else
66
- s.add_dependency(%q<typhoeus>, [">= 0.1.25"])
67
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
68
- s.add_dependency(%q<typhoeus_spec_cache>, [">= 0.2.2"])
68
+ s.add_dependency(%q<typhoeus>, [">= 0.2.0"])
69
+ s.add_dependency(%q<rspec>, ["= 1.3.1"])
70
+ s.add_dependency(%q<vcr>, [">= 1.3.0"])
69
71
  end
70
72
  end
71
73
 
@@ -0,0 +1,38 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://ajax.googleapis.com:80/ajax/services/search/web?q=balatero&rsz=large&v=1.0
6
+ body:
7
+ headers:
8
+ user-agent:
9
+ - Typhoeus - http://github.com/pauldix/typhoeus/tree/master
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ x-content-type-options:
16
+ - nosniff
17
+ x-frame-options:
18
+ - SAMEORIGIN
19
+ expires:
20
+ - Fri, 01 Jan 1990 00:00:00 GMT
21
+ x-embedded-status:
22
+ - "200"
23
+ content-type:
24
+ - text/javascript; charset=utf-8
25
+ server:
26
+ - GSE
27
+ date:
28
+ - Tue, 30 Nov 2010 18:06:41 GMT
29
+ x-xss-protection:
30
+ - 1; mode=block
31
+ cache-control:
32
+ - no-cache, no-store, max-age=0, must-revalidate
33
+ pragma:
34
+ - no-cache
35
+ transfer-encoding:
36
+ - chunked
37
+ body: "{\"responseData\": {\"results\":[{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.facebook.com/people/Dennis-Lawrence-Balatero-Sayson/100001316602150\",\"url\":\"http://www.facebook.com/people/Dennis-Lawrence-Balatero-Sayson/100001316602150\",\"visibleUrl\":\"www.facebook.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:_WnFjfrSE8QJ:www.facebook.com\",\"title\":\"Dennis Lawrence \\u003cb\\u003eBalatero\\u003c/b\\u003e Sayson | Facebook\",\"titleNoFormatting\":\"Dennis Lawrence Balatero Sayson | Facebook\",\"content\":\"Dennis Lawrence \\u003cb\\u003eBalatero\\u003c/b\\u003e Sayson is on Facebook. Join Facebook to connect with Dennis Lawrence \\u003cb\\u003eBalatero\\u003c/b\\u003e Sayson and others you may know.\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://de-de.facebook.com/people/Jeannette-Balatero-Rohe/100000128981985\",\"url\":\"http://de-de.facebook.com/people/Jeannette-Balatero-Rohe/100000128981985\",\"visibleUrl\":\"de-de.facebook.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:gZYOBRtgo-sJ:de-de.facebook.com\",\"title\":\"Jeannette \\u003cb\\u003eBalatero\\u003c/b\\u003e Rohe | Facebook\",\"titleNoFormatting\":\"Jeannette Balatero Rohe | Facebook\",\"content\":\"Jeannette \\u003cb\\u003eBalatero\\u003c/b\\u003e Rohe ist bei Facebook. Tritt Facebook bei, um dich mit \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://twitter.com/dbalatero\",\"url\":\"http://twitter.com/dbalatero\",\"visibleUrl\":\"twitter.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:I2apuxLuvJEJ:twitter.com\",\"title\":\"David \\u003cb\\u003eBalatero\\u003c/b\\u003e (dbalatero) on Twitter\",\"titleNoFormatting\":\"David Balatero (dbalatero) on Twitter\",\"content\":\"Rubyist, programmer, musician, entrepreneur, photographer.\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.travelpuertogalera.com/balatero.htm\",\"url\":\"http://www.travelpuertogalera.com/balatero.htm\",\"visibleUrl\":\"www.travelpuertogalera.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:AcJwGQZoG8cJ:www.travelpuertogalera.com\",\"title\":\"Puerto Galera/\\u003cb\\u003eBalatero\\u003c/b\\u003e\",\"titleNoFormatting\":\"Puerto Galera/Balatero\",\"content\":\"and other establishments in \\u003cb\\u003eBalatero\\u003c/b\\u003e, Puerto Galera, Oriental Mindoro, the Philippines \\u003cb\\u003e....\\u003c/b\\u003e Nagura Beach Resort, \\u003cb\\u003eBalatero\\u003c/b\\u003e, Cellular Tel. 0917-6411705 \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://biliranisland.com/blogs/?p\\u003d102\",\"url\":\"http://biliranisland.com/blogs/%3Fp%3D102\",\"visibleUrl\":\"biliranisland.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:XCWq2N-FTFoJ:biliranisland.com\",\"title\":\"Congratulations to Ms Desiree Brigette \\u003cb\\u003eBalatero\\u003c/b\\u003e\",\"titleNoFormatting\":\"Congratulations to Ms Desiree Brigette Balatero\",\"content\":\"Congratulations to Ms Desiree Brigette \\u003cb\\u003eBalatero\\u003c/b\\u003e , Events and Updates for Biliranons at your fingertips.\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.linkedin.com/pub/russell-balatero/18/499/b78\",\"url\":\"http://www.linkedin.com/pub/russell-balatero/18/499/b78\",\"visibleUrl\":\"www.linkedin.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:e3c0ZoU476IJ:www.linkedin.com\",\"title\":\"Russell \\u003cb\\u003eBalatero\\u003c/b\\u003e - LinkedIn\",\"titleNoFormatting\":\"Russell Balatero - LinkedIn\",\"content\":\"View Russell \\u003cb\\u003eBalatero\\u0026#39;s\\u003c/b\\u003e professional profile on LinkedIn. LinkedIn is the world\\u0026#39;s largest business network, helping professionals like Russell \\u003cb\\u003eBalatero\\u003c/b\\u003e \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"https://github.com/dbalatero\",\"url\":\"https://github.com/dbalatero\",\"visibleUrl\":\"github.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:pZHIkd_Xv9QJ:github.com\",\"title\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"titleNoFormatting\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"content\":\"Mar 2, 2009 \\u003cb\\u003e...\\u003c/b\\u003e dbalatero (David \\u003cb\\u003eBalatero\\u003c/b\\u003e). You\\u0026#39;re not logged in! Login \\u0026middot; Pricing \\u0026amp; Signup. Name : David \\u003cb\\u003eBalatero\\u003c/b\\u003e. Email. Website/Blog: http://opidmusic.com \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://suzukiassociation.org/author/b/barbara-balatero/\",\"url\":\"http://suzukiassociation.org/author/b/barbara-balatero/\",\"visibleUrl\":\"suzukiassociation.org\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:e20ZSip7HqkJ:suzukiassociation.org\",\"title\":\"Barbara \\u003cb\\u003eBalatero\\u003c/b\\u003e | Authors | Journal | Suzuki Association of the \\u003cb\\u003e...\\u003c/b\\u003e\",\"titleNoFormatting\":\"Barbara Balatero | Authors | Journal | Suzuki Association of the ...\",\"content\":\"Oct 1, 2007 \\u003cb\\u003e...\\u003c/b\\u003e Barbara \\u003cb\\u003eBalatero\\u003c/b\\u003e graduated from Oberlin Conservatory with a Bachelors Degree in Cello Performance and a Masters of Music in Teaching where \\u003cb\\u003e...\\u003c/b\\u003e\"}],\"cursor\":{\"pages\":[{\"start\":\"0\",\"label\":1},{\"start\":\"8\",\"label\":2},{\"start\":\"16\",\"label\":3},{\"start\":\"24\",\"label\":4},{\"start\":\"32\",\"label\":5},{\"start\":\"40\",\"label\":6},{\"start\":\"48\",\"label\":7},{\"start\":\"56\",\"label\":8}],\"estimatedResultCount\":\"2190\",\"currentPageIndex\":0,\"moreResultsUrl\":\"http://www.google.com/search?oe\\u003dutf8\\u0026ie\\u003dutf8\\u0026source\\u003duds\\u0026start\\u003d0\\u0026hl\\u003den\\u0026q\\u003dbalatero\"}}, \"responseDetails\": null, \"responseStatus\": 200}"
38
+ http_version: "1.1"
@@ -0,0 +1,38 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://ajax.googleapis.com:80/ajax/services/search/web?q=david+balatero&rsz=large&v=1.0
6
+ body:
7
+ headers:
8
+ user-agent:
9
+ - Typhoeus - http://github.com/pauldix/typhoeus/tree/master
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ x-content-type-options:
16
+ - nosniff
17
+ x-frame-options:
18
+ - SAMEORIGIN
19
+ expires:
20
+ - Fri, 01 Jan 1990 00:00:00 GMT
21
+ x-embedded-status:
22
+ - "200"
23
+ content-type:
24
+ - text/javascript; charset=utf-8
25
+ server:
26
+ - GSE
27
+ date:
28
+ - Tue, 09 Nov 2010 04:10:00 GMT
29
+ x-xss-protection:
30
+ - 1; mode=block
31
+ cache-control:
32
+ - no-cache, no-store, max-age=0, must-revalidate
33
+ pragma:
34
+ - no-cache
35
+ transfer-encoding:
36
+ - chunked
37
+ body: "{\"responseData\": {\"results\":[{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://twitter.com/dbalatero\",\"url\":\"http://twitter.com/dbalatero\",\"visibleUrl\":\"twitter.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:I2apuxLuvJEJ:twitter.com\",\"title\":\"\\u003cb\\u003eDavid Balatero\\u003c/b\\u003e (dbalatero) on Twitter\",\"titleNoFormatting\":\"David Balatero (dbalatero) on Twitter\",\"content\":\"Rubyist, programmer, musician, entrepreneur, photographer.\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://github.com/dbalatero\",\"url\":\"http://github.com/dbalatero\",\"visibleUrl\":\"github.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:Hpe7-K1FTgoJ:github.com\",\"title\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"titleNoFormatting\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"content\":\"Mar 2, 2009 \\u003cb\\u003e...\\u003c/b\\u003e dbalatero (\\u003cb\\u003eDavid Balatero\\u003c/b\\u003e). You\\u0026#39;re not logged in! Login \\u0026middot; Pricing \\u0026amp; Signup. Name : \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e. Email. Website/Blog: http://opidmusic.com \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.linkedin.com/pub/david-balatero/24/567/424\",\"url\":\"http://www.linkedin.com/pub/david-balatero/24/567/424\",\"visibleUrl\":\"www.linkedin.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:BI2jxceHRVIJ:www.linkedin.com\",\"title\":\"\\u003cb\\u003eDavid Balatero\\u003c/b\\u003e - LinkedIn\",\"titleNoFormatting\":\"David Balatero - LinkedIn\",\"content\":\"View \\u003cb\\u003eDavid Balatero\\u0026#39;s\\u003c/b\\u003e professional profile on LinkedIn. LinkedIn is the world\\u0026#39;s largest business network, helping professionals like \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e discover \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://developer.amazonwebservices.com/connect/message.jspa?messageID\\u003d188688\",\"url\":\"http://developer.amazonwebservices.com/connect/message.jspa%3FmessageID%3D188688\",\"visibleUrl\":\"developer.amazonwebservices.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:5BDsVmlTBIoJ:developer.amazonwebservices.com\",\"title\":\"\\u003cb\\u003eDavid\\u003c/b\\u003e J. \\u003cb\\u003eBalatero\\u003c/b\\u003e - Amazon Web Services Developer Community : Forums\",\"titleNoFormatting\":\"David J. Balatero - Amazon Web Services Developer Community : Forums\",\"content\":\"Replies: 3 - Pages: 1 - Last Post: Jul 30, 2010 3:11 PM by: \\u003cb\\u003eDavid\\u003c/b\\u003e J. \\u003cb\\u003eBalatero\\u003c/b\\u003e \\u003cb\\u003e...\\u003c/b\\u003e Posted: Jul 30, 2010 3:08 PM PDT in response to: \\u003cb\\u003eDavid\\u003c/b\\u003e J. \\u003cb\\u003eBalatero\\u003c/b\\u003e \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://librelist.com/browser//resque/2010/9/17/resque-on-ec2/\",\"url\":\"http://librelist.com/browser//resque/2010/9/17/resque-on-ec2/\",\"visibleUrl\":\"librelist.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:GAY8ZuNlwIEJ:librelist.com\",\"title\":\"Resque on EC2 | Quick Archive Test\",\"titleNoFormatting\":\"Resque on EC2 | Quick Archive Test\",\"content\":\"Sep 17, 2010 \\u003cb\\u003e...\\u003c/b\\u003e Re: [resque] Resque on EC2 by \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e \\u003cb\\u003e...\\u003c/b\\u003e On Fri, Sep 17, 2010 at 12:26 PM, \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e \\u0026lt;dbalatero@gmail.com\\u0026gt;wrote: \\u0026gt; Resque.redis \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://librelist.com/browser//resque/2010/6/14/redis-slave-failover-with-resque/\",\"url\":\"http://librelist.com/browser//resque/2010/6/14/redis-slave-failover-with-resque/\",\"visibleUrl\":\"librelist.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:MV8Q4gc49oAJ:librelist.com\",\"title\":\"redis slave failover with Resque | Quick Archive Test\",\"titleNoFormatting\":\"redis slave failover with Resque | Quick Archive Test\",\"content\":\"Re: [resque] redis slave failover with Resque by \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.bassmasta.net/w/wooten_victor/132800.html\",\"url\":\"http://www.bassmasta.net/w/wooten_victor/132800.html\",\"visibleUrl\":\"www.bassmasta.net\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:x-_ddwmFZiUJ:www.bassmasta.net\",\"title\":\"Yinin And Yangin Bass Tab (by Wooten Victor) @ BassMasta.net!\",\"titleNoFormatting\":\"Yinin And Yangin Bass Tab (by Wooten Victor) @ BassMasta.net!\",\"content\":\"Victor Wooten - Yingin\\u0026#39; and Yangin\\u0026#39; Tabbed by \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e [\\u003cb\\u003edavid\\u003c/b\\u003e.\\u003cb\\u003ebalatero\\u003c/b\\u003e@ attbi.com] May 2, 2002 | http://www.davidbalatero.com \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.azchords.com/w/wootenvictor-tabs-10175/yininandyangin-tabs-125181.html\",\"url\":\"http://www.azchords.com/w/wootenvictor-tabs-10175/yininandyangin-tabs-125181.html\",\"visibleUrl\":\"www.azchords.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:R0wt7u76inYJ:www.azchords.com\",\"title\":\"Wooten Victor Bass Tabs for - Yinin And Yangin Tabs, Chords, Lyrics\",\"titleNoFormatting\":\"Wooten Victor Bass Tabs for - Yinin And Yangin Tabs, Chords, Lyrics\",\"content\":\"Tabbed by \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e [\\u003cb\\u003edavid\\u003c/b\\u003e.\\u003cb\\u003ebalatero\\u003c/b\\u003e@attbi.com] May 2, 2002 | http://www. davidbalatero.com #################################################### \\u003cb\\u003e...\\u003c/b\\u003e\"}],\"cursor\":{\"pages\":[{\"start\":\"0\",\"label\":1},{\"start\":\"8\",\"label\":2},{\"start\":\"16\",\"label\":3},{\"start\":\"24\",\"label\":4},{\"start\":\"32\",\"label\":5},{\"start\":\"40\",\"label\":6},{\"start\":\"48\",\"label\":7},{\"start\":\"56\",\"label\":8}],\"estimatedResultCount\":\"747\",\"currentPageIndex\":0,\"moreResultsUrl\":\"http://www.google.com/search?oe\\u003dutf8\\u0026ie\\u003dutf8\\u0026source\\u003duds\\u0026start\\u003d0\\u0026hl\\u003den\\u0026q\\u003ddavid+balatero\"}}, \"responseDetails\": null, \"responseStatus\": 200}"
38
+ http_version: "1.1"
@@ -0,0 +1,38 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://ajax.googleapis.com:80/ajax/services/search/web?q=balatero&rsz=large&v=1.0
6
+ body:
7
+ headers:
8
+ user-agent:
9
+ - Typhoeus - http://github.com/pauldix/typhoeus/tree/master
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ x-content-type-options:
16
+ - nosniff
17
+ x-frame-options:
18
+ - SAMEORIGIN
19
+ expires:
20
+ - Fri, 01 Jan 1990 00:00:00 GMT
21
+ x-embedded-status:
22
+ - "200"
23
+ content-type:
24
+ - text/javascript; charset=utf-8
25
+ server:
26
+ - GSE
27
+ date:
28
+ - Tue, 09 Nov 2010 04:10:00 GMT
29
+ x-xss-protection:
30
+ - 1; mode=block
31
+ cache-control:
32
+ - no-cache, no-store, max-age=0, must-revalidate
33
+ pragma:
34
+ - no-cache
35
+ transfer-encoding:
36
+ - chunked
37
+ body: "{\"responseData\": {\"results\":[{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.genealogytoday.com/surname/finder.mv?Surname\\u003dBalatero\",\"url\":\"http://www.genealogytoday.com/surname/finder.mv%3FSurname%3DBalatero\",\"visibleUrl\":\"www.genealogytoday.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:5Q-lzaN1lD8J:www.genealogytoday.com\",\"title\":\"\\u003cb\\u003eBalatero\\u003c/b\\u003e Genealogy and Family Tree Resources - Surname Finder\",\"titleNoFormatting\":\"Balatero Genealogy and Family Tree Resources - Surname Finder\",\"content\":\"Free checklist of \\u003cb\\u003eBalatero\\u003c/b\\u003e resources, including online databases, obituaries, surname histories, census and military records, and \\u003cb\\u003eBalatero\\u003c/b\\u003e message boards.\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://twitter.com/dbalatero\",\"url\":\"http://twitter.com/dbalatero\",\"visibleUrl\":\"twitter.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:I2apuxLuvJEJ:twitter.com\",\"title\":\"David \\u003cb\\u003eBalatero\\u003c/b\\u003e (dbalatero) on Twitter\",\"titleNoFormatting\":\"David Balatero (dbalatero) on Twitter\",\"content\":\"Rubyist, programmer, musician, entrepreneur, photographer.\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://github.com/dbalatero\",\"url\":\"http://github.com/dbalatero\",\"visibleUrl\":\"github.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:Hpe7-K1FTgoJ:github.com\",\"title\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"titleNoFormatting\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"content\":\"Mar 2, 2009 \\u003cb\\u003e...\\u003c/b\\u003e dbalatero (David \\u003cb\\u003eBalatero\\u003c/b\\u003e). You\\u0026#39;re not logged in! Login \\u0026middot; Pricing \\u0026amp; Signup. Name : David \\u003cb\\u003eBalatero\\u003c/b\\u003e. Email. Website/Blog: http://opidmusic.com \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.facebook.com/people/Jr-Balatero/100000280808853\",\"url\":\"http://www.facebook.com/people/Jr-Balatero/100000280808853\",\"visibleUrl\":\"www.facebook.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:17R2E_mFFUgJ:www.facebook.com\",\"title\":\"Jr \\u003cb\\u003eBalatero\\u003c/b\\u003e | Facebook\",\"titleNoFormatting\":\"Jr Balatero | Facebook\",\"content\":\"Jr \\u003cb\\u003eBalatero\\u003c/b\\u003e is on Facebook. Join Facebook to connect with Jr \\u003cb\\u003eBalatero\\u003c/b\\u003e and others you may know. Facebook gives people the power to share and makes the world \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://biliranisland.com/blogs/?p\\u003d102\",\"url\":\"http://biliranisland.com/blogs/%3Fp%3D102\",\"visibleUrl\":\"biliranisland.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:XCWq2N-FTFoJ:biliranisland.com\",\"title\":\"Congratulations to Ms Desiree Brigette \\u003cb\\u003eBalatero\\u003c/b\\u003e\",\"titleNoFormatting\":\"Congratulations to Ms Desiree Brigette Balatero\",\"content\":\"Congratulations to Ms Desiree Brigette \\u003cb\\u003eBalatero\\u003c/b\\u003e , Events and Updates for Biliranons at your fingertips.\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.travelpuertogalera.com/balatero.htm\",\"url\":\"http://www.travelpuertogalera.com/balatero.htm\",\"visibleUrl\":\"www.travelpuertogalera.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:AcJwGQZoG8cJ:www.travelpuertogalera.com\",\"title\":\"Puerto Galera/\\u003cb\\u003eBalatero\\u003c/b\\u003e\",\"titleNoFormatting\":\"Puerto Galera/Balatero\",\"content\":\"and other establishments in \\u003cb\\u003eBalatero\\u003c/b\\u003e, Puerto Galera, Oriental Mindoro, the Philippines \\u003cb\\u003e....\\u003c/b\\u003e Nagura Beach Resort, \\u003cb\\u003eBalatero\\u003c/b\\u003e, Cellular Tel. 0917-6411705 \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.youtube.com/watch?v\\u003d5VaRVkZN1CM\\u0026feature\\u003drelated\",\"url\":\"http://www.youtube.com/watch%3Fv%3D5VaRVkZN1CM%26feature%3Drelated\",\"visibleUrl\":\"www.youtube.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:tSkHxoCLtKsJ:www.youtube.com\",\"title\":\"YouTube - \\u003cb\\u003eBalatero\\u003c/b\\u003e Kids\",\"titleNoFormatting\":\"YouTube - Balatero Kids\",\"content\":\"Oct 2, 2008 \\u003cb\\u003e...\\u003c/b\\u003e A slide show of Angelica, Ashley and Abby \\u003cb\\u003eBalatero\\u003c/b\\u003e with Tito Bob and Tita Wendy Dimagiba in Ozamiz City. Just for fun!\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.linkedin.com/pub/david-balatero/24/567/424\",\"url\":\"http://www.linkedin.com/pub/david-balatero/24/567/424\",\"visibleUrl\":\"www.linkedin.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:BI2jxceHRVIJ:www.linkedin.com\",\"title\":\"David \\u003cb\\u003eBalatero\\u003c/b\\u003e - LinkedIn\",\"titleNoFormatting\":\"David Balatero - LinkedIn\",\"content\":\"View David \\u003cb\\u003eBalatero\\u0026#39;s\\u003c/b\\u003e professional profile on LinkedIn. LinkedIn is the world\\u0026#39;s largest business network, helping professionals like David \\u003cb\\u003eBalatero\\u003c/b\\u003e discover \\u003cb\\u003e...\\u003c/b\\u003e\"}],\"cursor\":{\"pages\":[{\"start\":\"0\",\"label\":1},{\"start\":\"8\",\"label\":2},{\"start\":\"16\",\"label\":3},{\"start\":\"24\",\"label\":4},{\"start\":\"32\",\"label\":5},{\"start\":\"40\",\"label\":6},{\"start\":\"48\",\"label\":7},{\"start\":\"56\",\"label\":8}],\"estimatedResultCount\":\"2190\",\"currentPageIndex\":0,\"moreResultsUrl\":\"http://www.google.com/search?oe\\u003dutf8\\u0026ie\\u003dutf8\\u0026source\\u003duds\\u0026start\\u003d0\\u0026hl\\u003den\\u0026q\\u003dbalatero\"}}, \"responseDetails\": null, \"responseStatus\": 200}"
38
+ http_version: "1.1"
@@ -1,6 +1,9 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  class MockApi < MonsterMash::Base
4
+ def self.test_class_method
5
+ "testvalue"
6
+ end
4
7
  end
5
8
 
6
9
  class CustomMockError < StandardError; end
@@ -22,6 +25,10 @@ class C < A
22
25
  end
23
26
 
24
27
  describe MonsterMash::Base do
28
+ before(:all) do
29
+ @hydra = Typhoeus::Hydra.new
30
+ end
31
+
25
32
  describe "inheriting defaults from superclasses" do
26
33
  it "should propagate defaults to B" do
27
34
  B.defaults.should == A.defaults
@@ -74,7 +81,8 @@ describe MonsterMash::Base do
74
81
 
75
82
  describe "#check_response_and_raise!" do
76
83
  before(:each) do
77
- @response = mock('response')
84
+ @response = mock('response',
85
+ :body => 'response body')
78
86
  end
79
87
 
80
88
  it "should raise if a response has a code in the wrong range" do
@@ -119,7 +127,6 @@ describe MonsterMash::Base do
119
127
 
120
128
  describe "#self.build_method" do
121
129
  before(:all) do
122
- @hydra = mock('hydra')
123
130
  unless MockApi.respond_to?(:my_method)
124
131
  MockApi.build_method(:get, :my_method) do
125
132
  uri 'http://google.com'
@@ -151,77 +158,114 @@ describe MonsterMash::Base do
151
158
  end
152
159
  end
153
160
 
154
- describe "error propagation" do
155
- typhoeus_spec_cache("spec/cache/errors") do |hydra|
156
- before(:all) do
157
- MockApi.build_method(:get, :google_json2) do |search|
158
- uri 'http://ajax.googleapis.com/ajax/services/search/web'
159
- params({
160
- 'v' => '1.0',
161
- 'q' => search,
162
- 'rsz' => 'large'
163
- })
164
- cache_timeout 999999
165
- handler do |response|
166
- raise CustomMockError, "my error"
167
- end
161
+ context "error propagation" do
162
+ before(:all) do
163
+ MockApi.build_method(:get, :google_json2) do |search|
164
+ uri 'http://ajax.googleapis.com/ajax/services/search/web'
165
+ params({
166
+ 'v' => '1.0',
167
+ 'q' => search,
168
+ 'rsz' => 'large'
169
+ })
170
+ cache_timeout 999999
171
+ handler do |response|
172
+ raise CustomMockError, "my error"
168
173
  end
169
174
  end
175
+ end
176
+
177
+ use_vcr_cassette 'google/error_propagation', :record => :new_episodes
170
178
 
171
- it "should raise an error in a serial request" do
172
- lambda {
173
- MockApi.google_json2('david balatero')
174
- }.should raise_error(CustomMockError)
179
+ it "should raise an error in a serial request" do
180
+ lambda {
181
+ MockApi.google_json2('david balatero')
182
+ }.should raise_error(CustomMockError)
183
+ end
184
+
185
+ it "should propagate the error to the block in parallel request" do
186
+ api = MockApi.new(@hydra)
187
+ propagated_error = nil
188
+ api.google_json2('david balatero') do |urls, error|
189
+ propagated_error = error
175
190
  end
191
+ @hydra.run
192
+ propagated_error.should be_an_instance_of(CustomMockError)
193
+ end
194
+ end
176
195
 
177
- it "should propagate the error to the block in parallel request" do
178
- api = MockApi.new(hydra)
179
- propagated_error = nil
180
- api.google_json2('david balatero') do |urls, error|
181
- propagated_error = error
196
+ describe "delegation to the request class" do
197
+ before(:all) do
198
+ MockApi.build_method(:get, :google_json_delegation) do |search|
199
+ uri 'http://ajax.googleapis.com/ajax/services/search/web'
200
+ params({
201
+ 'v' => '1.0',
202
+ 'q' => search,
203
+ 'rsz' => 'large'
204
+ })
205
+ handler do |response|
206
+ test_class_method
182
207
  end
183
- propagated_error.should be_an_instance_of(CustomMockError)
184
208
  end
185
209
  end
210
+
211
+ use_vcr_cassette 'google/delegation', :record => :new_episodes
212
+
213
+ it "should allow calling class methods of the request class in serial" do
214
+ result = MockApi.google_json_delegation('balatero')
215
+ result.should == 'testvalue'
216
+ end
217
+
218
+ it "should allow calling class methods of the request class in parallel" do
219
+ saved_result = nil
220
+ api = MockApi.new(@hydra)
221
+ api.google_json_delegation('balatero') do |result, error|
222
+ if !error
223
+ saved_result = result
224
+ end
225
+ end
226
+ @hydra.run
227
+
228
+ saved_result.should == 'testvalue'
229
+ end
186
230
  end
187
231
 
188
232
  describe "a valid method" do
189
- typhoeus_spec_cache("spec/cache/google") do |hydra|
190
- before(:all) do
191
- MockApi.build_method(:get, :google_json) do |search|
192
- uri 'http://ajax.googleapis.com/ajax/services/search/web'
193
- params({
194
- 'v' => '1.0',
195
- 'q' => search,
196
- 'rsz' => 'large'
197
- })
198
- cache_timeout 999999
199
- handler do |response|
200
- json = JSON.parse(response.body)
201
- json['responseData']['results'].map do |result|
202
- result['url']
203
- end
233
+ before(:all) do
234
+ MockApi.build_method(:get, :google_json) do |search|
235
+ uri 'http://ajax.googleapis.com/ajax/services/search/web'
236
+ params({
237
+ 'v' => '1.0',
238
+ 'q' => search,
239
+ 'rsz' => 'large'
240
+ })
241
+ cache_timeout 999999
242
+ handler do |response|
243
+ json = JSON.parse(response.body)
244
+ json['responseData']['results'].map do |result|
245
+ result['url']
204
246
  end
205
247
  end
206
248
  end
249
+ end
207
250
 
208
- it "should do a serial query correctly" do
209
- saved_urls = MockApi.google_json('balatero')
210
- saved_urls.should have(8).things
211
- end
251
+ use_vcr_cassette 'google/valid', :record => :new_episodes
212
252
 
213
- it "should do a query correctly" do
214
- saved_urls = nil
215
- api = MockApi.new(hydra)
216
- api.google_json('balatero') do |urls, error|
217
- if !error
218
- saved_urls = urls
219
- end
220
- end
221
- hydra.run
253
+ it "should do a serial query correctly" do
254
+ saved_urls = MockApi.google_json('balatero')
255
+ saved_urls.should have(8).things
256
+ end
222
257
 
223
- saved_urls.should have(8).things
258
+ it "should do a query correctly" do
259
+ saved_urls = nil
260
+ api = MockApi.new(@hydra)
261
+ api.google_json('balatero') do |urls, error|
262
+ if !error
263
+ saved_urls = urls
264
+ end
224
265
  end
266
+ @hydra.run
267
+
268
+ saved_urls.should have(8).things
225
269
  end
226
270
  end
227
271
  end
data/spec/spec_helper.rb CHANGED
@@ -3,10 +3,14 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'monster_mash'
4
4
  require 'spec'
5
5
  require 'spec/autorun'
6
- require 'typhoeus_spec_cache'
7
6
  require 'json'
7
+ require 'vcr'
8
+
9
+ VCR.config do |c|
10
+ c.cassette_library_dir = File.dirname(__FILE__) + "/fixtures/vcr_cassettes"
11
+ c.stub_with :typhoeus
12
+ end
8
13
 
9
14
  Spec::Runner.configure do |config|
10
- config.include(Typhoeus::SpecCacheMacros::InstanceMethods)
11
- config.extend(Typhoeus::SpecCacheMacros::ClassMethods)
15
+ config.extend VCR::RSpec::Macros
12
16
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monster_mash
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 1
8
- - 4
9
- version: 0.1.4
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - David Balatero
@@ -14,49 +15,55 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-20 00:00:00 -07:00
18
+ date: 2010-11-30 00:00:00 -08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: typhoeus
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 23
27
30
  segments:
28
31
  - 0
29
- - 1
30
- - 25
31
- version: 0.1.25
32
+ - 2
33
+ - 0
34
+ version: 0.2.0
32
35
  type: :runtime
33
36
  version_requirements: *id001
34
37
  - !ruby/object:Gem::Dependency
35
38
  name: rspec
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
- - - ">="
43
+ - - "="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 25
41
46
  segments:
42
47
  - 1
43
- - 2
44
- - 9
45
- version: 1.2.9
48
+ - 3
49
+ - 1
50
+ version: 1.3.1
46
51
  type: :development
47
52
  version_requirements: *id002
48
53
  - !ruby/object:Gem::Dependency
49
- name: typhoeus_spec_cache
54
+ name: vcr
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ">="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 27
55
62
  segments:
63
+ - 1
64
+ - 3
56
65
  - 0
57
- - 2
58
- - 2
59
- version: 0.2.2
66
+ version: 1.3.0
60
67
  type: :development
61
68
  version_requirements: *id003
62
69
  description: Provides a fun HTTP interface on top of Typhoeus!
@@ -69,11 +76,12 @@ extra_rdoc_files:
69
76
  - LICENSE
70
77
  - README.markdown
71
78
  - README.markdown.html
72
- - TODO
73
79
  files:
74
80
  - .document
75
81
  - .gitignore
76
82
  - CHANGELOG.markdown
83
+ - Gemfile
84
+ - Gemfile.lock
77
85
  - LICENSE
78
86
  - README.markdown
79
87
  - Rakefile
@@ -83,14 +91,14 @@ files:
83
91
  - lib/monster_mash/instance_exec.rb
84
92
  - lib/monster_mash/request.rb
85
93
  - monster_mash.gemspec
86
- - spec/cache/errors/578ef7e62373286feb3e35a6042555a6c0dcde08.cache
87
- - spec/cache/google/cfd676f5f3b7aefc1b4a9038eb4a4de00d2608c8.cache
94
+ - spec/fixtures/vcr_cassettes/google/delegation.yml
95
+ - spec/fixtures/vcr_cassettes/google/error_propagation.yml
96
+ - spec/fixtures/vcr_cassettes/google/valid.yml
88
97
  - spec/monster_mash/base_spec.rb
89
98
  - spec/monster_mash/request_spec.rb
90
99
  - spec/spec.opts
91
100
  - spec/spec_helper.rb
92
101
  - README.markdown.html
93
- - TODO
94
102
  has_rdoc: true
95
103
  homepage: http://github.com/dbalatero/monster_mash
96
104
  licenses: []
@@ -101,23 +109,27 @@ rdoc_options:
101
109
  require_paths:
102
110
  - lib
103
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
104
113
  requirements:
105
114
  - - ">="
106
115
  - !ruby/object:Gem::Version
116
+ hash: 3
107
117
  segments:
108
118
  - 0
109
119
  version: "0"
110
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
111
122
  requirements:
112
123
  - - ">="
113
124
  - !ruby/object:Gem::Version
125
+ hash: 3
114
126
  segments:
115
127
  - 0
116
128
  version: "0"
117
129
  requirements: []
118
130
 
119
131
  rubyforge_project:
120
- rubygems_version: 1.3.6
132
+ rubygems_version: 1.3.7
121
133
  signing_key:
122
134
  specification_version: 3
123
135
  summary: Provides a fun HTTP interface on top of Typhoeus!
data/TODO DELETED
@@ -1 +0,0 @@
1
- * delegate to the original class on method_missing.
@@ -1,22 +0,0 @@
1
- u:Typhoeus::Response---
2
- :headers: |
3
- HTTP/1.1 200 OK
4
- Cache-Control: no-cache, no-store, max-age=0, must-revalidate
5
- Pragma: no-cache
6
- Expires: Fri, 01 Jan 1990 00:00:00 GMT
7
- Date: Thu, 29 Apr 2010 20:07:27 GMT
8
- Content-Type: text/javascript; charset=utf-8
9
- X-Embedded-Status: 200
10
- X-Content-Type-Options: nosniff
11
- X-Frame-Options: SAMEORIGIN
12
- X-XSS-Protection: 1; mode=block
13
- Server: GSE
14
- Transfer-Encoding: chunked
15
-
16
-
17
- :code: 200
18
- :start_time:
19
- :requested_http_method:
20
- :time: 0.190228
21
- :requested_url:
22
- :body: "{\"responseData\": {\"results\":[{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://twitter.com/dbalatero\",\"url\":\"http://twitter.com/dbalatero\",\"visibleUrl\":\"twitter.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:I2apuxLuvJEJ:twitter.com\",\"title\":\"\\u003cb\\u003eDavid Balatero\\u003c/b\\u003e (dbalatero) on Twitter\",\"titleNoFormatting\":\"David Balatero (dbalatero) on Twitter\",\"content\":\"Get short, timely messages from \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e. \\u003cb\\u003e...\\u003c/b\\u003e Name \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e; Location Seattle, WA; Web http://bitwax.cd; Bio computers, cello, bass, startups , \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://twitter.com/travismc\",\"url\":\"http://twitter.com/travismc\",\"visibleUrl\":\"twitter.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:1i1-2yJ6lVMJ:twitter.com\",\"title\":\"Travis McCoy (travismc) on Twitter\",\"titleNoFormatting\":\"Travis McCoy (travismc) on Twitter\",\"content\":\"Bill Ferrell \\u0026middot; Denis Sosnovtsev \\u0026middot; Noah Weiss \\u0026middot; David Wu \\u0026middot; Esther Gregory \\u0026middot; Karl \\u003cb\\u003e...\\u003c/b\\u003e \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e \\u0026middot; knifefight \\u0026middot; aalevy \\u0026middot; Zach Maier \\u0026middot; Natasha Z. Dadabhoy \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://github.com/dbalatero\",\"url\":\"http://github.com/dbalatero\",\"visibleUrl\":\"github.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:Hpe7-K1FTgoJ:github.com\",\"title\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"titleNoFormatting\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"content\":\"dbalatero (\\u003cb\\u003eDavid Balatero\\u003c/b\\u003e). You\\u0026#39;re not logged in! Login \\u0026middot; Pricing \\u0026amp; Signup. Name : \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e. Email. Location: Seattle, WA. Member Since: Mar 02, 2009 \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://github.com/dbalatero/httparty\",\"url\":\"http://github.com/dbalatero/httparty\",\"visibleUrl\":\"github.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:j0vOD5Dd_V0J:github.com\",\"title\":\"dbalatero\\u0026#39;s httparty at master - GitHub\",\"titleNoFormatting\":\"dbalatero\\u0026#39;s httparty at master - GitHub\",\"content\":\"\\u003cb\\u003eDavid Balatero\\u003c/b\\u003e (author). Wed Jul 22 20:28:48 -0700 2009 \\u003cb\\u003e...\\u003c/b\\u003e [\\u003cb\\u003eDavid Balatero\\u003c/b\\u003e]. directory, bin/, Fri Jan 30 21:33:45 -0800 2009, JSON gem no longer dependency \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.plurk.com/dibid\",\"url\":\"http://www.plurk.com/dibid\",\"visibleUrl\":\"www.plurk.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:NTXaJyXNG6gJ:www.plurk.com\",\"title\":\"christine - \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e [dibid] on Plurk\",\"titleNoFormatting\":\"christine - David Balatero [dibid] on Plurk\",\"content\":\"christine - \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e [dibid] on Plurk. \\u003cb\\u003e...\\u003c/b\\u003e \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e. male. Macasandig, Philippines. ako c david but my friends call me balat. :). Relationship: \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.myspace.com/coalminefiresband\",\"url\":\"http://www.myspace.com/coalminefiresband\",\"visibleUrl\":\"www.myspace.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:d5INhINdcT8J:www.myspace.com\",\"title\":\"Coal Mine Fires on MySpace Music - Free Streaming MP3s, Pictures \\u003cb\\u003e...\\u003c/b\\u003e\",\"titleNoFormatting\":\"Coal Mine Fires on MySpace Music - Free Streaming MP3s, Pictures ...\",\"content\":\"\\u003cb\\u003eDavid Balatero\\u003c/b\\u003e - Cello, Double-Bass Abram Shriner - Bass Electrique, \\u003cb\\u003e...\\u003c/b\\u003e My live setup currently consists of \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e, Jack Shriner, and Rob Hanlon. \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.bassmasta.net/w/wooten_victor/132800.html\",\"url\":\"http://www.bassmasta.net/w/wooten_victor/132800.html\",\"visibleUrl\":\"www.bassmasta.net\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:x-_ddwmFZiUJ:www.bassmasta.net\",\"title\":\"Yinin And Yangin Bass Tab \xE2\x80\x94 (by Wooten Victor)\",\"titleNoFormatting\":\"Yinin And Yangin Bass Tab \xE2\x80\x94 (by Wooten Victor)\",\"content\":\"Tabbed by \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e [\\u003cb\\u003edavid\\u003c/b\\u003e.\\u003cb\\u003ebalatero\\u003c/b\\u003e@attbi.com] May 2, 2002 | http://www. davidbalatero.com #################################################### \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://rubylearning.com/blog/2009/06/24/follow-10-rubyists-using-sinatra-on-twitter/\",\"url\":\"http://rubylearning.com/blog/2009/06/24/follow-10-rubyists-using-sinatra-on-twitter/\",\"visibleUrl\":\"rubylearning.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:geLCCIZP4EUJ:rubylearning.com\",\"title\":\"Follow 10+ Rubyists using Sinatra on Twitter\",\"titleNoFormatting\":\"Follow 10+ Rubyists using Sinatra on Twitter\",\"content\":\"Jun 24, 2009 \\u003cb\\u003e...\\u003c/b\\u003e \\u003cb\\u003eDavid Balatero\\u003c/b\\u003e June 25, 2009 at 9:59 pm. I\\u0026#39;m using Sinatra as well \xE2\x80\x94 http:// twitter.com/dbalatero \\u003cb\\u003e...\\u003c/b\\u003e\"}],\"cursor\":{\"pages\":[{\"start\":\"0\",\"label\":1},{\"start\":\"8\",\"label\":2},{\"start\":\"16\",\"label\":3},{\"start\":\"24\",\"label\":4},{\"start\":\"32\",\"label\":5},{\"start\":\"40\",\"label\":6},{\"start\":\"48\",\"label\":7},{\"start\":\"56\",\"label\":8}],\"estimatedResultCount\":\"1230\",\"currentPageIndex\":0,\"moreResultsUrl\":\"http://www.google.com/search?oe\\u003dutf8\\u0026ie\\u003dutf8\\u0026source\\u003duds\\u0026start\\u003d0\\u0026hl\\u003den\\u0026q\\u003ddavid+balatero\"}}, \"responseDetails\": null, \"responseStatus\": 200}"
@@ -1,26 +0,0 @@
1
- u:Typhoeus::Response�---
2
- :headers: !str
3
- str: |
4
- HTTP/1.1 200 OK
5
- Cache-Control: no-cache, no-store, max-age=0, must-revalidate
6
- Pragma: no-cache
7
- Expires: Fri, 01 Jan 1990 00:00:00 GMT
8
- Date: Thu, 29 Apr 2010 17:43:10 GMT
9
- Content-Type: text/javascript; charset=utf-8
10
- X-Embedded-Status: 200
11
- X-Content-Type-Options: nosniff
12
- X-Frame-Options: SAMEORIGIN
13
- X-XSS-Protection: 1; mode=block
14
- Server: GSE
15
- Transfer-Encoding: chunked
16
-
17
-
18
- "@_rails_html_safe": false
19
- :code: 200
20
- :start_time:
21
- :requested_http_method:
22
- :time: 0.237358
23
- :requested_url:
24
- :body: !str
25
- str: "{\"responseData\": {\"results\":[{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.genealogytoday.com/surname/finder.mv?Surname\\u003dBalatero\",\"url\":\"http://www.genealogytoday.com/surname/finder.mv%3FSurname%3DBalatero\",\"visibleUrl\":\"www.genealogytoday.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:5Q-lzaN1lD8J:www.genealogytoday.com\",\"title\":\"\\u003cb\\u003eBalatero\\u003c/b\\u003e Genealogy and Family Tree Resources - Surname Finder\",\"titleNoFormatting\":\"Balatero Genealogy and Family Tree Resources - Surname Finder\",\"content\":\"Free checklist of \\u003cb\\u003eBalatero\\u003c/b\\u003e resources, including online databases, obituaries, surname histories, census and military records, and \\u003cb\\u003eBalatero\\u003c/b\\u003e message boards.\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://suzukiassociation.org/author/b/barbara-balatero/\",\"url\":\"http://suzukiassociation.org/author/b/barbara-balatero/\",\"visibleUrl\":\"suzukiassociation.org\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:e20ZSip7HqkJ:suzukiassociation.org\",\"title\":\"Barbara \\u003cb\\u003eBalatero\\u003c/b\\u003e | Authors | Journal | Suzuki Association of the \\u003cb\\u003e...\\u003c/b\\u003e\",\"titleNoFormatting\":\"Barbara Balatero | Authors | Journal | Suzuki Association of the ...\",\"content\":\"Barbara \\u003cb\\u003eBalatero\\u003c/b\\u003e graduated from Oberlin Conservatory with a Bachelors Degree in Cello Performance and a Masters of Music in Teaching where she studied cello \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://twitter.com/dbalatero\",\"url\":\"http://twitter.com/dbalatero\",\"visibleUrl\":\"twitter.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:I2apuxLuvJEJ:twitter.com\",\"title\":\"David \\u003cb\\u003eBalatero\\u003c/b\\u003e (dbalatero) on Twitter\",\"titleNoFormatting\":\"David Balatero (dbalatero) on Twitter\",\"content\":\"Get short, timely messages from David \\u003cb\\u003eBalatero\\u003c/b\\u003e. \\u003cb\\u003e...\\u003c/b\\u003e Name David \\u003cb\\u003eBalatero\\u003c/b\\u003e; Location Seattle, WA; Web http://bitwax.cd; Bio computers, cello, bass, startups , \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://github.com/dbalatero\",\"url\":\"http://github.com/dbalatero\",\"visibleUrl\":\"github.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:Hpe7-K1FTgoJ:github.com\",\"title\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"titleNoFormatting\":\"dbalatero\\u0026#39;s Profile - GitHub\",\"content\":\"dbalatero (David \\u003cb\\u003eBalatero\\u003c/b\\u003e). You\\u0026#39;re not logged in! Login \\u0026middot; Pricing \\u0026amp; Signup. Name : David \\u003cb\\u003eBalatero\\u003c/b\\u003e. Email. Location: Seattle, WA. Member Since: Mar 02, 2009 \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.facebook.com/profile.php?id\\u003d100000758484772\",\"url\":\"http://www.facebook.com/profile.php%3Fid%3D100000758484772\",\"visibleUrl\":\"www.facebook.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:WmqpSliPP2UJ:www.facebook.com\",\"title\":\"Elkie \\u003cb\\u003eBalatero\\u003c/b\\u003e | Facebook\",\"titleNoFormatting\":\"Elkie Balatero | Facebook\",\"content\":\"Elkie \\u003cb\\u003eBalatero\\u003c/b\\u003e is on Facebook. Join Facebook to connect with Elkie \\u003cb\\u003eBalatero\\u003c/b\\u003e and others you may know. Facebook gives people the power to share and makes the \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.travelpuertogalera.com/balatero.htm\",\"url\":\"http://www.travelpuertogalera.com/balatero.htm\",\"visibleUrl\":\"www.travelpuertogalera.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:AcJwGQZoG8cJ:www.travelpuertogalera.com\",\"title\":\"Puerto Galera/\\u003cb\\u003eBalatero\\u003c/b\\u003e\",\"titleNoFormatting\":\"Puerto Galera/Balatero\",\"content\":\"and other establishments in \\u003cb\\u003eBalatero\\u003c/b\\u003e, Puerto Galera, Oriental Mindoro, the Philippines \\u003cb\\u003e....\\u003c/b\\u003e Nagura Beach Resort, \\u003cb\\u003eBalatero\\u003c/b\\u003e, Cellular Tel. 0917-6411705 \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://members.virtualtourist.com/m/22b26/158575/\",\"url\":\"http://members.virtualtourist.com/m/22b26/158575/\",\"visibleUrl\":\"members.virtualtourist.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:AvJUiChXSyUJ:members.virtualtourist.com\",\"title\":\"\\u003cb\\u003eBalatero\\u003c/b\\u003e - \\u003cb\\u003eBalatero\\u003c/b\\u003e, Philippines - VirtualTourist.com\",\"titleNoFormatting\":\"Balatero - Balatero, Philippines - VirtualTourist.com\",\"content\":\"\\u003cb\\u003eBalatero\\u003c/b\\u003e travel tips, recommendations, reviews, photos and more from VirtualTourist member, StefanosS. Get insider travel tips for \\u003cb\\u003eBalatero\\u003c/b\\u003e, \\u003cb\\u003e...\\u003c/b\\u003e\"},{\"GsearchResultClass\":\"GwebSearch\",\"unescapedUrl\":\"http://www.meetup.com/UWStartupWeekend/members/11927921/\",\"url\":\"http://www.meetup.com/UWStartupWeekend/members/11927921/\",\"visibleUrl\":\"www.meetup.com\",\"cacheUrl\":\"http://www.google.com/search?q\\u003dcache:xoC5EPOYVk0J:www.meetup.com\",\"title\":\"Katy \\u003cb\\u003eBalatero\\u003c/b\\u003e - UW Startup Weekend (Seattle, WA) - Meetup.com\",\"titleNoFormatting\":\"Katy Balatero - UW Startup Weekend (Seattle, WA) - Meetup.com\",\"content\":\"Apr 19, 2010 \\u003cb\\u003e...\\u003c/b\\u003e I\\u0026#39;ma graduate student at the UW studying digital media communications. I don\\u0026#39;t have a solid startup idea, but I am interested in finding a \\u003cb\\u003e...\\u003c/b\\u003e\"}],\"cursor\":{\"pages\":[{\"start\":\"0\",\"label\":1},{\"start\":\"8\",\"label\":2},{\"start\":\"16\",\"label\":3},{\"start\":\"24\",\"label\":4},{\"start\":\"32\",\"label\":5},{\"start\":\"40\",\"label\":6},{\"start\":\"48\",\"label\":7},{\"start\":\"56\",\"label\":8}],\"estimatedResultCount\":\"3230\",\"currentPageIndex\":0,\"moreResultsUrl\":\"http://www.google.com/search?oe\\u003dutf8\\u0026ie\\u003dutf8\\u0026source\\u003duds\\u0026start\\u003d0\\u0026hl\\u003den\\u0026q\\u003dbalatero\"}}, \"responseDetails\": null, \"responseStatus\": 200}"
26
- "@_rails_html_safe": false