workable 2.0.0rc1 → 2.0.0

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: d886522592c7473bc8fb058f56ea68a8b2d79585
4
- data.tar.gz: c019b51b0a908a38ac418fd2ea8003f98c5e9ca5
3
+ metadata.gz: 1918a3c5a23e3c42973eed949f0b0cc3ba83c613
4
+ data.tar.gz: 307220a59d69533df3446a11c216f72a8748be8a
5
5
  SHA512:
6
- metadata.gz: 43d116e2475036166516674d0efff67bb5f8e13bd3f05bb0c63373ae91398df068d6190ac99f19f9bc662cd0d86755c7d3fbc752cafff4e177adbe9d888c1e4f
7
- data.tar.gz: d9007195f31b8075e86a63a07bd3836a75ae2d6d1cc06e0ceccc9661212630f49e7a0f7e3c1d444f027f1824e7567afb7efada341279759fc405d7d77cb37de8
6
+ metadata.gz: 2fd937d0071f53b9c2df9735cd376d774abe397d2565ee0a12e13cb89c2b0fbeb77e7d2f802e83be0aa69d25bcc775ca964df002982f697b2e538ed99f8288f6
7
+ data.tar.gz: 80671b951b7f0a01bb0c00fd5bff54fa2e209358c4dbeb2b6ea06ea0946829ba63cdebc3319d56a1bf2daa2016133befdfc53b1d58d6caaae936e5dd0dad12e7
@@ -3,12 +3,11 @@ sudo: false
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
- - 1.9.3
7
- - 2.0.0
8
6
  - 2.1
9
7
  - 2.2
10
- - jruby
8
+ - jruby-head
11
9
  - rbx-2
10
+ - ruby-head
12
11
 
13
12
  notifications:
14
13
  email: false
@@ -1,3 +1,9 @@
1
+ ## 2.0.0
2
+
3
+ Date: 2015-11-14
4
+
5
+ **Breaking change - Ruby >= 2.1 required**
6
+
1
7
  ## 2.0.0rc1
2
8
 
3
9
  Date: 2015-11-02
data/Gemfile CHANGED
@@ -1,6 +1,2 @@
1
1
  source 'https://rubygems.org'
2
-
3
- # ruby=ruby-2.2.2
4
-
5
- # Specify your gem's dependencies in workable-client.gemspec
6
2
  gemspec
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![Gem Version](https://badge.fury.io/rb/workable.svg)](http://badge.fury.io/rb/workable)
7
7
  [![Dependency Status](https://gemnasium.com/emq/workable.svg)](https://gemnasium.com/emq/workable)
8
8
 
9
- Dead-simple Ruby API client for [workable.com][1]. No extra runtime dependencies. Ruby >= 1.9.3.
9
+ Dead-simple Ruby API client for [workable.com][1]. No extra runtime dependencies.
10
10
 
11
11
  Uses v3 API provided by workable.
12
12
 
@@ -133,7 +133,7 @@ module Workable
133
133
 
134
134
  # build the url to api
135
135
  def api_url
136
- 'https://www.workable.com/spi/v%s/accounts/%s' % [Workable::API_VERSION, subdomain]
136
+ @_api_url ||= 'https://www.workable.com/spi/v%s/accounts/%s' % [Workable::API_VERSION, subdomain]
137
137
  end
138
138
 
139
139
  # do the get request to api
@@ -157,7 +157,9 @@ module Workable
157
157
  http.use_ssl = true
158
158
 
159
159
  request = type.new(uri.request_uri, headers)
160
+
160
161
  yield request if block_given?
162
+
161
163
  response = http.request(request)
162
164
 
163
165
  parse!(response)
@@ -166,9 +168,9 @@ module Workable
166
168
  # parse the api response
167
169
  def parse!(response)
168
170
  case response.code.to_i
169
- when 204, 205 # handled no response
171
+ when 204, 205
170
172
  nil
171
- when 200...300 # handled with response
173
+ when 200...300
172
174
  JSON.parse(response.body)
173
175
  when 401
174
176
  fail Errors::NotAuthorized, JSON.parse(response.body)['error']
@@ -217,11 +219,11 @@ module Workable
217
219
  response = get_request(url, params)
218
220
 
219
221
  Collection.new(
220
- @transform_to.apply(transform_mapping, response[root_key]),
221
- method(__callee__),
222
- transform_mapping,
223
- root_key,
224
- response['paging'])
222
+ data: @transform_to.apply(transform_mapping, response[root_key]),
223
+ next_page_method: method(__callee__),
224
+ transform_mapping: transform_mapping,
225
+ root_key: root_key,
226
+ paging: response['paging'])
225
227
  end
226
228
 
227
229
  def configuration_error(message)
@@ -5,14 +5,14 @@ module Workable
5
5
 
6
6
  attr_reader :data
7
7
 
8
- def initialize(data, next_page_method, transform_mapping, root_key, paging = nil)
8
+ def initialize(data:, next_page_method:, transform_mapping:, root_key:, paging: nil)
9
9
  @data = data
10
10
 
11
11
  if paging
12
- @next_page = paging['next']
13
- @next_page_method = next_page_method
12
+ @next_page = paging['next']
13
+ @next_page_method = next_page_method
14
14
  @transform_mapping = transform_mapping
15
- @root_key = root_key
15
+ @root_key = root_key
16
16
  end
17
17
  end
18
18
 
@@ -1,11 +1,11 @@
1
1
  module Workable
2
2
  module Errors
3
- class WorkableError < StandardError; end
3
+ class WorkableError < StandardError; end
4
4
  class InvalidConfiguration < WorkableError; end
5
- class NotAuthorized < WorkableError; end
6
- class InvalidResponse < WorkableError; end
7
- class NotFound < WorkableError; end
8
- class AlreadyExists < WorkableError; end
9
- class RequestToLong < WorkableError; end
5
+ class NotAuthorized < WorkableError; end
6
+ class InvalidResponse < WorkableError; end
7
+ class NotFound < WorkableError; end
8
+ class AlreadyExists < WorkableError; end
9
+ class RequestToLong < WorkableError; end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module Workable
2
- VERSION = '2.0.0rc1'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -2,7 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  describe Workable::Collection do
4
4
  describe 'delegation' do
5
- let(:collection){ described_class.new([1, 2, 3], double, :job, 'jobs') }
5
+ let(:collection){ described_class.new(
6
+ data: [1, 2, 3],
7
+ next_page_method: double,
8
+ transform_mapping: :job,
9
+ root_key: 'jobs')
10
+ }
6
11
 
7
12
  it 'delegates size to `data`' do
8
13
  expect(collection.size).to eq(3)
@@ -27,7 +32,13 @@ describe Workable::Collection do
27
32
 
28
33
  describe '#fetch_next_page' do
29
34
  let(:next_method){ double }
30
- let(:collection){ described_class.new([], next_method, :job, 'jobs', paging) }
35
+ let(:collection){ described_class.new(
36
+ data: [],
37
+ next_page_method: next_method,
38
+ transform_mapping: :job,
39
+ root_key: 'jobs',
40
+ paging: paging)
41
+ }
31
42
 
32
43
  context 'when next page is available' do
33
44
  let(:paging){ { 'next' => 'http://example.com?limit=2&since_id=3' } }
@@ -17,12 +17,12 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.required_ruby_version = '>= 1.9.3'
20
+ spec.required_ruby_version = '>= 2.1.0'
21
21
 
22
22
  spec.add_development_dependency 'rake', '~> 10.0'
23
23
  spec.add_development_dependency 'rspec', '~> 3.1.0'
24
24
  spec.add_development_dependency 'webmock', '~> 1.20.4'
25
- spec.add_development_dependency 'coveralls', '~> 0.7.2'
25
+ spec.add_development_dependency 'coveralls', '~> 0.8.9'
26
26
  spec.add_development_dependency 'guard', '~> 2.12'
27
27
  spec.add_development_dependency 'guard-rspec', '~> 4.5'
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0rc1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafał Wojsznis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-02 00:00:00.000000000 Z
12
+ date: 2015-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 0.7.2
62
+ version: 0.8.9
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 0.7.2
69
+ version: 0.8.9
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: guard
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -147,12 +147,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
147
  requirements:
148
148
  - - ">="
149
149
  - !ruby/object:Gem::Version
150
- version: 1.9.3
150
+ version: 2.1.0
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - ">"
153
+ - - ">="
154
154
  - !ruby/object:Gem::Version
155
- version: 1.3.1
155
+ version: '0'
156
156
  requirements: []
157
157
  rubyforge_project:
158
158
  rubygems_version: 2.4.6