asana 0.10.3 → 0.10.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +24 -0
  3. data/.github/workflows/pubilsh-to-rubygem.yml +18 -0
  4. data/.github/workflows/publish-to-github-releases.yml +16 -0
  5. data/.gitignore +0 -1
  6. data/Gemfile.lock +169 -0
  7. data/README.md +22 -9
  8. data/Rakefile +10 -14
  9. data/VERSION +1 -1
  10. data/asana.gemspec +2 -2
  11. data/examples/Gemfile.lock +2 -2
  12. data/lib/asana/http_client/error_handling.rb +11 -4
  13. data/lib/asana/resources/gen/audit_log_api_base.rb +37 -0
  14. data/lib/asana/resources/gen/goals_base.rb +218 -0
  15. data/lib/asana/resources/gen/project_briefs_base.rb +68 -0
  16. data/lib/asana/resources/gen/project_templates_base.rb +73 -0
  17. data/lib/asana/resources/gen/projects_base.rb +13 -0
  18. data/lib/asana/resources/gen/status_updates_base.rb +72 -0
  19. data/lib/asana/resources/gen/tasks_base.rb +2 -6
  20. data/lib/asana/resources/gen/teams_base.rb +15 -1
  21. data/lib/asana/resources/gen/time_periods_base.rb +47 -0
  22. data/lib/asana/resources/gen/typeahead_base.rb +1 -1
  23. data/lib/asana/resources/gen/users_base.rb +3 -4
  24. data/lib/asana/resources/gen/webhooks_base.rb +13 -0
  25. data/lib/asana/resources/portfolio.rb +3 -3
  26. data/lib/asana/version.rb +1 -1
  27. data/package-lock.json +115 -0
  28. data/samples/audit_log_api_sample.yaml +11 -0
  29. data/samples/goals_sample.yaml +161 -0
  30. data/samples/project_briefs_sample.yaml +41 -0
  31. data/samples/project_templates_sample.yaml +41 -0
  32. data/samples/projects_sample.yaml +10 -0
  33. data/samples/status_updates_sample.yaml +41 -0
  34. data/samples/teams_sample.yaml +10 -0
  35. data/samples/time_periods_sample.yaml +21 -0
  36. data/samples/webhooks_sample.yaml +10 -0
  37. metadata +28 -12
  38. data/.travis.yml +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cbc517a0b8e45655043ff4ac2a419f12be72db5a12cb6efc5e80c29b13ab64e
4
- data.tar.gz: ce52a082b48c060ca9f0d82c01534451c8a4f0417c745cfd40a71ae72f157944
3
+ metadata.gz: 86bb26b89d28d3852c328f9d36214265a6cfac22c1713ec082cae415f591e7af
4
+ data.tar.gz: 594914fb556e2c71f33c60fa8bfaefc99a4653b82ea3b7676e17242777b9f564
5
5
  SHA512:
6
- metadata.gz: b04794c205e810df61ae3e97b66c5b17671f5a0ab0843ba2a53d72aa3ed6904c2cc75a9142a517c86831de681c4f77278b1189cfd3f997c09bbd53802dce7e73
7
- data.tar.gz: fabf06e3ccd2ea24f09daf62597db360b56b4d666e89d214f793fcaa9159a29a16f0f68cfdbd67fab587b0e0ecc9a1ef6cec8bc86b37617ac56473f6fa51e4b9
6
+ metadata.gz: c062ee26c65570833090931f926d190789dd05ba51c464be76bd63f6152ab9be2413d32f6166503c395c5b4b477e52a7579b923d2df1c4fa2aa88c616dc9f1e3
7
+ data.tar.gz: a244bfe6034dc05f35b2b16b4fefe8b745786357f90035d3f9887481389842cd04424c0014aeed4b97df05c2f4ad0470b132b8cd21d4aad0a6b0c774f9f665a2
@@ -0,0 +1,24 @@
1
+ name: Build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+
11
+ jobs:
12
+ test:
13
+ name: Run
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ ruby: [2.5, 2.7, 3.0]
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ - run: bundle install
24
+ - run: bundle exec rake
@@ -0,0 +1,18 @@
1
+ name: Publish 📦 to RubyGems.org
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+
8
+ jobs:
9
+ publish-to-rubygems:
10
+ name: Publish 📦 to RubyGems.org
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout
14
+ uses: actions/checkout@v3
15
+ - name: Release
16
+ uses: dawidd6/action-publish-gem@v1
17
+ with:
18
+ api_key: ${{secrets.RUBYGEMS_API_KEY}}
@@ -0,0 +1,16 @@
1
+ name: Publish to GitHub Releases
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+
8
+ jobs:
9
+ publish-to-github:
10
+ name: Publish to GitHub Releases
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout
14
+ uses: actions/checkout@v3
15
+ - name: Release
16
+ uses: softprops/action-gh-release@v1
data/.gitignore CHANGED
@@ -1,7 +1,6 @@
1
1
  .idea
2
2
  /.bundle/
3
3
  /.yardoc
4
- /Gemfile.lock
5
4
  /_yardoc/
6
5
  /coverage/
7
6
  /doc/
data/Gemfile.lock ADDED
@@ -0,0 +1,169 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ asana (0.10.12)
5
+ faraday (~> 1.0)
6
+ faraday_middleware (~> 1.0)
7
+ faraday_middleware-multi_json (~> 0.0)
8
+ oauth2 (~> 1.4)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ appraisal (2.4.1)
14
+ bundler
15
+ rake
16
+ thor (>= 0.14.0)
17
+ ast (2.4.2)
18
+ byebug (11.1.3)
19
+ coderay (1.1.3)
20
+ diff-lcs (1.5.0)
21
+ docile (1.4.0)
22
+ faraday (1.10.0)
23
+ faraday-em_http (~> 1.0)
24
+ faraday-em_synchrony (~> 1.0)
25
+ faraday-excon (~> 1.1)
26
+ faraday-httpclient (~> 1.0)
27
+ faraday-multipart (~> 1.0)
28
+ faraday-net_http (~> 1.0)
29
+ faraday-net_http_persistent (~> 1.0)
30
+ faraday-patron (~> 1.0)
31
+ faraday-rack (~> 1.0)
32
+ faraday-retry (~> 1.0)
33
+ ruby2_keywords (>= 0.0.4)
34
+ faraday-em_http (1.0.0)
35
+ faraday-em_synchrony (1.0.0)
36
+ faraday-excon (1.1.0)
37
+ faraday-httpclient (1.0.1)
38
+ faraday-multipart (1.0.4)
39
+ multipart-post (~> 2)
40
+ faraday-net_http (1.0.1)
41
+ faraday-net_http_persistent (1.2.0)
42
+ faraday-patron (1.0.0)
43
+ faraday-rack (1.0.0)
44
+ faraday-retry (1.0.3)
45
+ faraday_middleware (1.2.0)
46
+ faraday (~> 1.0)
47
+ faraday_middleware-multi_json (0.0.6)
48
+ faraday_middleware
49
+ multi_json
50
+ ffi (1.15.5)
51
+ formatador (1.1.0)
52
+ guard (2.18.0)
53
+ formatador (>= 0.2.4)
54
+ listen (>= 2.7, < 4.0)
55
+ lumberjack (>= 1.0.12, < 2.0)
56
+ nenv (~> 0.1)
57
+ notiffany (~> 0.0)
58
+ pry (>= 0.13.0)
59
+ shellany (~> 0.0)
60
+ thor (>= 0.18.1)
61
+ guard-compat (1.2.1)
62
+ guard-rspec (4.7.3)
63
+ guard (~> 2.1)
64
+ guard-compat (~> 1.1)
65
+ rspec (>= 2.99.0, < 4.0)
66
+ guard-rubocop (1.5.0)
67
+ guard (~> 2.0)
68
+ rubocop (< 2.0)
69
+ guard-yard (2.2.1)
70
+ guard (>= 1.1.0)
71
+ yard (>= 0.7.0)
72
+ jwt (2.4.1)
73
+ listen (3.7.1)
74
+ rb-fsevent (~> 0.10, >= 0.10.3)
75
+ rb-inotify (~> 0.9, >= 0.9.10)
76
+ lumberjack (1.2.8)
77
+ method_source (1.0.0)
78
+ multi_json (1.15.0)
79
+ multi_xml (0.6.0)
80
+ multipart-post (2.2.3)
81
+ nenv (0.3.0)
82
+ notiffany (0.1.3)
83
+ nenv (~> 0.1)
84
+ shellany (~> 0.0)
85
+ oauth2 (1.4.9)
86
+ faraday (>= 0.17.3, < 3.0)
87
+ jwt (>= 1.0, < 3.0)
88
+ multi_json (~> 1.3)
89
+ multi_xml (~> 0.5)
90
+ rack (>= 1.2, < 3)
91
+ parallel (1.22.1)
92
+ parser (2.7.2.0)
93
+ ast (~> 2.4.1)
94
+ powerpack (0.1.3)
95
+ pry (0.14.1)
96
+ coderay (~> 1.1)
97
+ method_source (~> 1.0)
98
+ rack (2.2.3.1)
99
+ rack-protection (1.5.5)
100
+ rack
101
+ rainbow (3.1.1)
102
+ rake (13.0.6)
103
+ rb-fsevent (0.11.1)
104
+ rb-inotify (0.10.1)
105
+ ffi (~> 1.0)
106
+ rspec (3.11.0)
107
+ rspec-core (~> 3.11.0)
108
+ rspec-expectations (~> 3.11.0)
109
+ rspec-mocks (~> 3.11.0)
110
+ rspec-core (3.11.0)
111
+ rspec-support (~> 3.11.0)
112
+ rspec-expectations (3.11.0)
113
+ diff-lcs (>= 1.2.0, < 2.0)
114
+ rspec-support (~> 3.11.0)
115
+ rspec-mocks (3.11.1)
116
+ diff-lcs (>= 1.2.0, < 2.0)
117
+ rspec-support (~> 3.11.0)
118
+ rspec-support (3.11.0)
119
+ rubocop (0.52.1)
120
+ parallel (~> 1.10)
121
+ parser (>= 2.4.0.2, < 3.0)
122
+ powerpack (~> 0.1)
123
+ rainbow (>= 2.2.2, < 4.0)
124
+ ruby-progressbar (~> 1.7)
125
+ unicode-display_width (~> 1.0, >= 1.0.1)
126
+ rubocop-rspec (1.22.2)
127
+ rubocop (>= 0.52.1)
128
+ ruby-progressbar (1.11.0)
129
+ ruby2_keywords (0.0.5)
130
+ shellany (0.0.1)
131
+ simplecov (0.21.2)
132
+ docile (~> 1.1)
133
+ simplecov-html (~> 0.11)
134
+ simplecov_json_formatter (~> 0.1)
135
+ simplecov-html (0.12.3)
136
+ simplecov_json_formatter (0.1.4)
137
+ thor (1.2.1)
138
+ tomparse (0.4.2)
139
+ unicode-display_width (1.8.0)
140
+ webrick (1.7.0)
141
+ yard (0.9.28)
142
+ webrick (~> 1.7.0)
143
+ yard-tomdoc (0.7.1)
144
+ tomparse (>= 0.4.0)
145
+ yard
146
+
147
+ PLATFORMS
148
+ universal-darwin-21
149
+ x86_64-linux
150
+
151
+ DEPENDENCIES
152
+ appraisal (~> 2.1, >= 2.1)
153
+ asana!
154
+ byebug
155
+ guard
156
+ guard-rspec
157
+ guard-rubocop
158
+ guard-yard
159
+ rack-protection (= 1.5.5)
160
+ rake (~> 13.0)
161
+ rspec (~> 3.2)
162
+ rubocop (~> 0.52.1)
163
+ rubocop-rspec (~> 1.22.2)
164
+ simplecov
165
+ yard
166
+ yard-tomdoc
167
+
168
+ BUNDLED WITH
169
+ 2.3.13
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Asana
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/asana.svg)](http://badge.fury.io/rb/asana)
4
- [![Build Status](https://travis-ci.org/Asana/ruby-asana.svg?branch=master)](https://travis-ci.org/Asana/ruby-asana)
4
+ [![Build Status](https://github.com/Asana/ruby-asana/workflows/Build/badge.svg)](https://github.com/Asana/ruby-asana/actions)
5
5
  [![Code Climate](https://codeclimate.com/github/Asana/ruby-asana/badges/gpa.svg)](https://codeclimate.com/github/Asana/ruby-asana)
6
6
 
7
7
 
@@ -132,7 +132,7 @@ get '/auth/:name/callback' do
132
132
  $client = Asana::Client.new do |c|
133
133
  c.authentication :oauth2, access_token
134
134
  end
135
-
135
+
136
136
  redirect '/'
137
137
  end
138
138
  ```
@@ -214,8 +214,10 @@ In any request against the Asana API, there a number of errors that could
214
214
  arise. Those are well documented in the [Asana API Documentation][apidocs], and
215
215
  are represented as exceptions under the namespace `Asana::Errors`.
216
216
 
217
- All errors are subclasses of `Asana::Errors::APIError`, so make sure to rescue
218
- instances of this class if you want to handle them yourself.
217
+ The Asana client automatically handles and retries requests upon receipt of
218
+ 500 (Internal Server Error) responses from the Asana API. If you want to handle
219
+ any 4xx errors, you will have to do that yourself; you can do this by rescuing
220
+ `Asana::Errors::APIError`, the parent class of all Asana API errors.
219
221
 
220
222
  ### I/O options
221
223
 
@@ -305,7 +307,7 @@ If you receive one of these warnings, you should:
305
307
  You can add global headers, by setting default_headers
306
308
 
307
309
  c.default_headers "asana-enable" => "string_ids"
308
-
310
+
309
311
  Or you can add a header field to the options of each request.
310
312
 
311
313
  If you would rather suppress these warnings, you can set
@@ -314,7 +316,7 @@ If you would rather suppress these warnings, you can set
314
316
 
315
317
  ## Development
316
318
 
317
- You'll need Ruby 2.1+ and Node v0.10.26+ / NPM 1.4.3+ installed.
319
+ You'll need Ruby 2.5+ and Node v0.10.26+ / NPM 1.4.3+ installed.
318
320
 
319
321
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
320
322
  `bin/console` for an interactive prompt that will allow you to experiment.
@@ -333,11 +335,22 @@ To release a new version, run either of these commands:
333
335
  rake bump:minor
334
336
  rake bump:major
335
337
 
336
- This will: update `lib/asana/version.rb`, commit and tag the commit. Then you
337
- just need to `push --tags` to let Travis build and release the new version to
338
+ This will: update `lib/asana/version.rb` and `VERSION`, commit and tag the commit. Then you
339
+ just need to `push --tags` to let GitHub Actions build and release the new version to
338
340
  Rubygems:
339
341
 
340
- git push --tags
342
+ git push --tags origin master:master
343
+
344
+ ### Manual Deployment
345
+
346
+ 1. Merge in the desired changes into the `master` branch and commit them.
347
+ 2. Clone the repo, work on master.
348
+ 3. Edit package version in `lib/asana/version.rb` and `VERSION` to indicate the [semantic version](http://semver.org/) change.
349
+ 4. Commit the change
350
+ 5. Tag the commit with `v` plus the same version number you set in the file.
351
+ `git tag v1.2.3`
352
+ 6. Push changes to origin, including tags:
353
+ `git push --tags origin master:master`
341
354
 
342
355
  ### Code generation
343
356
 
data/Rakefile CHANGED
@@ -29,6 +29,11 @@ namespace :bump do
29
29
 
30
30
  # rubocop:disable Metrics/MethodLength
31
31
  def write_version(major, minor, patch)
32
+
33
+ File.open('VERSION', 'w') do |f|
34
+ f.write "#{major}.#{minor}.#{patch}"
35
+ end
36
+
32
37
  str = <<-EOS
33
38
  #:nodoc:
34
39
  module Asana
@@ -41,10 +46,13 @@ EOS
41
46
  end
42
47
 
43
48
  new_version = "#{major}.#{minor}.#{patch}"
49
+ system('bundle lock --update')
50
+ system('git add Gemfile.lock')
51
+ system('git add VERSION')
44
52
  system('git add lib/asana/version.rb')
45
53
  system(%(git commit -m "Bumped to #{new_version}" && ) +
46
54
  %(git tag -a v#{new_version} -m "Version #{new_version}"))
47
- puts "\nRun git push --tags to release."
55
+ puts "\nRun git push --tags origin master:master to release."
48
56
  end
49
57
 
50
58
  desc 'Bumps a patch version'
@@ -72,17 +80,5 @@ task default: [:all, :rubocop, :yard]
72
80
 
73
81
  desc 'Test the plugin under all supported Rails versions.'
74
82
  task :all do |_t|
75
- if ENV['TRAVIS']
76
- # require 'json'
77
- # puts JSON.pretty_generate(ENV.to_hash)
78
- if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
79
- appraisal_name = ENV['BUNDLE_GEMFILE'].scan(/faraday\_(.*)\.gemfile/).flatten.first
80
- command_prefix = "appraisal faraday-#{appraisal_name}"
81
- exec("#{command_prefix} bundle install && #{command_prefix} bundle exec rspec")
82
- else
83
- exec(' bundle exec appraisal install && bundle exec rake appraisal spec')
84
- end
85
- else
86
- exec('bundle exec appraisal install && bundle exec rake appraisal spec')
87
- end
83
+ exec('bundle exec appraisal install && bundle exec rake appraisal spec')
88
84
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.3
1
+ 0.10.12
data/asana.gemspec CHANGED
@@ -19,14 +19,14 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.required_ruby_version = '> 2.0'
22
+ spec.required_ruby_version = '>= 2.5'
23
23
 
24
24
  spec.add_dependency "oauth2", "~> 1.4"
25
25
  spec.add_dependency "faraday", "~> 1.0"
26
26
  spec.add_dependency "faraday_middleware", "~> 1.0"
27
27
  spec.add_dependency "faraday_middleware-multi_json", "~> 0.0"
28
28
 
29
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rake", "~> 13.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.2"
31
31
  spec.add_development_dependency 'appraisal', '~> 2.1', '>= 2.1'
32
32
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- asana (0.10.3)
4
+ asana (0.10.5)
5
5
  faraday (~> 1.0)
6
6
  faraday_middleware (~> 1.0)
7
7
  faraday_middleware-multi_json (~> 0.0)
@@ -27,7 +27,7 @@ GEM
27
27
  multi_json (~> 1.3)
28
28
  multi_xml (~> 0.5)
29
29
  rack (>= 1.2, < 3)
30
- rack (2.2.3)
30
+ rack (2.2.3.1)
31
31
 
32
32
  PLATFORMS
33
33
  ruby
@@ -11,7 +11,7 @@ module Asana
11
11
 
12
12
  module_function
13
13
 
14
- MAX_TIMEOUTS = 5
14
+ MAX_RETRIES = 5
15
15
 
16
16
  # Public: Perform a request handling any API errors correspondingly.
17
17
  #
@@ -28,7 +28,7 @@ module Asana
28
28
  # Raises [Asana::Errors::APIError] when the API returns an unknown error.
29
29
  #
30
30
  # rubocop:disable all
31
- def handle(num_timeouts=0, &request)
31
+ def handle(num_retries=0, &request)
32
32
  request.call
33
33
  rescue Faraday::ClientError => e
34
34
  raise e unless e.response
@@ -43,9 +43,16 @@ module Asana
43
43
  when 500 then raise server_error(e.response)
44
44
  else raise api_error(e.response)
45
45
  end
46
+ # Retry for timeouts or 500s from Asana
47
+ rescue Faraday::ServerError => e
48
+ if num_retries < MAX_RETRIES
49
+ handle(num_retries + 1, &request)
50
+ else
51
+ raise server_error(e.response)
52
+ end
46
53
  rescue Net::ReadTimeout => e
47
- if num_timeouts < MAX_TIMEOUTS
48
- handle(num_timeouts + 1, &request)
54
+ if num_retries < MAX_RETRIES
55
+ handle(num_retries + 1, &request)
49
56
  else
50
57
  raise e
51
58
  end
@@ -0,0 +1,37 @@
1
+ ### WARNING: This file is auto-generated by our OpenAPI spec. Do not
2
+ ### edit it manually.
3
+
4
+ require_relative '../../resource_includes/response_helper'
5
+
6
+ module Asana
7
+ module Resources
8
+ class AuditLogAPIBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Get audit log events
16
+ #
17
+ # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
18
+ # start_at - [datetime] Filter to events created after this time (inclusive).
19
+ # end_at - [datetime] Filter to events created before this time (exclusive).
20
+ # event_type - [str] Filter to events of this type. Refer to the [Supported AuditLogEvents](/docs/supported-auditlogevents) for a full list of values.
21
+ # actor_type - [str] Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded.
22
+ # actor_gid - [str] Filter to events triggered by the actor with this ID.
23
+ # resource_gid - [str] Filter to events with this resource ID.
24
+ # options - [Hash] the request I/O options
25
+ # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
26
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
27
+ def get_audit_log_events(client, workspace_gid: required("workspace_gid"), start_at: nil, end_at: nil, event_type: nil, actor_type: nil, actor_gid: nil, resource_gid: nil, options: {})
28
+ path = "/workspaces/{workspace_gid}/audit_log_events"
29
+ path["{workspace_gid}"] = workspace_gid
30
+ params = { start_at: start_at, end_at: end_at, event_type: event_type, actor_type: actor_type, actor_gid: actor_gid, resource_gid: resource_gid }.reject { |_,v| v.nil? || Array(v).empty? }
31
+ Collection.new(parse(client.get(path, params: params, options: options)), type: Resource, client: client)
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end