hayamichi 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/lib/hayamichi_response.rb +4 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d04a8412c8febad198c7f883f3649ef5138fa39
|
4
|
+
data.tar.gz: 441003fa8ca4f2bc0a8eeeea962770b1fb9d35fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aac07dc91f406588de69a0438acbf9931efa28807343c354cd10ed85566ebaea4f500b1623242a6deaebf1613db8da4e7800d8e702bcc1688f10d147b82e5f3
|
7
|
+
data.tar.gz: 9262e79b14a8f491bb755ad8811df1d7d685b8b7d73002dd490967a27b1b2a23a55fc178ec15bd3b28d4dc00b1af7a9fb3618c04dd303721142be92419c062e1
|
data/lib/hayamichi_response.rb
CHANGED
@@ -6,25 +6,23 @@ class Hayamichi
|
|
6
6
|
attr_reader :status, :url, :data, :response
|
7
7
|
|
8
8
|
def initialize(response)
|
9
|
-
@
|
9
|
+
@success, @url, @data = false, '', {}
|
10
10
|
@response = response # raw response
|
11
11
|
|
12
12
|
raise INVALID_RESPONSE_ERROR unless @response.respond_to? :status
|
13
13
|
|
14
|
-
# parse status here then is success
|
15
14
|
case response
|
16
|
-
when Net::HTTPSuccess then
|
17
|
-
@status = true
|
18
15
|
when Net::HTTPRedirection then
|
19
|
-
@status = true
|
20
16
|
redirect = response['location']
|
21
17
|
if redirect != ''
|
18
|
+
@success = true
|
19
|
+
|
22
20
|
uri = URI redirect
|
23
21
|
@url = url_from_uri uri
|
24
22
|
@data = URI.decode_www_form(uri.query).to_h
|
25
23
|
end
|
26
24
|
else
|
27
|
-
@
|
25
|
+
@success = false
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hayamichi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Moreno Garza
|
@@ -20,7 +20,7 @@ files:
|
|
20
20
|
- lib/hayamichi_response.rb
|
21
21
|
homepage: http://github.com/ozkar99/hayamichi
|
22
22
|
licenses:
|
23
|
-
- BSD
|
23
|
+
- BSD-2-Clause
|
24
24
|
metadata: {}
|
25
25
|
post_install_message:
|
26
26
|
rdoc_options: []
|