goldfinger 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/goldfinger/client.rb +5 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f7ed1607f341263885cc8af15309e2a984bbd2d
4
- data.tar.gz: b10f885a040e8fda88afe0b654ca674d89797d9c
3
+ metadata.gz: f66c83ee646aa481a6d414275702d9f82a04e328
4
+ data.tar.gz: 3c0cc3d24fdb392a2d6bcc49875476b83e8f246c
5
5
  SHA512:
6
- metadata.gz: 64b01170b2ac543a88db32946076b26b99ed7e5d3c092fa0fba428d00bd40f5b389e6aa8c96824666c20685a36f0effba30be95fa3df3cf560835f4cb4c49a48
7
- data.tar.gz: 44d9473c392dc43817bc571eaecffa83563a00094d983455bc1f093f5628af43ff45068bfba9defc4cbd9be566d290e67f5cef11dd4aba5f0c1a9a9a2af99ed3
6
+ metadata.gz: 1e03370097b2d600f6b141ef6039da82e6ccfe525e2f98003ed8f9fdbbf1b6562acca54146de5f0a1accadfb9346d7bbf8d9cb74de7b51a76e9a0ccd07db6678
7
+ data.tar.gz: 4f7f93dfa98ab42c1b3e85f0621eeb05bdf8434d4c21f2ab27e03d5cb8b07d4c12ffaab15a00984eb0ef59d51d97b9b29d06d992f48126e870fd06e607905407
@@ -13,7 +13,7 @@ module Goldfinger
13
13
  ssl = true
14
14
 
15
15
  begin
16
- _, template = perform_get(url(ssl))
16
+ _, template = perform_get(url(ssl))
17
17
  rescue HTTP::Error
18
18
  if ssl
19
19
  ssl = false
@@ -24,6 +24,9 @@ module Goldfinger
24
24
  end
25
25
 
26
26
  headers, body = perform_get(url_from_template(template))
27
+
28
+ raise Goldfinger::Error, "Invalid response mime type: #{headers.get(HTTP::Headers::CONTENT_TYPE).first}" unless ['application/jrd+json', 'application/xrd+xml'].include?(headers.get(HTTP::Headers::CONTENT_TYPE).first)
29
+
27
30
  Goldfinger::Result.new(headers, body)
28
31
  rescue HTTP::Error
29
32
  raise Goldfinger::NotFoundError
@@ -43,8 +46,7 @@ module Goldfinger
43
46
 
44
47
  raise Goldfinger::NotFoundError if links.empty?
45
48
 
46
- url = Addressable::Template.new(links.first.attribute('template').value)
47
- url.expand({ uri: @uri }).to_s
49
+ links.first.attribute('template').value.gsub('{uri}', @uri)
48
50
  end
49
51
 
50
52
  def domain
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goldfinger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugen Rochko