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 +1 -1
- data/lib/hamburglar.rb +2 -0
- data/lib/hamburglar/gateways/base.rb +5 -20
- data/lib/hamburglar/version.rb +1 -1
- metadata +66 -14
data/README.markdown
CHANGED
data/lib/hamburglar.rb
CHANGED
@@ -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
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
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
|
data/lib/hamburglar/version.rb
CHANGED
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.
|
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-
|
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:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
17
49
|
none: false
|
18
50
|
requirements:
|
19
51
|
- - ~>
|
20
52
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
53
|
+
version: 2.10.0
|
22
54
|
type: :development
|
23
55
|
prerelease: false
|
24
|
-
version_requirements:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
152
|
+
hash: -2045735654354073817
|
101
153
|
requirements: []
|
102
154
|
rubyforge_project:
|
103
|
-
rubygems_version: 1.8.
|
155
|
+
rubygems_version: 1.8.23
|
104
156
|
signing_key:
|
105
157
|
specification_version: 3
|
106
158
|
summary: Hamburglar helps you prevent fraudulent orders
|