typhoid 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -17,3 +17,5 @@ tmp
17
17
  .yardoc
18
18
  _yardoc
19
19
  doc/
20
+
21
+ Gemfile.lock
data/.irbrc ADDED
@@ -0,0 +1,2 @@
1
+ $:<< "./lib"
2
+ require 'typhoid'
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
4
+ - 2.0.0
5
+ gemfile:
6
+ - gemfiles/Gemfile.typhoeus-0.4.2
7
+ - gemfiles/Gemfile.typhoeus-0.6.3
data/README.md CHANGED
@@ -1,3 +1,50 @@
1
- # This Repository Has Moved
1
+ # Typhoid
2
2
 
3
- No new commits will be made here. Visit [sportngin/typhoid](https://github.com/sportngin/typhoid) for the latest work on this project.
3
+ [![TravisCI](https://secure.travis-ci.org/tstmedia/typhoid.png "TravisCI")](http://travis-ci.org/tstmedia/typhoid "Travis-CI Typhoid")
4
+
5
+ A lightweight ORM-like wrapper around [Typhoeus](http://typhoeus.github.com/)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'typhoid'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install typhoid
20
+
21
+ ## Usage
22
+
23
+ ### Class Setup
24
+
25
+ ```ruby
26
+ require 'typhoid'
27
+
28
+ class Game < Typhoid::Resource
29
+ field :id # What fields we want to deal with on a response/request
30
+ field :team_1_name
31
+ field :team_2_name
32
+ field :start_time
33
+
34
+ self.site = 'http://localhost:3000/' # The base-url for where we plan to retrieve data
35
+ self.path = 'games/' # Specific path to get the data for this Class
36
+
37
+ def self.get_game
38
+ build_request("http://localhost:3000/games/1")
39
+ end
40
+ end
41
+ ```
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Write some tests (Yes now.. [`vim spec/...`])
48
+ 4. Commit your changes (`git commit -am 'Added some feature'`)
49
+ 5. Push to the branch (`git push origin my-new-feature`)
50
+ 6. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+
5
+ # Specify your gem's dependencies in typhoid.gemspec
6
+ gemspec path: "../"
7
+
8
+ gem "typhoeus", "~> 0.4.2"
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+
5
+ # Specify your gem's dependencies in typhoid.gemspec
6
+ gemspec path: "../"
7
+
8
+ gem "typhoeus", "~> 0.6.3"
@@ -5,28 +5,24 @@ module Typhoid
5
5
 
6
6
  def initialize(hydra, name, req, target)
7
7
  self.name = name
8
- self.request = Typhoeus::Request.new(req.request_uri, req.options)
8
+ self.request = Request.new(req.request_uri, req.options)
9
9
  self.klass = req.klass
10
10
  self.target = target
11
- hydra.queue(self.request)
11
+ hydra.queue(request)
12
12
  end
13
13
 
14
14
  def on_complete
15
- self.request.on_complete do
15
+ request.on_complete do
16
16
  yield self if block_given?
17
17
  end
18
18
  end
19
19
 
20
20
  def status
21
- self.request.handled_response.code
21
+ response.code
22
22
  end
23
23
 
24
24
  def response
25
- self.request.handled_response
26
- end
27
-
28
- def klass
29
- @klass
25
+ request.response
30
26
  end
31
27
  end
32
28
  end
@@ -0,0 +1,72 @@
1
+ require 'typhoeus'
2
+ module Typhoid
3
+ class Request < TyphoeusDecorator
4
+ decorate ::Typhoeus::Request
5
+
6
+ ACCESSOR_OPTIONS = [
7
+ :method,
8
+ :params,
9
+ :body,
10
+ :headers,
11
+ :cache_key_basis,
12
+ :connect_timeout,
13
+ :timeout,
14
+ :user_agent,
15
+ :response,
16
+ :cache_timeout,
17
+ :follow_location,
18
+ :max_redirects,
19
+ :proxy,
20
+ :proxy_username,
21
+ :proxy_password,
22
+ :disable_ssl_peer_verification,
23
+ :disable_ssl_host_verification,
24
+ :interface,
25
+ :ssl_cert,
26
+ :ssl_cert_type,
27
+ :ssl_key,
28
+ :ssl_key_type,
29
+ :ssl_key_password,
30
+ :ssl_cacert,
31
+ :ssl_capath,
32
+ :ssl_version,
33
+ :verbose,
34
+ :username,
35
+ :password,
36
+ :auth_method,
37
+ :proxy_auth_method,
38
+ :proxy_type
39
+ ]
40
+
41
+ def run
42
+ if Typhoid.typhoeus.major_version == 0
43
+ if Typhoid.typhoeus.minor_version >= 6
44
+ response = source.run
45
+ else
46
+ response = Typhoeus::Request.send(method, url, options)
47
+ end
48
+ end
49
+ Typhoid::Response.new response
50
+ end
51
+
52
+ def response
53
+ compat [:handled_response, :response]
54
+ end
55
+
56
+ # Need to force override, because Object#method
57
+ def method
58
+ source.respond_to?(:method) && source.method || options[:method] || :get
59
+ end
60
+
61
+ def options
62
+ if source.respond_to?(:options)
63
+ source.options
64
+ else
65
+ ACCESSOR_OPTIONS.reduce({}) do |hash, key|
66
+ hash[key] = source.send(key) if source.respond_to?(:key)
67
+ hash
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -1,29 +1,48 @@
1
1
  module Typhoid
2
2
  class RequestBuilder
3
3
  attr_accessor :klass
4
+ attr_accessor :request_options
5
+ attr_accessor :request_uri
6
+
4
7
  attr_writer :method
5
8
 
6
9
  def initialize(klass, uri, options = {})
7
- @uri = uri
8
- @request_options = options
9
- @klass = klass
10
- end
11
-
12
- def request_uri
13
- @uri
10
+ self.request_uri = uri
11
+ self.request_options = options || {}
12
+ self.klass = klass
14
13
  end
15
14
 
16
15
  def options
17
- @request_options
16
+ symbolize_keys({ method: http_method }.merge(request_options.reject { |_,value| value.nil? }))
18
17
  end
19
18
 
20
19
  def http_method
21
- options[:method] || :get
20
+ request_options[:method] || :get
22
21
  end
23
22
 
24
23
  def run
25
24
  klass.run(self)
26
25
  end
26
+
27
+ private
28
+
29
+ # Ethon hates on hash with indifferent access for some reason
30
+ def symbolize_keys(hash)
31
+ hash = hash.to_hash
32
+ if hash.respond_to?(:symbolize_keys)
33
+ hash.symbolize_keys
34
+ else
35
+ hash.inject({}) do |new_hash, (key, value)|
36
+ new_hash[symbolize_key(key)] = value
37
+ new_hash
38
+ end
39
+ end
40
+ end
41
+
42
+ def symbolize_key(key)
43
+ return key if key.is_a?(Symbol)
44
+ key.to_s.to_sym
45
+ end
27
46
  end
28
47
  end
29
48
 
@@ -17,8 +17,7 @@ module Typhoid
17
17
  end
18
18
 
19
19
  def self.run(request)
20
- method = request.http_method
21
- build(request.klass, (Typhoeus::Request.send method, request.request_uri, request.options))
20
+ build(request.klass, (Request.new(request.request_uri, request.options).run))
22
21
  end
23
22
 
24
23
  def self.uri_join(*paths)
@@ -50,19 +49,21 @@ module Typhoid
50
49
  end
51
50
 
52
51
  def save(method = nil)
52
+ request = save_request(method)
53
53
  request_and_load do
54
- Typhoeus::Request.send save_http_method(method), save_request.request_uri, save_request.options
54
+ Request.new(request.request_uri, request.options).run
55
55
  end
56
56
  end
57
57
 
58
58
  def destroy
59
59
  request_and_load do
60
- Typhoeus::Request.delete(delete_request.request_uri, delete_request.options)
60
+ Request.new(delete_request.request_uri, delete_request.options).run
61
61
  end
62
62
  end
63
63
 
64
- def save_request
65
- (new_record?) ? create_request : update_request
64
+ def save_request(method = nil)
65
+ method ||= save_http_method(method)
66
+ (new_record?) ? create_request(method) : update_request(method)
66
67
  end
67
68
 
68
69
  def save_http_method(method = nil)
@@ -102,14 +103,17 @@ module Typhoid
102
103
  end
103
104
 
104
105
  def create_request(method = :post)
106
+ method ||= :post
105
107
  Typhoid::RequestBuilder.new(self.class, request_uri, :body => to_params.to_json, :method => method, :headers => {"Content-Type" => 'application/json'})
106
108
  end
107
109
 
108
110
  def update_request(method = :put)
111
+ method ||= :put
109
112
  Typhoid::RequestBuilder.new(self.class, request_uri, :body => to_params.to_json, :method => method, :headers => {"Content-Type" => 'application/json'})
110
113
  end
111
114
 
112
115
  def delete_request(method = :delete)
116
+ method ||= :delete
113
117
  Typhoid::RequestBuilder.new(self.class, request_uri, :method => method)
114
118
  end
115
119
  end
@@ -0,0 +1,6 @@
1
+ require 'typhoeus'
2
+ module Typhoid
3
+ class Response < TyphoeusDecorator
4
+ decorate ::Typhoeus::Response
5
+ end
6
+ end
@@ -0,0 +1,82 @@
1
+ module Typhoid
2
+ class TyphoeusDecorator
3
+ def self.decorate(typhoeus_klass)
4
+ @source_klass = typhoeus_klass
5
+ end
6
+
7
+ def self.source_klass
8
+ @source_klass
9
+ end
10
+
11
+ def self.new(*args, &block)
12
+ if args.first.is_a?(self)
13
+ args.first
14
+ elsif args.first.is_a?(source_klass)
15
+ super
16
+ else
17
+ super(source_klass.new(*args, &block))
18
+ end
19
+ end
20
+
21
+ def self.method_missing(method_name, *args, &block)
22
+ if source_klass.respond_to? method_name
23
+ source_klass.public_send method_name, *args, &block
24
+ else
25
+ super
26
+ end
27
+ end
28
+
29
+ def self.respond_to?(method_name, include_private = false)
30
+ source_klass.respond_to?(method_name) || super
31
+ end
32
+
33
+ def self.inspect
34
+ "#{self.name}Decorator(#{source_klass.name})"
35
+ end
36
+
37
+ attr_reader :source
38
+
39
+ def initialize(source)
40
+ @source = source
41
+ end
42
+
43
+ def ==(other)
44
+ other == source
45
+ end
46
+
47
+ def kind_of?(klass)
48
+ super || source.kind_of?(klass)
49
+ end
50
+ alias_method :is_a?, :kind_of?
51
+
52
+ def instance_of?(klass)
53
+ super || source.instance_of?(klass)
54
+ end
55
+
56
+ def compat(method_names, *args, &block)
57
+ method_to_call = Array(method_names).find { |method_name| respond_to? method_name }
58
+ if method_to_call
59
+ source.public_send method_to_call, *args, &block
60
+ else
61
+ raise TyphoeusCompatabilityError,
62
+ "Typhoeus API has changed, we don't know how to get response. We know about [:handled_response, :response]"
63
+ end
64
+ end
65
+
66
+ def inspect
67
+ "#<#{self.class.name} source: (#{source.inspect})>"
68
+ end
69
+
70
+ def method_missing(method_name, *args, &block)
71
+ if source.respond_to? method_name
72
+ source.public_send method_name, *args, &block
73
+ else
74
+ super
75
+ end
76
+ end
77
+
78
+ def respond_to?(method_name, include_private = false)
79
+ source.respond_to?(method_name) || super
80
+ end
81
+ end
82
+ end
@@ -1,3 +1,3 @@
1
1
  module Typhoid
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/typhoid.rb CHANGED
@@ -2,6 +2,40 @@ require "typhoid/version"
2
2
  require 'typhoid/uri'
3
3
  require 'typhoid/parser'
4
4
  require 'typhoid/builder'
5
+
6
+ module Typhoid
7
+ TyphoeusCompatabilityError = Class.new StandardError
8
+
9
+ def self.typhoeus
10
+ @typhoeus ||= TyphoeusDescriptor.new
11
+ end
12
+
13
+ class TyphoeusDescriptor
14
+ def version
15
+ Typhoeus::VERSION
16
+ end
17
+
18
+ def matched_version
19
+ version.to_s.match /(?<major>\d+)\.(?<minor>\d+)\.(?<bug>\d+)/
20
+ end
21
+
22
+ def major_version
23
+ matched_version[:major].to_i
24
+ end
25
+
26
+ def minor_version
27
+ matched_version[:minor].to_i
28
+ end
29
+
30
+ def bug_version
31
+ matched_version[:bug].to_i
32
+ end
33
+ end
34
+ end
35
+
36
+ require 'typhoid/typhoeus_decorator'
37
+ require 'typhoid/request'
38
+ require 'typhoid/response'
5
39
  require "typhoid/request_queue"
6
40
  require "typhoid/queued_request"
7
41
  require "typhoid/multi"
@@ -4,30 +4,43 @@ require 'json'
4
4
 
5
5
  describe Typhoid::Multi do
6
6
  context "making multiple requests" do
7
- before(:each) do
8
- @fake_hydra = Typhoeus::Hydra.new
9
- game = Typhoeus::Response.new(:code => 200, :headers => "", :body => {"team_1_name" => "Bears"}.to_json, :time => 0.03)
10
- @fake_hydra.stub(:get, "http://localhost:3000/games/1").and_return(game)
11
-
12
- stats = Typhoeus::Response.new(:code => 200, :headers => "",
13
- :body => [{'player_name' => 'Bob', 'goals' => 1}, {'player_name' => 'Mike', 'goals' => 1}].to_json, :time => 0.02)
14
- @fake_hydra.stub(:get, "http://localhost:3000/stats/2").and_return(stats)
7
+ def new_typhoeus?
8
+ Typhoid.typhoeus.major_version == 0 && Typhoid.typhoeus.minor_version >= 6
9
+ end
10
+
11
+ def typhoeus_stub(verb, url, response, hydra)
12
+ if new_typhoeus?
13
+ Typhoeus.stub(url).and_return response
14
+ else
15
+ hydra.stub(verb, url).and_return(response)
16
+ end
17
+ end
18
+
19
+
20
+ let(:fake_hydra) { Typhoeus::Hydra.new }
21
+ before do
22
+ game = Typhoid::Response.new(:code => 200, :headers => "", :body => {"team_1_name" => "Bears"}.to_json, :time => 0.03)
23
+ typhoeus_stub :get, "http://localhost:3000/games/1", game, fake_hydra
24
+
25
+ stats = Typhoid::Response.new(:code => 200, :headers => "",
26
+ :body => [{'player_name' => 'Bob', 'goals' => 1}, {'player_name' => 'Mike', 'goals' => 1}].to_json, :time => 0.02)
27
+ typhoeus_stub :get, "http://localhost:3000/stats/2", stats, fake_hydra
15
28
  end
16
29
 
17
30
  it "should assign the response to instance variables" do
18
31
  controller = Controller.new
19
- controller.remote_resources(@fake_hydra) do |req|
32
+ controller.remote_resources(fake_hydra) do |req|
20
33
  req.resource(:game, Game.get_game)
21
34
  req.resource(:stats, PlayerStat.get_stats)
22
35
  end
23
36
  #games returns a single object
24
- controller.instance_variable_get("@game").class.should eql Game
25
- controller.instance_variable_get("@game").team_1_name.should eql "Bears"
37
+ controller.instance_variable_get("@game").class.should == Game
38
+ controller.instance_variable_get("@game").team_1_name.should == "Bears"
26
39
 
27
40
  #stats returns an array
28
- controller.instance_variable_get("@stats").class.should eql Array
29
- controller.instance_variable_get("@stats")[0].class.should eql PlayerStat
30
- controller.instance_variable_get("@stats")[0].player_name.should eql 'Bob'
41
+ controller.instance_variable_get("@stats").class.should == Array
42
+ controller.instance_variable_get("@stats")[0].class.should == PlayerStat
43
+ controller.instance_variable_get("@stats")[0].player_name.should == 'Bob'
31
44
  end
32
45
  end
33
46
  end
@@ -1,6 +1,18 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe Typhoid::Resource do
4
+ def new_typhoeus?
5
+ Typhoid.typhoeus.major_version == 0 && Typhoid.typhoeus.minor_version >= 6
6
+ end
7
+
8
+ def typhoeus_stub(verb, url, response, hydra)
9
+ if new_typhoeus?
10
+ Typhoeus.stub(url).and_return response
11
+ else
12
+ hydra.stub(verb, url).and_return(response)
13
+ end
14
+ end
15
+
4
16
  it "synchronizes field with attribute" do
5
17
  response_data = {"team_1_name" => 'Bears', "team_2_name" => 'Lions'}
6
18
  game = Game.new(response_data)
@@ -23,64 +35,68 @@ describe Typhoid::Resource do
23
35
  it "should populate defined attributes" do
24
36
  response_data = {"team_1_name" => 'Bears', "team_2_name" => 'Lions'}
25
37
  game = Game.new(response_data)
26
- game.team_1_name.should eql 'Bears'
38
+ game.team_1_name.should == 'Bears'
27
39
  game.start_time.should be_nil
28
40
  end
29
41
 
30
42
  it "should populate attributes" do
31
43
  game = Game.new({"team_1_name" => 'Bears', "team_2_name" => 'Lions'})
32
- game.read_attribute(:team_1_name).should eql 'Bears'
33
- game[:team_2_name].should eql 'Lions'
44
+ game.read_attribute(:team_1_name).should == 'Bears'
45
+ game[:team_2_name].should == 'Lions'
34
46
  end
35
47
 
36
48
  it "should return the request path" do
37
49
  game = Game.new
38
- game.request_uri.should eql "http://localhost:3000/games"
50
+ game.request_uri.should == "http://localhost:3000/games"
39
51
  end
40
52
 
41
53
  context "making a standalone request" do
42
- after { hydra.clear_stubs }
43
54
  let(:hydra) { Typhoeus::Hydra.hydra }
44
55
  let(:game_response) { Typhoeus::Response.new(:code => 200, :headers => "", :body => {"team_1_name" => "Bears", "id" => "1"}.to_json) }
45
56
  let(:failed_game_response) { Typhoeus::Response.new(:code => 404, :headers => "", :body => {}.to_json) }
57
+
58
+ before do
59
+ hydra.clear_stubs unless new_typhoeus?
60
+ end
61
+
46
62
  it "should retrieve an object" do
47
- hydra.stub(:get, "http://localhost:3000/games/1").and_return(game_response)
63
+ typhoeus_stub(:get, "http://localhost:3000/games/1", game_response, hydra)
48
64
 
49
65
  game = Game.get_game.run
50
- game.class.should eql Game
51
- game.team_1_name.should eql 'Bears'
66
+ game.class.should == Game
67
+ game.team_1_name.should == 'Bears'
52
68
  end
53
69
 
54
70
  it "raises error on save!" do
55
- hydra.stub(:post, "http://localhost:3000/games").and_return(failed_game_response)
71
+ typhoeus_stub(:post, "http://localhost:3000/games", failed_game_response, hydra)
56
72
 
57
73
  game = Game.new
58
74
  expect { game.save! }.to raise_error
59
75
  end
60
76
 
61
77
  it "raises error on destroy!" do
62
- hydra.stub(:delete, "http://localhost:3000/games/1").and_return(failed_game_response)
78
+ typhoeus_stub(:delete, "http://localhost:3000/games/1", failed_game_response, hydra)
63
79
 
64
80
  game = Game.new("id" => 1, "team_1_name" => 'Tigers')
65
81
  expect { game.destroy! }.to raise_error
66
82
  end
67
83
 
68
84
  it "raises error on save!" do
69
- hydra.stub(:post, "http://localhost:3000/games").and_return(game_response)
85
+ typhoeus_stub(:post, "http://localhost:3000/games", game_response, hydra)
70
86
 
71
87
  game = Game.new
72
88
  expect { game.save! }.to_not raise_error
73
89
  end
74
90
 
75
91
  it "raises error on save!" do
76
- hydra.stub(:delete, "http://localhost:3000/games/1").and_return(game_response)
92
+ typhoeus_stub(:delete, "http://localhost:3000/games/1", game_response, hydra)
77
93
 
78
94
  game = Game.new("id" => 1, "team_1_name" => 'Tigers')
79
95
  expect { game.destroy! }.to_not raise_error
80
96
  end
81
97
 
82
98
  it "should create an object" do
83
- hydra.stub(:post, "http://localhost:3000/games").and_return(game_response)
99
+ typhoeus_stub(:post, "http://localhost:3000/games", game_response, hydra)
84
100
 
85
101
  game = Game.new
86
102
  game.save
@@ -90,8 +106,8 @@ describe Typhoid::Resource do
90
106
  end
91
107
 
92
108
  it "should update an object" do
93
- update_response = Typhoeus::Response.new(:code => 200, :headers => "", :body => {"team_1_name" => "Bears", "id" => "1"}.to_json)
94
- hydra.stub(:put, "http://localhost:3000/games/1").and_return(update_response)
109
+ update_response = Typhoid::Response.new(:code => 200, :headers => "", :body => {"team_1_name" => "Bears", "id" => "1"}.to_json)
110
+ typhoeus_stub(:put, "http://localhost:3000/games/1", update_response, hydra)
95
111
 
96
112
  game = Game.new("id" => 1, "team_1_name" => 'Tigers')
97
113
  game.save
@@ -101,32 +117,31 @@ describe Typhoid::Resource do
101
117
  end
102
118
 
103
119
  it "should delete an object" do
104
- hydra.stub(:delete, "http://localhost:3000/games/1").and_return(game_response)
120
+ typhoeus_stub(:delete, "http://localhost:3000/games/1", game_response, hydra)
105
121
 
106
122
  game = Game.new("id" => 1, "team_1_name" => 'Tigers')
107
123
  game.destroy
108
124
 
109
- game.resource_exception.should be nil
110
-
125
+ game.resource_exception.should be_nil
111
126
  end
112
127
 
113
128
  it "should be able to specify save http verb" do
114
- update_response = Typhoeus::Response.new(:code => 200, :headers => "", :body => {"team_1_name" => "Bears", "id" => "1"}.to_json)
115
- hydra.stub(:post, "http://localhost:3000/games/1").and_return(update_response)
129
+ update_response = Typhoid::Response.new(:code => 200, :headers => "", :body => {"team_1_name" => "Bears", "id" => "1"}.to_json)
130
+ typhoeus_stub(:post, "http://localhost:3000/games/1", update_response, hydra)
116
131
 
117
132
  game = Game.new("id" => 1, "team_1_name" => 'Tigers')
118
133
  game.save(:post)
119
134
 
120
- game.resource_exception.should be nil
135
+ game.resource_exception.should be_nil
121
136
 
122
137
  end
123
138
  end
124
139
 
125
140
  context "handling bad requests" do
126
141
  let(:fake_hydra) { Typhoeus::Hydra.new }
142
+ let(:bad_game) { Typhoid::Response.new(:code => 500, :headers => "", :body => "<htmlasdfasdfasdf") }
127
143
  before do
128
- bad_game = Typhoeus::Response.new(:code => 500, :headers => "", :body => "<htmlasdfasdfasdf")
129
- fake_hydra.stub(:get, "http://localhost:3000/games/1").and_return(bad_game)
144
+ typhoeus_stub(:get, "http://localhost:3000/games/1", bad_game, fake_hydra)
130
145
  end
131
146
 
132
147
  it "should assign an exception object on a bad request" do
data/typhoid.gemspec CHANGED
@@ -15,7 +15,8 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Typhoid::VERSION
17
17
 
18
- gem.add_dependency 'typhoeus', "0.4.2"
18
+ gem.add_dependency 'ffi'
19
+ gem.add_dependency 'typhoeus', "~> 0.4"
19
20
 
20
21
  gem.add_development_dependency 'rspec'
21
22
  gem.add_development_dependency 'json_pure', [">= 1.4.1"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typhoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,24 +10,40 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-28 00:00:00.000000000 Z
13
+ date: 2013-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ffi
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
15
31
  - !ruby/object:Gem::Dependency
16
32
  name: typhoeus
17
33
  requirement: !ruby/object:Gem::Requirement
18
34
  none: false
19
35
  requirements:
20
- - - '='
36
+ - - ~>
21
37
  - !ruby/object:Gem::Version
22
- version: 0.4.2
38
+ version: '0.4'
23
39
  type: :runtime
24
40
  prerelease: false
25
41
  version_requirements: !ruby/object:Gem::Requirement
26
42
  none: false
27
43
  requirements:
28
- - - '='
44
+ - - ~>
29
45
  - !ruby/object:Gem::Version
30
- version: 0.4.2
46
+ version: '0.4'
31
47
  - !ruby/object:Gem::Dependency
32
48
  name: rspec
33
49
  requirement: !ruby/object:Gem::Requirement
@@ -69,21 +85,27 @@ extensions: []
69
85
  extra_rdoc_files: []
70
86
  files:
71
87
  - .gitignore
88
+ - .irbrc
72
89
  - .rvmrc
90
+ - .travis.yml
73
91
  - Gemfile
74
- - Gemfile.lock
75
92
  - LICENSE
76
93
  - README.md
77
94
  - Rakefile
95
+ - gemfiles/Gemfile.typhoeus-0.4.2
96
+ - gemfiles/Gemfile.typhoeus-0.6.3
78
97
  - lib/typhoid.rb
79
98
  - lib/typhoid/attributes.rb
80
99
  - lib/typhoid/builder.rb
81
100
  - lib/typhoid/multi.rb
82
101
  - lib/typhoid/parser.rb
83
102
  - lib/typhoid/queued_request.rb
103
+ - lib/typhoid/request.rb
84
104
  - lib/typhoid/request_builder.rb
85
105
  - lib/typhoid/request_queue.rb
86
106
  - lib/typhoid/resource.rb
107
+ - lib/typhoid/response.rb
108
+ - lib/typhoid/typhoeus_decorator.rb
87
109
  - lib/typhoid/uri.rb
88
110
  - lib/typhoid/version.rb
89
111
  - spec/spec_helper.rb
@@ -112,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
134
  version: '0'
113
135
  segments:
114
136
  - 0
115
- hash: 1271794916733931674
137
+ hash: 1764376195889055492
116
138
  required_rubygems_version: !ruby/object:Gem::Requirement
117
139
  none: false
118
140
  requirements:
@@ -121,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
143
  version: '0'
122
144
  segments:
123
145
  - 0
124
- hash: 1271794916733931674
146
+ hash: 1764376195889055492
125
147
  requirements: []
126
148
  rubyforge_project:
127
149
  rubygems_version: 1.8.24
data/Gemfile.lock DELETED
@@ -1,34 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- typhoid (0.0.2)
5
- typhoeus (= 0.4.2)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- diff-lcs (1.1.3)
11
- ffi (1.0.11)
12
- json_pure (1.7.3)
13
- mime-types (1.18)
14
- rake (0.9.2.2)
15
- rspec (2.10.0)
16
- rspec-core (~> 2.10.0)
17
- rspec-expectations (~> 2.10.0)
18
- rspec-mocks (~> 2.10.0)
19
- rspec-core (2.10.1)
20
- rspec-expectations (2.10.0)
21
- diff-lcs (~> 1.1.3)
22
- rspec-mocks (2.10.1)
23
- typhoeus (0.4.2)
24
- ffi (~> 1.0)
25
- mime-types (~> 1.18)
26
-
27
- PLATFORMS
28
- ruby
29
-
30
- DEPENDENCIES
31
- json_pure (>= 1.4.1)
32
- rake
33
- rspec
34
- typhoid!