snuggie 0.1.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/lib/snuggie/noc.rb +7 -16
- data/lib/snuggie/version.rb +1 -1
- metadata +68 -18
- data/lib/snuggie/license.rb +0 -5
- data/test/snuggie/license_test.rb +0 -5
data/README.markdown
CHANGED
data/lib/snuggie/noc.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'cgi'
|
2
|
-
require 'net/http'
|
3
2
|
require 'php_serialize'
|
3
|
+
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
4
5
|
|
5
6
|
module Snuggie
|
6
7
|
# Snuggie::NOC is the main class for communicating with the
|
@@ -250,9 +251,6 @@ module Snuggie
|
|
250
251
|
|
251
252
|
# Performs a GET request on the given URI, redirects if needed
|
252
253
|
#
|
253
|
-
# See Following Redirection at
|
254
|
-
# http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
|
255
|
-
#
|
256
254
|
# Params
|
257
255
|
#
|
258
256
|
# * uri_str - the URL to fetch as a string
|
@@ -260,18 +258,11 @@ module Snuggie
|
|
260
258
|
def fetch(uri_str, limit = 10)
|
261
259
|
# You should choose better exception.
|
262
260
|
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
case response
|
270
|
-
when Net::HTTPSuccess then response
|
271
|
-
when Net::HTTPRedirection then fetch(response['location'], limit - 1)
|
272
|
-
else
|
273
|
-
response.error!
|
274
|
-
end
|
261
|
+
Faraday.new(:url => uri_str) do |c|
|
262
|
+
c.response :raise_error
|
263
|
+
c.response :follow_redirects, :limit => limit
|
264
|
+
c.adapter :net_http
|
265
|
+
end.get
|
275
266
|
end
|
276
267
|
end
|
277
268
|
end
|
data/lib/snuggie/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snuggie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ 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
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: php-serialize
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,47 @@ dependencies:
|
|
21
21
|
version: 1.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.1.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: faraday
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.8.1
|
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.1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: faraday_middleware
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.8.4
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.8.4
|
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,7 +85,12 @@ 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
|
description: ! ' Snuggie wraps the Softaculous API in a warm, loving ruby embrace.
|
48
95
|
|
49
96
|
'
|
@@ -56,21 +103,19 @@ files:
|
|
56
103
|
- Rakefile
|
57
104
|
- README.markdown
|
58
105
|
- lib/snuggie/config.rb
|
59
|
-
- lib/snuggie/errors.rb
|
60
|
-
- lib/snuggie/license.rb
|
61
106
|
- lib/snuggie/noc.rb
|
107
|
+
- lib/snuggie/errors.rb
|
62
108
|
- lib/snuggie/version.rb
|
63
109
|
- lib/snuggie.rb
|
64
|
-
- test/fixtures/
|
110
|
+
- test/fixtures/refund.txt
|
111
|
+
- test/fixtures/invoice_details_unbilled.txt
|
65
112
|
- test/fixtures/cancel_license.txt
|
113
|
+
- test/fixtures/buy_license.txt
|
66
114
|
- test/fixtures/edit_ips.txt
|
67
|
-
- test/fixtures/invoice_details_unbilled.txt
|
68
|
-
- test/fixtures/license_logs.txt
|
69
115
|
- test/fixtures/list_licenses.txt
|
70
|
-
- test/fixtures/
|
71
|
-
- test/snuggie/config_test.rb
|
72
|
-
- test/snuggie/license_test.rb
|
116
|
+
- test/fixtures/license_logs.txt
|
73
117
|
- test/snuggie/noc_test.rb
|
118
|
+
- test/snuggie/config_test.rb
|
74
119
|
- test/snuggie_test.rb
|
75
120
|
- test/test_helper.rb
|
76
121
|
homepage: https://github.com/site5/snuggie
|
@@ -86,17 +131,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
131
|
- - ! '>='
|
87
132
|
- !ruby/object:Gem::Version
|
88
133
|
version: '0'
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
hash: 3975251454299087220
|
89
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
138
|
none: false
|
91
139
|
requirements:
|
92
140
|
- - ! '>='
|
93
141
|
- !ruby/object:Gem::Version
|
94
142
|
version: '0'
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
hash: 3975251454299087220
|
95
146
|
requirements: []
|
96
147
|
rubyforge_project:
|
97
|
-
rubygems_version: 1.8.
|
148
|
+
rubygems_version: 1.8.23
|
98
149
|
signing_key:
|
99
150
|
specification_version: 3
|
100
151
|
summary: Snuggie wraps the Softaculous API in a warm, loving ruby embrace
|
101
152
|
test_files: []
|
102
|
-
has_rdoc:
|
data/lib/snuggie/license.rb
DELETED