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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hayamichi_response.rb +4 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b6e217722e1c92c6a0458343c93ac25b40d80bc
4
- data.tar.gz: 6258b6c7b9d011bffb98c05be55da6eff4d98c24
3
+ metadata.gz: 6d04a8412c8febad198c7f883f3649ef5138fa39
4
+ data.tar.gz: 441003fa8ca4f2bc0a8eeeea962770b1fb9d35fe
5
5
  SHA512:
6
- metadata.gz: a62404e0404f48b14ccf94e98e27f28ff5a8924ce670b2c57e0ac19ea7952059040b8865e18f89724481bf4475d3617b654c085ac088407db8a2cf181719c5d4
7
- data.tar.gz: 5a46d745da7b9397833f73595d6763c9159212f858f82e03579769c7be6d0e285e59e3aeba4dc6b35b10d8f245b89fc34343ee503f822ad8347c31e990bb61d0
6
+ metadata.gz: 8aac07dc91f406588de69a0438acbf9931efa28807343c354cd10ed85566ebaea4f500b1623242a6deaebf1613db8da4e7800d8e702bcc1688f10d147b82e5f3
7
+ data.tar.gz: 9262e79b14a8f491bb755ad8811df1d7d685b8b7d73002dd490967a27b1b2a23a55fc178ec15bd3b28d4dc00b1af7a9fb3618c04dd303721142be92419c062e1
@@ -6,25 +6,23 @@ class Hayamichi
6
6
  attr_reader :status, :url, :data, :response
7
7
 
8
8
  def initialize(response)
9
- @status, @url, @data = false, '', {}
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
- @status = false
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.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 2-Clause
23
+ - BSD-2-Clause
24
24
  metadata: {}
25
25
  post_install_message:
26
26
  rdoc_options: []