rramsden-diggr 0.1.8 → 0.1.9

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.
@@ -14,9 +14,6 @@ module Diggr
14
14
  private
15
15
 
16
16
  def build_objects_from_parsed_json(parsed_data)
17
- if parsed_data.has_key?('code') && parsed_data['code'] == 404
18
- raise APIError, "specified path returned a 404 error"
19
- end
20
17
 
21
18
  collection_type, collection_data = cleanse_json(parsed_data)
22
19
 
data/lib/diggr/request.rb CHANGED
@@ -49,12 +49,17 @@ module Diggr
49
49
  private
50
50
 
51
51
  def make_request
52
- Net::HTTP.start(Diggr::Constants::HOST,Diggr::Constants::PORT) do |http|
52
+ response = Net::HTTP.start(Diggr::Constants::HOST,Diggr::Constants::PORT) do |http|
53
53
  http.get(
54
54
  path,
55
55
  'User-Agent' => Diggr::Constants::USER_AGENT,
56
56
  'Accept' => Diggr::Constants::RESPONSE_TYPE
57
- ).body
57
+ )
58
+ end
59
+ if response.is_a?(Net::HTTPSuccess)
60
+ response.body
61
+ else
62
+ raise APIError, "specified path returned a #{response.code} error"
58
63
  end
59
64
  end
60
65
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rramsden-diggr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drew Olson