citygrid_api 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.13
data/citygrid_api.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "citygrid_api"
8
- s.version = "0.0.12"
8
+ s.version = "0.0.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Elpizo Choi"]
12
- s.date = "2012-05-07"
12
+ s.date = "2012-05-16"
13
13
  s.description = "Ruby wrapper for CityGrid APIs"
14
14
  s.email = "fu7iin@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -3,9 +3,11 @@ module CityGridExceptions
3
3
  # Define parent error classes
4
4
  # All errors thrown in the API should extend APIError - Level 1
5
5
  class APIError < StandardError
6
- attr_accessor :request
6
+ attr_accessor :request, :response
7
7
 
8
8
  def initialize request, response, msg = "An API error occurred"
9
+ @request = request
10
+ @response = response
9
11
  super msg
10
12
  end
11
13
  end
@@ -36,36 +38,26 @@ module CityGridExceptions
36
38
  Unexpected response format. Expected response to be a hash, but was instead:\n#{error_body}\n
37
39
  EOS
38
40
 
39
- super msg, request
41
+ super request, response, msg
40
42
  else
41
43
  msg = <<-EOS
42
44
  Unexpected response format. Expected response to be a hash, but was instead:\n#{response.parsed_response}\n
43
45
  EOS
44
46
 
45
- super msg, request
47
+ super request, response, msg
46
48
  end
47
49
  end
48
50
  end
49
51
 
50
52
  class RequestError < APIError
51
- attr_accessor :inner_exception
52
-
53
53
  def initialize request, response, msg = nil
54
- self.inner_exception = inner_exception
55
- self.request = request
56
- super msg, request
57
- #super msg || "Error while performing request: #{inner_exception.message}", request
54
+ super request, nil, msg
58
55
  end
59
56
  end
60
57
 
61
58
  class ResponseError < APIError
62
- attr_accessor :errors, :response
63
-
64
- def initialize request, errors, response
65
- self.errors = errors
66
- self.response = response
67
-
68
- super "API returned error message", request
59
+ def initialize request, response, msg = nil
60
+ super request, response, msg
69
61
  end
70
62
  end
71
63
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: citygrid_api
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.12
5
+ version: 0.0.13
6
6
  platform: ruby
7
7
  authors:
8
8
  - Elpizo Choi
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-05-07 00:00:00 Z
13
+ date: 2012-05-16 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty