yelp 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c649a05c048827a7b42822d18b146e00ca08ec8a
4
- data.tar.gz: df80203b30d5c7ee4cff1b4e775d99a22e4b2742
3
+ metadata.gz: 11c890b74574ed87a98958e5492b2576187d53ae
4
+ data.tar.gz: ffb12c0d8ab4e37692aea9a51ab7ba2268d255cc
5
5
  SHA512:
6
- metadata.gz: 312181550e78caecf377712e3a1eeb192c29de842e81ad59e8e4152db22b5a1e41d681662c8b2cea9f41ad379803f9ba0ee7ff0b03a571bfa4bd68dee7ed4339
7
- data.tar.gz: 841fb134b26d17678b36f9899bdaf7d84a6bc922b09c1a35608c9183455032a3c7c797e90931974a51ad37ff0b032147d40d659538599548df9e532c1c9c17ad
6
+ metadata.gz: 4078c68dc24492572c45a995d9aa4d0dcea9ea5ff518bee4f7640ba886259d97d362523420d73c2cc123697a485bc21c38623a38b1e546119184835fb4dfe7df
7
+ data.tar.gz: 8482cbc5453a520cacb584a9a3c7521e2084a194771acd126c322e8ea4cb99a4ae423a4ff0b21e525b04e29d90a1cfea12b35905329097f5ffa189356d7ad995
data/lib/yelp/error.rb CHANGED
@@ -25,7 +25,7 @@ module Yelp
25
25
  def error_from_response(response)
26
26
  body = JSON.parse(response.body)
27
27
  klass = error_classes[body['error']['id']]
28
- klass.new(body['error']['text'])
28
+ klass.new(body['error']['text'], body['error'])
29
29
  end
30
30
 
31
31
  # Maps from API Error id's to Yelp::Error exception classes.
@@ -45,29 +45,39 @@ module Yelp
45
45
  @response_validator.validate(response)
46
46
  end
47
47
 
48
- class Base < StandardError; end
48
+ class Base < StandardError
49
+ def initialize(msg,error=nil)
50
+ end
51
+ end
49
52
 
50
53
  class AlreadyConfigured < Base
51
54
  def initialize(msg = 'Gem cannot be reconfigured. Initialize a new ' +
52
- 'instance of Yelp::Client.')
55
+ 'instance of Yelp::Client.', error=nil)
53
56
  super
54
57
  end
55
58
  end
56
59
 
57
60
  class MissingAPIKeys < Base
58
- def initialize(msg = "You're missing an API key")
61
+ def initialize(msg = "You're missing an API key", error=nil)
59
62
  super
60
63
  end
61
64
  end
62
65
 
63
66
  class MissingLatLng < Base
64
- def initialize(msg = 'Missing required latitude or longitude parameters')
67
+ def initialize(msg = 'Missing required latitude or longitude parameters', error=nil)
65
68
  super
66
69
  end
67
70
  end
68
71
 
69
72
  class BoundingBoxNotComplete < Base
70
- def initialize(msg = 'Missing required values for bounding box')
73
+ def initialize(msg = 'Missing required values for bounding box', error=nil)
74
+ super
75
+ end
76
+ end
77
+
78
+ class InvalidParameter < Base
79
+ def initialize(msg='One or more parameters were invalid', error=nil)
80
+ msg = msg + ': ' + error['field'] unless error.nil?
71
81
  super
72
82
  end
73
83
  end
@@ -75,7 +85,6 @@ module Yelp
75
85
  class InternalError < Base; end
76
86
  class ExceededRequests < Base; end
77
87
  class MissingParameter < Base; end
78
- class InvalidParameter < Base; end
79
88
  class InvalidSignature < Base; end
80
89
  class InvalidOAuthCredentials < Base; end
81
90
  class InvalidOAuthUser < Base; end
data/lib/yelp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yelp
2
- VERSION = "2.0.6"
2
+ VERSION = "2.0.7"
3
3
  end
@@ -15,7 +15,7 @@ describe Yelp::Error do
15
15
  it 'should raise an internal error' do
16
16
  expect {
17
17
  Yelp::Error.check_for_error(bad_response)
18
- }.to raise_error(Yelp::Error::InternalError, 'error message')
18
+ }.to raise_error(Yelp::Error::InternalError)
19
19
  end
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yelp
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomer Elmalem
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-09 00:00:00.000000000 Z
13
+ date: 2015-10-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler