harvesting 0.5.0 → 0.6.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
  SHA256:
3
- metadata.gz: fb6b38d71800f5156d305c7702286b90f74b0db7a0718912495117acc11a5865
4
- data.tar.gz: 548e13f94ef0e0cac713350afadad6e039f995ce481ff7166ee5de441c3cc3a9
3
+ metadata.gz: 8f6d054347741b50002f88258ec6816852d6463fddcf45163779d5c8cc56c5b6
4
+ data.tar.gz: c92bb840b2825539dad52caab0d51871f89248d63b37ecb6e08cde0d9154b6b6
5
5
  SHA512:
6
- metadata.gz: c8daf60be6c6c9fb503a1f7778a963390c8857d52f76b6aecfe8a1d046f589946defc9b56cd17c501aa84c6c6318224cb082f1c603a3ae0c38b3f92ab9109f9c
7
- data.tar.gz: 781ed847b381891c9f66675720e4db332bc7835fb94d2362db73c65e5460f9580400b6a10812eefc5c6c10539f0f4c61603f0e1fb5dbd24452a891d521778704
6
+ metadata.gz: e6a1957ac8fb4f16e77996e3f1d1504825d4b6bb90fb1e0bf749a0b399755fd04756eb4fd60b54bc2635b03c843de99a5fc19309fe4627059344ec9ec2027749
7
+ data.tar.gz: 96bae4c6ead7a63caacee4b67def836f5f76047677a09b0f7cdda4ecb0521f4b1bd81bc1666239cbb0a2bdfb3426e80564210b82ad5a8e79c94665a4768b35f7
data/.travis.yml CHANGED
@@ -1,10 +1,10 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.10
5
4
  - 2.5.8
6
5
  - 2.6.6
7
6
  - 2.7.1
7
+ - 3.0
8
8
  env:
9
9
  - HARVEST_FIRST_NAME=Aaron HARVEST_LAST_NAME=Burr HARVEST_ACCOUNT_ID=112341234 HARVEST_NON_ADMIN_ACCOUNT_ID=112341234 HARVEST_ACCESS_TOKEN=112341234 HARVEST_NON_ADMIN_ACCESS_TOKEN=112341234 HARVEST_ADMIN_FULL_NAME=112341234
10
10
 
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # Harvesting
2
2
 
3
- [![Build Status](https://travis-ci.org/fastruby/harvesting.svg?branch=master)](https://travis-ci.org/ombulabs/harvesting)
4
- [![Code Climate](https://codeclimate.com/github/fastruby/harvesting/badges/gpa.svg)](https://codeclimate.com/github/ombulabs/harvesting)
3
+ [![Build Status](https://travis-ci.org/fastruby/harvesting.svg?branch=main)](https://travis-ci.org/fastruby/harvesting)
4
+ [![Code Climate](https://codeclimate.com/github/fastruby/harvesting/badges/gpa.svg)](https://codeclimate.com/github/fastruby/harvesting)
5
+ [![codecov](https://codecov.io/gh/fastruby/harvesting/branch/main/graph/badge.svg)](https://codecov.io/gh/fastruby/harvesting)
5
6
 
6
7
  A Ruby gem to interact with the Harvest API v2.0 and forward.
7
8
 
@@ -23,7 +24,7 @@ Or install it yourself as:
23
24
 
24
25
  ## Documentation
25
26
 
26
- The API is documented [here](https://www.rubydoc.info/github/ombulabs/harvesting)
27
+ The API is documented [here](https://www.rubydoc.info/gems/harvesting)
27
28
 
28
29
  ## Usage
29
30
 
@@ -166,7 +167,7 @@ end
166
167
 
167
168
  ## Roadmap
168
169
 
169
- There are many things to be developed for this gem. For now they are tracked here: [TODO.md](https://github.com/ombulabs/harvesting/blob/master/TODO.md)
170
+ There are many things to be developed for this gem. For now they are tracked here: [TODO.md](https://github.com/fastruby/harvesting/blob/main/TODO.md)
170
171
 
171
172
  ## Releases
172
173
 
@@ -240,7 +241,17 @@ We follow semantic versioning for version numbers: [https://semver.org](https://
240
241
 
241
242
  ## Contributing
242
243
 
243
- Bug reports and pull requests are welcome on GitHub at [https://github.com/ombulabs/harvesting](https://github.com/ombulabs/harvesting). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
244
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/fastruby/harvesting](https://github.com/fastruby/harvesting). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
245
+
246
+ When Submitting a Pull Request:
247
+
248
+ * If your PR closes any open GitHub issues, please include `Closes #XXXX` in your comment
249
+
250
+ * Please include a summary of the change and which issue is fixed or which feature is introduced.
251
+
252
+ * If changes to the behavior are made, clearly describe what changes.
253
+
254
+ * If changes to the UI are made, please include screenshots of the before and after.
244
255
 
245
256
  ## License
246
257
 
@@ -248,4 +259,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
248
259
 
249
260
  ## Code of Conduct
250
261
 
251
- Everyone interacting in the Harvesting project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ombulabs/harvesting/blob/master/CODE_OF_CONDUCT.md).
262
+ Everyone interacting in the Harvesting project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/fastruby/harvesting/blob/main/CODE_OF_CONDUCT.md).
data/RELEASE_NOTES.md CHANGED
@@ -1,13 +1,36 @@
1
1
  # RELEASE NOTES
2
2
 
3
- ### main
3
+ ### main
4
4
 
5
5
  **Notes**
6
6
 
7
- ### Version 0.5.0 - September 3, 2020
7
+ **Bug Fixes**
8
+
9
+ ### Version 0.6.0 - July 17, 2023
10
+
11
+ **Notes**
12
+
13
+ **Bug Fixes**
14
+
15
+ - Fix incompatibility with Ruby 3.0 and kwargs: https://github.com/fastruby/harvesting/pull/68
16
+
17
+ ### Version 0.5.1 - January 14, 2021
18
+
19
+ **Notes**
20
+ - Add support for Codecov so that we can track code coverage over time in the
21
+ library: https://github.com/fastruby/harvesting/pull/59
22
+
23
+ **Bug Fixes**
24
+ - Fix incompatibility with Ruby 3.0: https://github.com/fastruby/harvesting/pull/64
25
+ - Relax `http` dependency declaration so that we can `bundle install` with more
26
+ modern versions of that gem: https://github.com/fastruby/harvesting/pull/63
27
+ - Fix issue when trying to remove an entity that is not removable:
28
+ https://github.com/fastruby/harvesting/pull/61
29
+
30
+ ### Version 0.5.0 - September 3, 2020
8
31
 
9
32
  **Notes**
10
- - Changed behavior of `client.clients` so that it returns an instance of `Harvesting::Models::Clients` instead of an `Array`: https://github.com/ombulabs/harvesting/pull/39
33
+ - Changed behavior of `client.clients` so that it returns an instance of `Harvesting::Models::Clients` instead of an `Array`: https://github.com/fastruby/harvesting/pull/39
11
34
 
12
35
  **Bug Fixes**
13
36
  - Add support for Harvesting::RateLimitExceeded instead of a JSON::ParserError: https://github.com/fastruby/harvesting/pull/57
@@ -16,47 +39,47 @@
16
39
  ### Version 0.4.0 - June 6, 2020
17
40
 
18
41
  **Notes**
19
- - Added Ruby 2.5.1 to version matrix in Travis: https://github.com/ombulabs/harvesting/pull/31
20
- - Associated time entries for project: https://github.com/ombulabs/harvesting/pull/32
21
- - Add require forwardable in havest_record_collection model: https://github.com/ombulabs/harvesting/pull/40
22
- - Add syntax highlighting to readme examples: https://github.com/ombulabs/harvesting/pull/41
23
- - Rename the client key as harvest_client to avoid confusion: https://github.com/ombulabs/harvesting/pull/43
24
- - Update rake requirement from ~> 10.0 to ~> 13.0: https://github.com/ombulabs/harvesting/pull/44
25
- - Bump ffi from 1.9.23 to 1.12.2: https://github.com/ombulabs/harvesting/pull/45
26
- - Ability to supply filter options to the invoice end point and a model for line items on an invoice.: https://github.com/ombulabs/harvesting/pull/46
42
+ - Added Ruby 2.5.1 to version matrix in Travis: https://github.com/fastruby/harvesting/pull/31
43
+ - Associated time entries for project: https://github.com/fastruby/harvesting/pull/32
44
+ - Add require forwardable in havest_record_collection model: https://github.com/fastruby/harvesting/pull/40
45
+ - Add syntax highlighting to readme examples: https://github.com/fastruby/harvesting/pull/41
46
+ - Rename the client key as harvest_client to avoid confusion: https://github.com/fastruby/harvesting/pull/43
47
+ - Update rake requirement from ~> 10.0 to ~> 13.0: https://github.com/fastruby/harvesting/pull/44
48
+ - Bump ffi from 1.9.23 to 1.12.2: https://github.com/fastruby/harvesting/pull/45
49
+ - Ability to supply filter options to the invoice end point and a model for line items on an invoice.: https://github.com/fastruby/harvesting/pull/46
27
50
 
28
51
  **Bug Fixes**
29
52
 
30
- - Complete pending test: https://github.com/ombulabs/harvesting/pull/28
31
- - Fixed Code Climate link: https://github.com/ombulabs/harvesting/pull/38
53
+ - Complete pending test: https://github.com/fastruby/harvesting/pull/28
54
+ - Fixed Code Climate link: https://github.com/fastruby/harvesting/pull/38
32
55
 
33
56
 
34
57
  ### Version 0.3.0 - Jan 22, 2019
35
58
 
36
59
  **Notes**
37
60
 
38
- - Support for users: https://github.com/ombulabs/harvesting/pull/9
39
- - Support for fetching single records: https://github.com/ombulabs/harvesting/pull/14 and https://github.com/ombulabs/harvesting/pull/22
40
- - Nested models make it easier to access data: https://github.com/ombulabs/harvesting/pull/15
41
- - Better architecture for collections: https://github.com/ombulabs/harvesting/pull/18
61
+ - Support for users: https://github.com/fastruby/harvesting/pull/9
62
+ - Support for fetching single records: https://github.com/fastruby/harvesting/pull/14 and https://github.com/fastruby/harvesting/pull/22
63
+ - Nested models make it easier to access data: https://github.com/fastruby/harvesting/pull/15
64
+ - Better architecture for collections: https://github.com/fastruby/harvesting/pull/18
42
65
 
43
66
  **Bug Fixes**
44
67
 
45
- - Correct pagination support: https://github.com/ombulabs/harvesting/pull/17
46
- - Added documentation: https://github.com/ombulabs/harvesting/pull/30
68
+ - Correct pagination support: https://github.com/fastruby/harvesting/pull/17
69
+ - Added documentation: https://github.com/fastruby/harvesting/pull/30
47
70
 
48
71
  ### Version 0.2.0 - Oct 18, 2018
49
72
 
50
73
  **Notes**
51
74
 
52
75
  - More documentation in README.md
53
- - Adds ability to access user associated with time entries: https://github.com/ombulabs/harvesting/pull/3
54
- - Adds support for Docker for development: https://github.com/ombulabs/harvesting/pull/1
76
+ - Adds ability to access user associated with time entries: https://github.com/fastruby/harvesting/pull/3
77
+ - Adds support for Docker for development: https://github.com/fastruby/harvesting/pull/1
55
78
 
56
79
  **Bug Fixes**
57
80
 
58
- - Fixes issues with specs: https://github.com/ombulabs/harvesting/pull/2
59
- - Fixed https://github.com/ombulabs/harvesting/issues/6 with https://github.com/ombulabs/harvesting/pull/7
81
+ - Fixes issues with specs: https://github.com/fastruby/harvesting/pull/2
82
+ - Fixed https://github.com/fastruby/harvesting/issues/6 with https://github.com/fastruby/harvesting/pull/7
60
83
 
61
84
  ## Version 0.1.0 - Sep 04, 2018
62
85
 
data/harvesting.gemspec CHANGED
@@ -20,14 +20,16 @@ Gem::Specification.new do |spec|
20
20
  spec.bindir = "exe"
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
- spec.add_dependency "http", "~> 3.3", ">= 3.3"
23
+ spec.add_dependency "http", ">= 3.3", "< 5.1"
24
24
 
25
25
  spec.add_development_dependency "bundler", ">= 2.0", "< 3.0"
26
26
  spec.add_development_dependency "rake", "~> 13.0"
27
27
  spec.add_development_dependency "rspec", "~> 3.0"
28
28
  spec.add_development_dependency "guard-rspec", "~> 4.7", ">= 4.7"
29
- spec.add_development_dependency "byebug", "~> 10.0", ">= 10.0"
29
+ spec.add_development_dependency "byebug", ">= 10.0", "< 12.0"
30
30
  spec.add_development_dependency "vcr", "~> 4.0", ">= 4.0"
31
31
  spec.add_development_dependency "webmock", "~> 3.4", ">= 3.4"
32
32
  spec.add_development_dependency "dotenv", "~> 2.5", ">= 2.5"
33
+ spec.add_development_dependency "simplecov", "~> 0.19.0"
34
+ spec.add_development_dependency "codecov", "~> 0.2.9"
33
35
  end
@@ -12,7 +12,7 @@ module Harvesting
12
12
 
13
13
  # Returns a new instance of `Client`
14
14
  #
15
- # client = Client.new(access_token: "12345678", account_id: "98764")
15
+ # client = Client.new({ access_token: "12345678", account_id: "98764" })
16
16
  #
17
17
  # @param [Hash] opts the options to create an API client
18
18
  # @option opts [String] :access_token Harvest access token
@@ -30,7 +30,7 @@ module Harvesting
30
30
  def me
31
31
  Harvesting::Models::User.new(get("users/me"), harvest_client: self)
32
32
  end
33
-
33
+
34
34
  # @return [Harvesting::Models::Clients]
35
35
  def clients(opts = {})
36
36
  Harvesting::Models::Clients.new(get("clients", opts), opts, harvest_client: self)
@@ -115,7 +115,8 @@ module Harvesting
115
115
  url = "#{DEFAULT_HOST}/#{entity.path}"
116
116
  uri = URI(url)
117
117
  response = http_response(:delete, uri)
118
- raise UnprocessableRequest(response.to_s) unless response.code.to_i == 200
118
+ raise UnprocessableRequest.new(response.to_s) unless response.code.to_i == 200
119
+
119
120
  JSON.parse(response.body)
120
121
  end
121
122
 
@@ -7,7 +7,7 @@ module Harvesting
7
7
  include ::Enumerable
8
8
 
9
9
  # @return [Enumerator]
10
- def each(start = 0)
10
+ def each(start = 0, &block)
11
11
  @cursor = start
12
12
  return to_enum(:each, start) unless block_given?
13
13
  Array(@entries[start..-1]).each_with_index do |element, index|
@@ -18,7 +18,7 @@ module Harvesting
18
18
  unless last?
19
19
  start = [@entries.size, start].max
20
20
  fetch_next_page
21
- each(start, &Proc.new)
21
+ each(start, &block)
22
22
  end
23
23
  self
24
24
  end
@@ -9,7 +9,7 @@ module Harvesting
9
9
  def initialize(attrs, opts = {})
10
10
  @models = {}
11
11
  @attributes = attrs.dup
12
- @harvest_client = opts[:harvest_client] || Harvesting::Client.new(opts)
12
+ @harvest_client = opts[:harvest_client] || Harvesting::Client.new(**opts)
13
13
  end
14
14
 
15
15
  # It calls `create` or `update` depending on the record's ID. If the ID
@@ -65,7 +65,7 @@ module Harvesting
65
65
  # @param opts [Hash] options to pass along to the `Harvesting::Client`
66
66
  # instance
67
67
  def self.get(id, opts = {})
68
- client = opts[:harvest_client] || Harvesting::Client.new(opts)
68
+ client = opts[:harvest_client] || Harvesting::Client.new(**opts)
69
69
  self.new({ 'id' => id }, opts).fetch
70
70
  end
71
71
 
@@ -108,7 +108,7 @@ module Harvesting
108
108
  def self.modeled(opts = {})
109
109
  opts.each do |attribute_name, model|
110
110
  attribute_name_string = attribute_name.to_s
111
- Harvesting::Models::Base.send :define_method, attribute_name_string do
111
+ define_method(attribute_name_string) do
112
112
  @models[attribute_name_string] ||= model.new(@attributes[attribute_name_string] || {}, harvest_client: harvest_client)
113
113
  end
114
114
  end
@@ -1,3 +1,3 @@
1
1
  module Harvesting
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.6.0".freeze
3
3
  end
@@ -0,0 +1,9 @@
1
+ **IMPORTANT: Please read the README before submitting pull requests for this project. Additionally, if your PR closes any open GitHub issues, make sure you include _Closes #XXXX_ in your comment or use the option on the PR's sidebar to add related issues to auto-close the issue that your PR fixes. **
2
+
3
+ **Description:**
4
+
5
+ Please include a summary of the change and which issue is fixed or which feature is introduced. If changes to the behavior are made, clearly describe what changes.
6
+ If changes to the UI are made, please include screenshots of the before and after.
7
+
8
+
9
+ I will abide by the [code of conduct](CODE_OF_CONDUCT.md).
metadata CHANGED
@@ -1,36 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harvesting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernesto Tagwerker
8
8
  - M. Scott Ford
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-09-04 00:00:00.000000000 Z
12
+ date: 2023-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '3.3'
21
18
  - - ">="
22
19
  - !ruby/object:Gem::Version
23
20
  version: '3.3'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '5.1'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
29
- - !ruby/object:Gem::Version
30
- version: '3.3'
31
28
  - - ">="
32
29
  - !ruby/object:Gem::Version
33
30
  version: '3.3'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.1'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: bundler
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -103,22 +103,22 @@ dependencies:
103
103
  name: byebug
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - "~>"
107
- - !ruby/object:Gem::Version
108
- version: '10.0'
109
106
  - - ">="
110
107
  - !ruby/object:Gem::Version
111
108
  version: '10.0'
109
+ - - "<"
110
+ - !ruby/object:Gem::Version
111
+ version: '12.0'
112
112
  type: :development
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - "~>"
117
- - !ruby/object:Gem::Version
118
- version: '10.0'
119
116
  - - ">="
120
117
  - !ruby/object:Gem::Version
121
118
  version: '10.0'
119
+ - - "<"
120
+ - !ruby/object:Gem::Version
121
+ version: '12.0'
122
122
  - !ruby/object:Gem::Dependency
123
123
  name: vcr
124
124
  requirement: !ruby/object:Gem::Requirement
@@ -179,6 +179,34 @@ dependencies:
179
179
  - - ">="
180
180
  - !ruby/object:Gem::Version
181
181
  version: '2.5'
182
+ - !ruby/object:Gem::Dependency
183
+ name: simplecov
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: 0.19.0
189
+ type: :development
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: 0.19.0
196
+ - !ruby/object:Gem::Dependency
197
+ name: codecov
198
+ requirement: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - "~>"
201
+ - !ruby/object:Gem::Version
202
+ version: 0.2.9
203
+ type: :development
204
+ prerelease: false
205
+ version_requirements: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - "~>"
208
+ - !ruby/object:Gem::Version
209
+ version: 0.2.9
182
210
  description: Interact with the Harvest API v2.0 from your Ruby application
183
211
  email:
184
212
  - ernesto+github@ombulabs.com
@@ -229,11 +257,12 @@ files:
229
257
  - lib/harvesting/models/user.rb
230
258
  - lib/harvesting/models/users.rb
231
259
  - lib/harvesting/version.rb
260
+ - pull_request_template.md
232
261
  homepage: https://github.com/fastruby/harvesting
233
262
  licenses:
234
263
  - MIT
235
264
  metadata: {}
236
- post_install_message:
265
+ post_install_message:
237
266
  rdoc_options: []
238
267
  require_paths:
239
268
  - lib
@@ -248,8 +277,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
277
  - !ruby/object:Gem::Version
249
278
  version: '0'
250
279
  requirements: []
251
- rubygems_version: 3.1.3
252
- signing_key:
280
+ rubygems_version: 3.4.10
281
+ signing_key:
253
282
  specification_version: 4
254
283
  summary: Ruby wrapper for the Harvest API v2.0
255
284
  test_files: []