delighted 1.5.1 → 1.6.0.rc1

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: 1ddd7eb8a0999c9c75a454b813ac6a75b63e628a
4
- data.tar.gz: 650f815da8210674fdafe33f92887b887d7cc795
3
+ metadata.gz: 77e2093601991e7f8f6b9eec4652010b0fd7351e
4
+ data.tar.gz: 38e89bae518a39908070178da054fc42e0fc026a
5
5
  SHA512:
6
- metadata.gz: 9ee26e62ce829b63a28537131c720d7d70c039be0dd76741be1592b087daeb4dde456af832ffe3e822b052768d08f1f41aaf6d81ea8bf58ec51727f4164ccff2
7
- data.tar.gz: 96bd70d5e234234c63413dee5737bb9d7ec0fa3348e20af6c4fbb3562510a3daca9d4bb6dc647b4ed63d28a2dcc110e1895c4ff0737f25eecbf78b4d4d86fa15
6
+ metadata.gz: ca6be3ada16b93a311834767e0bd3548cdf57ec27948d74dd9ef4625e1cf2f9c77f87be09310165ddd2f1deb44e3db13cd8e4239ea5619e1bfb6a8c6dbaad6a0
7
+ data.tar.gz: 0524944ef28e1d24f53e8faa4a6ab73dcbee726ac58a5e26ecd48c13d53cda7e0b668b0231fadf4c597b9faaf404a744e313e5d4b10de8fa2be2417e189b8c08
@@ -1,12 +1,13 @@
1
1
  language: ruby
2
- install:
3
- - bundle install --retry=3
2
+ before_install: gem update bundler
4
3
  rvm:
5
- - 2.0.0
4
+ - 2.2
5
+ - 2.1
6
+ - 2.0
6
7
  - 1.9.3
7
8
  - 1.9.2
8
9
  - 1.8.7
9
10
  - jruby-18mode
10
11
  - jruby-19mode
11
- - rbx-2.1.1
12
+ - rbx-2
12
13
  - ree
@@ -1,3 +1,9 @@
1
+ ## 1.6.0 (2017-09-27)
2
+
3
+ Features:
4
+
5
+ - Add support for rate limited responses (`Delighted::RateLimitedError`)
6
+
1
7
  ## 1.5.1 (2015-10-06)
2
8
 
3
9
  Fixes:
data/README.md CHANGED
@@ -166,7 +166,7 @@ Delighted.http_adapter # default: Delighted::HTTPAdapter.new
166
166
  By default, a shared instance of `Delighted::Client` is created lazily in `Delighted.shared_client`. If you want to create your own client, perhaps for test or if you have multiple API keys, you can:
167
167
 
168
168
  ```ruby
169
- # Create an custom client instance, and pass as last argument to resource actions
169
+ # Create a custom client instance, and pass as last argument to resource actions
170
170
  client = Delighted::Client.new(:api_key => 'API_KEY',
171
171
  :api_base_url => 'https://api.delighted.com/v1',
172
172
  :http_adapter => Delighted::HTTPAdapter.new)
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "multi_json"
21
- spec.add_development_dependency "rake"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
22
  spec.add_development_dependency "minitest"
23
23
  spec.add_development_dependency "mocha"
24
24
  end
@@ -61,6 +61,8 @@ module Delighted
61
61
  raise UnsupportedFormatRequestedError, response
62
62
  when 422
63
63
  raise ResourceValidationError, response
64
+ when 429
65
+ raise RateLimitedError, response
64
66
  when 503
65
67
  raise ServiceUnavailableError, response
66
68
  else
@@ -21,6 +21,10 @@ module Delighted
21
21
  # 422, validation errors
22
22
  end
23
23
 
24
+ class RateLimitedError < Error
25
+ # 429, rate limited
26
+ end
27
+
24
28
  class GeneralAPIError < Error
25
29
  # 500, general/unknown error
26
30
  end
@@ -1,3 +1,5 @@
1
+ require 'date'
2
+
1
3
  module Delighted
2
4
  module Utils
3
5
  def self.eigenclass(object)
@@ -1,3 +1,3 @@
1
1
  module Delighted
2
- VERSION = "1.5.1"
2
+ VERSION = "1.6.0.rc1"
3
3
  end
@@ -5,6 +5,14 @@ class Delighted::ClientTest < Delighted::TestCase
5
5
  assert_raises(ArgumentError) { Delighted::Client.new }
6
6
  Delighted::Client.new(:api_key => '123abc')
7
7
  end
8
+
9
+ def test_handles_rate_limited_response
10
+ response = Delighted::HTTPResponse.new(429, {}, Delighted::JSON.dump({ status: 429, message: "Too Many Requests" }
11
+ ))
12
+ mock_http_adapter.stubs(:request).returns(response)
13
+
14
+ assert_raises(Delighted::RateLimitedError) { Delighted.shared_client.get_json("/foo") }
15
+ end
8
16
  end
9
17
 
10
18
  class Delighted::MetricsTest < Delighted::TestCase
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delighted
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Dodwell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-06 00:00:00.000000000 Z
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mocha
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Delighted API Ruby Client.
@@ -73,8 +73,8 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
77
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
78
  - CHANGELOG.md
79
79
  - Gemfile
80
80
  - LICENSE
@@ -113,17 +113,17 @@ require_paths:
113
113
  - lib
114
114
  required_ruby_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - '>='
121
+ - - ">"
122
122
  - !ruby/object:Gem::Version
123
- version: '0'
123
+ version: 1.3.1
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.0.14
126
+ rubygems_version: 2.6.13
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Delighted is the fastest and easiest way to gather actionable feedback from