hamburglar 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -104,4 +104,4 @@ gateway is minFraud.
104
104
 
105
105
  ## Copyright
106
106
 
107
- Copyright (c) 2011 Site5 LLC. See LICENSE for details.
107
+ Copyright (c) 2012 Site5.com. See LICENSE for details.
data/lib/hamburglar.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'hamburglar/errors'
2
+ require 'faraday'
3
+ require 'faraday_middleware'
2
4
 
3
5
  module Hamburglar
4
6
  autoload :Version, 'hamburglar/version'
@@ -124,29 +124,14 @@ module Hamburglar
124
124
  end
125
125
 
126
126
  # Performs a GET request on the given URI, redirects if needed
127
- #
128
- # See Following Redirection at
129
- # http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
130
127
  def fetch(uri_str, limit = 10)
131
128
  # You should choose better exception.
132
129
  raise ArgumentError, 'HTTP redirect too deep' if limit == 0
133
-
134
- uri = URI.parse(uri_str)
135
- http = Net::HTTP.new(uri.host, uri.port)
136
- if uri.scheme == 'https'
137
- http.use_ssl = true
138
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
139
- http.ca_file = File.expand_path('../../../cacert.pem', __FILE__)
140
- end
141
- request = Net::HTTP::Get.new(uri.request_uri)
142
- response = http.start { |http| http.request(request) }
143
-
144
- case response
145
- when Net::HTTPSuccess then response
146
- when Net::HTTPRedirection then fetch(response['location'], limit - 1)
147
- else
148
- response.error!
149
- end
130
+ Faraday.new(:url => uri_str, :ssl => {:verify => true, :ca_file => File.expand_path('../../../cacert.pem', __FILE__)}) do |c|
131
+ c.response :raise_error
132
+ c.response :follow_redirects, :limit => limit
133
+ c.adapter :net_http
134
+ end.get
150
135
  end
151
136
 
152
137
  end
@@ -1,3 +1,3 @@
1
1
  module Hamburglar
2
- VERSION = Version = '0.1.1'
2
+ VERSION = Version = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamburglar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,59 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-03 00:00:00.000000000 Z
12
+ date: 2012-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: faraday_middleware
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.8.5
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.8.5
14
46
  - !ruby/object:Gem::Dependency
15
47
  name: rspec
16
- requirement: &21584760 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
17
49
  none: false
18
50
  requirements:
19
51
  - - ~>
20
52
  - !ruby/object:Gem::Version
21
- version: '2.6'
53
+ version: 2.10.0
22
54
  type: :development
23
55
  prerelease: false
24
- version_requirements: *21584760
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.10.0
25
62
  - !ruby/object:Gem::Dependency
26
63
  name: rake
27
- requirement: &21584260 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
28
65
  none: false
29
66
  requirements:
30
67
  - - ~>
@@ -32,10 +69,15 @@ dependencies:
32
69
  version: 0.9.2.2
33
70
  type: :development
34
71
  prerelease: false
35
- version_requirements: *21584260
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.9.2.2
36
78
  - !ruby/object:Gem::Dependency
37
79
  name: fakeweb
38
- requirement: &21583660 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
39
81
  none: false
40
82
  requirements:
41
83
  - - ~>
@@ -43,10 +85,15 @@ dependencies:
43
85
  version: 1.3.0
44
86
  type: :development
45
87
  prerelease: false
46
- version_requirements: *21583660
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.3.0
47
94
  - !ruby/object:Gem::Dependency
48
95
  name: vcr
49
- requirement: &21583080 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
50
97
  none: false
51
98
  requirements:
52
99
  - - ~>
@@ -54,7 +101,12 @@ dependencies:
54
101
  version: '1.10'
55
102
  type: :development
56
103
  prerelease: false
57
- version_requirements: *21583080
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.10'
58
110
  description: Hamburglar helps you prevent fraudulent orders
59
111
  email: jpriddle@site5.com
60
112
  executables: []
@@ -88,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
140
  version: '0'
89
141
  segments:
90
142
  - 0
91
- hash: 2236720283326898591
143
+ hash: -2045735654354073817
92
144
  required_rubygems_version: !ruby/object:Gem::Requirement
93
145
  none: false
94
146
  requirements:
@@ -97,10 +149,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
149
  version: '0'
98
150
  segments:
99
151
  - 0
100
- hash: 2236720283326898591
152
+ hash: -2045735654354073817
101
153
  requirements: []
102
154
  rubyforge_project:
103
- rubygems_version: 1.8.11
155
+ rubygems_version: 1.8.23
104
156
  signing_key:
105
157
  specification_version: 3
106
158
  summary: Hamburglar helps you prevent fraudulent orders