asana 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +1 -1
  3. data/.rubocop.yml +38 -3
  4. data/.ruby-version +1 -1
  5. data/Appraisals +8 -3
  6. data/Gemfile +7 -3
  7. data/Gemfile.lock +54 -64
  8. data/Guardfile +12 -10
  9. data/README.md +24 -12
  10. data/Rakefile +14 -17
  11. data/VERSION +1 -1
  12. data/asana.gemspec +20 -18
  13. data/examples/cli_app.rb +2 -2
  14. data/examples/events.rb +3 -3
  15. data/examples/personal_access_token.rb +2 -2
  16. data/lib/asana/authentication/oauth2/access_token_authentication.rb +4 -1
  17. data/lib/asana/authentication/oauth2/bearer_token_authentication.rb +3 -2
  18. data/lib/asana/authentication/oauth2/client.rb +2 -0
  19. data/lib/asana/authentication/oauth2.rb +6 -4
  20. data/lib/asana/authentication/token_authentication.rb +3 -1
  21. data/lib/asana/authentication.rb +2 -0
  22. data/lib/asana/client/configuration.rb +6 -5
  23. data/lib/asana/client.rb +13 -11
  24. data/lib/asana/errors.rb +16 -11
  25. data/lib/asana/http_client/environment_info.rb +9 -8
  26. data/lib/asana/http_client/error_handling.rb +23 -24
  27. data/lib/asana/http_client/response.rb +2 -0
  28. data/lib/asana/http_client.rb +66 -65
  29. data/lib/asana/resource_includes/attachment_uploading.rb +6 -6
  30. data/lib/asana/resource_includes/collection.rb +4 -4
  31. data/lib/asana/resource_includes/event.rb +2 -0
  32. data/lib/asana/resource_includes/event_subscription.rb +2 -0
  33. data/lib/asana/resource_includes/events.rb +4 -1
  34. data/lib/asana/resource_includes/registry.rb +2 -0
  35. data/lib/asana/resource_includes/resource.rb +8 -5
  36. data/lib/asana/resource_includes/response_helper.rb +2 -0
  37. data/lib/asana/resources/audit_log_api.rb +42 -0
  38. data/lib/asana/resources/gen/attachments_base.rb +1 -1
  39. data/lib/asana/resources/gen/audit_log_api_base.rb +1 -1
  40. data/lib/asana/resources/gen/memberships_base.rb +71 -0
  41. data/lib/asana/resources/gen/tasks_base.rb +1 -1
  42. data/lib/asana/resources/goal.rb +54 -0
  43. data/lib/asana/resources/goal_relationship.rb +32 -0
  44. data/lib/asana/resources/membership.rb +20 -0
  45. data/lib/asana/resources/project_brief.rb +30 -0
  46. data/lib/asana/resources/project_template.rb +36 -0
  47. data/lib/asana/resources/status_update.rb +54 -0
  48. data/lib/asana/resources/time_period.rb +30 -0
  49. data/lib/asana/resources/typeahead.rb +1 -1
  50. data/lib/asana/resources.rb +4 -4
  51. data/lib/asana/ruby2_0_0_compatibility.rb +2 -0
  52. data/lib/asana/version.rb +1 -1
  53. data/lib/asana.rb +2 -0
  54. data/samples/memberships_sample.yaml +41 -0
  55. metadata +57 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79c29d830033169faeef65fea64f81703176051201c2047cb951f9456471baa6
4
- data.tar.gz: fe391a1e882fe5291437eb9f2052b887c888b8e259f3182cf35d2ddf2ffc72c8
3
+ metadata.gz: 17dd95f3708910e6ac5e5fe3c342c26e1c26a93ddc2fe7609b3798fb4650f47d
4
+ data.tar.gz: 68d454cad1b9f85e93f2ab8ed3f20ddc24f8989fafb12bbe7f19bfc30aefd9c9
5
5
  SHA512:
6
- metadata.gz: 789b9cd1fb242c9c07496f2fc4123de1c6e1218ead39952ff1965526ed0bf3910f4f392bbead235f4ba1a1df17b1af09410d89dfb92d96077ebadcb9919615f1
7
- data.tar.gz: bb90c3775c43110ce691e19d594cb696f477d10012e7c693318a7d9f1a04365c527fce606668948cf9ead376bdb098ee010c62aae55843d785a43759dd6b0785
6
+ metadata.gz: c04179f61fe4f7520853c24db93ab47db57de5b25a7751c982ced551613badfbd84a5408d7ff82bb6669a3057a417c6680e58a35787ec6f1fbc57f53ca788b7a
7
+ data.tar.gz: 35d8d1daa0c43915b6959735ca69b65fba2cab1936e44719082e6d52baadeb33e1770b6ba0b38d8e46cfedfd3e86864152a6591fe30f643b8e386217756bc932
@@ -14,7 +14,7 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  matrix:
17
- ruby: [2.5, 2.7, 3.0]
17
+ ruby: [2.7, 3.0, 3.1]
18
18
  steps:
19
19
  - uses: actions/checkout@v3
20
20
  - uses: ruby/setup-ruby@v1
data/.rubocop.yml CHANGED
@@ -1,14 +1,49 @@
1
+ require: rubocop-rspec
2
+
1
3
  AllCops:
2
- Include:
3
- - '**/Rakefile'
4
+ TargetRubyVersion: 2.7
5
+ NewCops: enable
4
6
  Exclude:
5
7
  - 'bin/**/*'
6
8
  - 'examples/**/*'
7
9
  - 'lib/asana/resources/*'
10
+ - 'lib/asana/resources/gen/**/*'
8
11
  - 'spec/templates/unicorn.rb'
9
12
  - 'spec/templates/world.rb'
10
13
  - 'test.rb'
11
14
 
12
15
  LineLength:
13
16
  Max: 120
14
- require: rubocop-rspec
17
+
18
+ Metrics/ParameterLists:
19
+ Enabled: false
20
+
21
+ Metrics/ClassLength:
22
+ Enabled: false
23
+
24
+ Metrics/MethodLength:
25
+ Max: 20
26
+
27
+ Metrics/CyclomaticComplexity:
28
+ Max: 20
29
+
30
+ Metrics/PerceivedComplexity:
31
+ Max: 20
32
+
33
+ RSpec/ContextWording:
34
+ Enabled: false
35
+
36
+ RSpec/ExampleLength:
37
+ Enabled: false
38
+
39
+ RSpec/MultipleExpectations:
40
+ Enabled: false
41
+
42
+ RSpec/NestedGroups:
43
+ Enabled: false
44
+
45
+ RSpec/FilePath:
46
+ CustomTransform: {'OAuth2': 'oauth2'}
47
+
48
+ RSpec/MultipleMemoizedHelpers:
49
+ Enabled: false
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.7.6
data/Appraisals CHANGED
@@ -1,4 +1,9 @@
1
+ # frozen_string_literal: true
1
2
 
2
- appraise "faraday-1.0.0" do
3
- gem "faraday", "1.0.0"
4
- end
3
+ appraise 'faraday-2.7.0' do
4
+ gem 'faraday', '2.7.0'
5
+ end
6
+
7
+ appraise 'faraday-2.6.0' do
8
+ gem 'faraday', '2.6.0'
9
+ end
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in asana.gemspec
@@ -9,8 +11,10 @@ group :tools do
9
11
  # routinely adds new checks which can cause our build to "break" even when no
10
12
  # changes have been made. In this situation it's better to intentionally
11
13
  # upgrade Rubocop and fix issues at that time.
12
- gem 'rubocop', '~> 0.52.1'
13
- gem 'rubocop-rspec', '~> 1.22.2'
14
+ gem 'rubocop', '~> 1.47.0'
15
+ gem 'rubocop-rspec', '~> 2.18.1'
16
+
17
+ gem 'oauth2', '~> 2.0.3'
14
18
 
15
19
  gem 'guard'
16
20
  gem 'guard-rspec'
@@ -24,5 +28,5 @@ group :tools do
24
28
 
25
29
  gem 'simplecov', require: false
26
30
 
27
- gem "rack-protection", "1.5.5"
31
+ gem 'rack-protection', '1.5.5'
28
32
  end
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- asana (2.0.0)
5
- faraday (~> 1.0)
6
- faraday_middleware (~> 1.0)
7
- faraday_middleware-multi_json (~> 0.0)
4
+ asana (2.0.2)
5
+ faraday (~> 2.0)
6
+ faraday-follow_redirects
7
+ faraday-multipart
8
8
  oauth2 (>= 1.4, < 3)
9
9
 
10
10
  GEM
@@ -19,34 +19,14 @@ GEM
19
19
  coderay (1.1.3)
20
20
  diff-lcs (1.5.0)
21
21
  docile (1.4.0)
22
- faraday (1.10.2)
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)
22
+ faraday (2.7.4)
23
+ faraday-net_http (>= 2.0, < 3.1)
33
24
  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)
25
+ faraday-follow_redirects (0.3.0)
26
+ faraday (>= 1, < 3)
38
27
  faraday-multipart (1.0.4)
39
28
  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
29
+ faraday-net_http (3.0.2)
50
30
  ffi (1.15.5)
51
31
  formatador (1.1.0)
52
32
  guard (2.18.0)
@@ -70,34 +50,33 @@ GEM
70
50
  guard (>= 1.1.0)
71
51
  yard (>= 0.7.0)
72
52
  hashie (5.0.0)
73
- jwt (2.5.0)
74
- listen (3.7.1)
53
+ json (2.6.3)
54
+ jwt (2.7.0)
55
+ listen (3.8.0)
75
56
  rb-fsevent (~> 0.10, >= 0.10.3)
76
57
  rb-inotify (~> 0.9, >= 0.9.10)
77
58
  lumberjack (1.2.8)
78
59
  method_source (1.0.0)
79
- multi_json (1.15.0)
80
60
  multi_xml (0.6.0)
81
- multipart-post (2.2.3)
61
+ multipart-post (2.3.0)
82
62
  nenv (0.3.0)
83
63
  notiffany (0.1.3)
84
64
  nenv (~> 0.1)
85
65
  shellany (~> 0.0)
86
- oauth2 (2.0.8)
66
+ oauth2 (2.0.9)
87
67
  faraday (>= 0.17.3, < 3.0)
88
68
  jwt (>= 1.0, < 3.0)
89
69
  multi_xml (~> 0.5)
90
- rack (>= 1.2, < 3)
70
+ rack (>= 1.2, < 4)
91
71
  snaky_hash (~> 2.0)
92
72
  version_gem (~> 1.1)
93
73
  parallel (1.22.1)
94
- parser (2.7.2.0)
74
+ parser (3.2.1.0)
95
75
  ast (~> 2.4.1)
96
- powerpack (0.1.3)
97
- pry (0.14.1)
76
+ pry (0.14.2)
98
77
  coderay (~> 1.1)
99
78
  method_source (~> 1.0)
100
- rack (2.2.4)
79
+ rack (3.0.4.2)
101
80
  rack-protection (1.5.5)
102
81
  rack
103
82
  rainbow (3.1.1)
@@ -105,44 +84,54 @@ GEM
105
84
  rb-fsevent (0.11.2)
106
85
  rb-inotify (0.10.1)
107
86
  ffi (~> 1.0)
108
- rspec (3.11.0)
109
- rspec-core (~> 3.11.0)
110
- rspec-expectations (~> 3.11.0)
111
- rspec-mocks (~> 3.11.0)
112
- rspec-core (3.11.0)
113
- rspec-support (~> 3.11.0)
114
- rspec-expectations (3.11.0)
87
+ regexp_parser (2.7.0)
88
+ rexml (3.2.5)
89
+ rspec (3.12.0)
90
+ rspec-core (~> 3.12.0)
91
+ rspec-expectations (~> 3.12.0)
92
+ rspec-mocks (~> 3.12.0)
93
+ rspec-core (3.12.1)
94
+ rspec-support (~> 3.12.0)
95
+ rspec-expectations (3.12.2)
115
96
  diff-lcs (>= 1.2.0, < 2.0)
116
- rspec-support (~> 3.11.0)
117
- rspec-mocks (3.11.1)
97
+ rspec-support (~> 3.12.0)
98
+ rspec-mocks (3.12.3)
118
99
  diff-lcs (>= 1.2.0, < 2.0)
119
- rspec-support (~> 3.11.0)
120
- rspec-support (3.11.0)
121
- rubocop (0.52.1)
100
+ rspec-support (~> 3.12.0)
101
+ rspec-support (3.12.0)
102
+ rubocop (1.47.0)
103
+ json (~> 2.3)
122
104
  parallel (~> 1.10)
123
- parser (>= 2.4.0.2, < 3.0)
124
- powerpack (~> 0.1)
105
+ parser (>= 3.2.0.0)
125
106
  rainbow (>= 2.2.2, < 4.0)
107
+ regexp_parser (>= 1.8, < 3.0)
108
+ rexml (>= 3.2.5, < 4.0)
109
+ rubocop-ast (>= 1.26.0, < 2.0)
126
110
  ruby-progressbar (~> 1.7)
127
- unicode-display_width (~> 1.0, >= 1.0.1)
128
- rubocop-rspec (1.22.2)
129
- rubocop (>= 0.52.1)
130
- ruby-progressbar (1.11.0)
111
+ unicode-display_width (>= 2.4.0, < 3.0)
112
+ rubocop-ast (1.27.0)
113
+ parser (>= 3.2.1.0)
114
+ rubocop-capybara (2.17.1)
115
+ rubocop (~> 1.41)
116
+ rubocop-rspec (2.18.1)
117
+ rubocop (~> 1.33)
118
+ rubocop-capybara (~> 2.17)
119
+ ruby-progressbar (1.13.0)
131
120
  ruby2_keywords (0.0.5)
132
121
  shellany (0.0.1)
133
- simplecov (0.21.2)
122
+ simplecov (0.22.0)
134
123
  docile (~> 1.1)
135
124
  simplecov-html (~> 0.11)
136
125
  simplecov_json_formatter (~> 0.1)
137
126
  simplecov-html (0.12.3)
138
127
  simplecov_json_formatter (0.1.4)
139
- snaky_hash (2.0.0)
128
+ snaky_hash (2.0.1)
140
129
  hashie
141
- version_gem (~> 1.1)
130
+ version_gem (~> 1.1, >= 1.1.1)
142
131
  thor (1.2.1)
143
132
  tomparse (0.4.2)
144
- unicode-display_width (1.8.0)
145
- version_gem (1.1.0)
133
+ unicode-display_width (2.4.2)
134
+ version_gem (1.1.1)
146
135
  webrick (1.7.0)
147
136
  yard (0.9.28)
148
137
  webrick (~> 1.7.0)
@@ -151,6 +140,7 @@ GEM
151
140
  yard
152
141
 
153
142
  PLATFORMS
143
+ ruby
154
144
  universal-darwin-21
155
145
  x86_64-linux
156
146
 
@@ -166,8 +156,8 @@ DEPENDENCIES
166
156
  rack-protection (= 1.5.5)
167
157
  rake (~> 13.0)
168
158
  rspec (~> 3.2)
169
- rubocop (~> 0.52.1)
170
- rubocop-rspec (~> 1.22.2)
159
+ rubocop (~> 1.47.0)
160
+ rubocop-rspec (~> 2.18.1)
171
161
  simplecov
172
162
  yard
173
163
  yard-tomdoc
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A sample Guardfile
2
4
  # More info at https://github.com/guard/guard#readme
3
5
 
@@ -23,7 +25,7 @@
23
25
  #
24
26
  # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
25
27
 
26
- # Note: The cmd option is now required due to the increasing number of ways
28
+ # NOTE: The cmd option is now required due to the increasing number of ways
27
29
  # rspec may be run, below are examples of the most common uses.
28
30
  # * bundler: 'bundle exec rspec'
29
31
  # * bundler binstubs: 'bin/rspec'
@@ -32,8 +34,8 @@
32
34
  # * zeus: 'zeus rspec' (requires the server to be started separately)
33
35
  # * 'just' rspec: 'rspec'
34
36
 
35
- guard :rspec, cmd: "bundle exec rspec" do
36
- require "guard/rspec/dsl"
37
+ guard :rspec, cmd: 'bundle exec rspec' do
38
+ require 'guard/rspec/dsl'
37
39
  dsl = Guard::RSpec::Dsl.new(self)
38
40
 
39
41
  # Feel free to open issues for suggestions and improvements
@@ -47,15 +49,15 @@ guard :rspec, cmd: "bundle exec rspec" do
47
49
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
48
50
 
49
51
  # Rails files
50
- rails = dsl.rails(view_extensions: %w(erb haml slim))
52
+ rails = dsl.rails(view_extensions: %w[erb haml slim])
51
53
  dsl.watch_spec_files_for(rails.app_files)
52
54
  dsl.watch_spec_files_for(rails.views)
53
55
 
54
56
  watch(rails.controllers) do |m|
55
57
  [
56
- rspec.spec.("routing/#{m[1]}_routing"),
57
- rspec.spec.("controllers/#{m[1]}_controller"),
58
- rspec.spec.("acceptance/#{m[1]}")
58
+ rspec.spec.call("routing/#{m[1]}_routing"),
59
+ rspec.spec.call("controllers/#{m[1]}_controller"),
60
+ rspec.spec.call("acceptance/#{m[1]}")
59
61
  ]
60
62
  end
61
63
 
@@ -65,17 +67,17 @@ guard :rspec, cmd: "bundle exec rspec" do
65
67
  watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
66
68
 
67
69
  # Capybara features specs
68
- watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
70
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
69
71
 
70
72
  # Turnip features and steps
71
73
  watch(%r{^spec/acceptance/(.+)\.feature$})
72
74
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
73
- Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
75
+ Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
74
76
  end
75
77
  end
76
78
 
77
79
  guard :rubocop do
78
- watch(%r{.+\.rb$})
80
+ watch(/.+\.rb$/)
79
81
  watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
80
82
  end
81
83
 
data/README.md CHANGED
@@ -9,7 +9,9 @@ A Ruby client for the 1.0 version of the Asana API.
9
9
 
10
10
  Supported rubies:
11
11
 
12
- * MRI 2.0.0 up to 2.2.x stable
12
+ * MRI 2.7.x
13
+ * MRI 3.0.x
14
+ * MRI 3.1.x
13
15
 
14
16
  ## Gem Installation
15
17
  Add this line to your application's Gemfile:
@@ -41,7 +43,7 @@ client = Asana::Client.new do |c|
41
43
  c.authentication :access_token, 'personal_access_token'
42
44
  end
43
45
 
44
- client.workspaces.find_all.first
46
+ client.workspaces.get_workspaces.first
45
47
  ```
46
48
 
47
49
  A full-blown customized client using OAuth2 wih a previously obtained refresh
@@ -61,7 +63,7 @@ client = Asana::Client.new do |c|
61
63
  c.configure_faraday { |conn| conn.use SomeFaradayMiddleware }
62
64
  end
63
65
 
64
- workspace = client.workspaces.find_by_id(12)
66
+ workspace = client.workspaces.get_workspace(12)
65
67
  workspace.users
66
68
  # => #<Asana::Collection<User> ...>
67
69
  client.tags.create_in_workspace(workspace: workspace.id, name: 'foo')
@@ -152,7 +154,7 @@ client = Asana::Client.new do |c|
152
154
  c.authentication :oauth2, access_token
153
155
  end
154
156
 
155
- client.tasks.find_by_id(12)
157
+ client.tasks.get_task(12)
156
158
  ```
157
159
 
158
160
  This will print an authorization URL on STDOUT, and block until you paste in the
@@ -166,7 +168,7 @@ results per page to fetch, between 1 and 100. If you don't provide any, it
166
168
  defaults to 20.
167
169
 
168
170
  ```ruby
169
- my_tasks = client.tasks.find_by_tag(tag: tag_id, per_page: 5)
171
+ my_tasks = client.tasks.get_tasks_for_tag(tag: tag_id, per_page: 5)
170
172
  # => #<Asana::Collection<Task> ...>
171
173
  ```
172
174
 
@@ -226,7 +228,7 @@ All requests (except `DELETE`) accept extra I/O options
226
228
  request:
227
229
 
228
230
  ```ruby
229
- client.tasks.find_by_id(12, options: { expand: ['workspace'] })
231
+ client.tasks.get_task(12, options: { expand: ['workspace'] })
230
232
  ```
231
233
 
232
234
  ### Attachment uploading
@@ -235,7 +237,7 @@ To attach a file to a task or a project, you just need its absolute path on your
235
237
  filesystem and its MIME type, and the file will be uploaded for you:
236
238
 
237
239
  ```ruby
238
- task = client.tasks.find_by_id(12)
240
+ task = client.tasks.get_task(12)
239
241
  attachment = task.attach(filename: '/absolute/path/to/my/file.png',
240
242
  mime: 'image/png')
241
243
  attachment.name # => 'file.png'
@@ -247,7 +249,7 @@ To subscribe to an event stream of a task or a project, just call `#events` on
247
249
  it:
248
250
 
249
251
  ```ruby
250
- task = client.tasks.find_by_id(12)
252
+ task = client.tasks.get_task(12)
251
253
  task.events # => #<Asana::Events ...>
252
254
 
253
255
  # You can do the same with only the task id:
@@ -272,7 +274,7 @@ normal Ruby Enumerable. Read below to get some ideas.
272
274
 
273
275
  ```ruby
274
276
  # Run this in another thread so that we don't block forever
275
- events = client.tasks.find_by_id(12).events(wait: 2)
277
+ events = client.tasks.get_task(12).events(wait: 2)
276
278
  Thread.new do
277
279
  events.each do |event|
278
280
  notify_someone "New event arrived! #{event}"
@@ -286,7 +288,7 @@ To do that we need to call `#lazy` on the `Events` instance, just like with any
286
288
  other `Enumerable`.
287
289
 
288
290
  ```ruby
289
- events = client.tasks.find_by_id(12).events
291
+ events = client.tasks.get_task(12).events
290
292
  only_change_events = events.lazy.select { |event| event.action == 'changed' }
291
293
  Thread.new do
292
294
  only_change_events.each do |event|
@@ -316,7 +318,7 @@ If you would rather suppress these warnings, you can set
316
318
 
317
319
  ## Development
318
320
 
319
- You'll need Ruby 2.5+ and Node v0.10.26+ / NPM 1.4.3+ installed.
321
+ You'll need Ruby 2.7+ and Node v0.10.26+ / NPM 1.4.3+ installed.
320
322
 
321
323
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
322
324
  `bin/console` for an interactive prompt that will allow you to experiment.
@@ -329,7 +331,17 @@ To install this gem onto your local machine, run `bundle exec rake install`.
329
331
 
330
332
  ## Releasing a new version
331
333
 
332
- To release a new version, run either of these commands:
334
+ Prerequisite: Before deployment, make sure you have Ruby version `2.7` installed
335
+
336
+ ### Automatic Deployment
337
+
338
+ First, install dependencies:
339
+
340
+ ```
341
+ bundle install
342
+ ```
343
+
344
+ Then, to release a new version, run one of these commands:
333
345
 
334
346
  rake bump:patch
335
347
  rake bump:minor
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'bundler/gem_tasks'
3
5
  require 'appraisal'
@@ -19,6 +21,7 @@ task :codegen do
19
21
  `node spec/support/codegen.js`
20
22
  end
21
23
 
24
+ # rubocop:disable Metrics/BlockLength
22
25
  namespace :bump do
23
26
  def read_version
24
27
  File.readlines('./lib/asana/version.rb')
@@ -27,23 +30,17 @@ namespace :bump do
27
30
  .map { |n| Integer(n) }
28
31
  end
29
32
 
30
- # rubocop:disable Metrics/MethodLength
31
33
  def write_version(major, minor, patch)
34
+ File.write('VERSION', "#{major}.#{minor}.#{patch}")
32
35
 
33
- File.open('VERSION', 'w') do |f|
34
- f.write "#{major}.#{minor}.#{patch}"
35
- end
36
-
37
- str = <<-EOS
38
- #:nodoc:
39
- module Asana
40
- # Public: Version of the gem.
41
- VERSION = '#{major}.#{minor}.#{patch}'
42
- end
43
- EOS
44
- File.open('./lib/asana/version.rb', 'w') do |f|
45
- f.write str
46
- end
36
+ str = <<~RUBY
37
+ #:nodoc:
38
+ module Asana
39
+ # Public: Version of the gem.
40
+ VERSION = '#{major}.#{minor}.#{patch}'
41
+ end
42
+ RUBY
43
+ File.write('./lib/asana/version.rb', str)
47
44
 
48
45
  new_version = "#{major}.#{minor}.#{patch}"
49
46
  system('bundle lock --update')
@@ -73,10 +70,10 @@ EOS
73
70
  write_version major + 1, 0, 0
74
71
  end
75
72
  end
73
+ # rubocop:enable Metrics/BlockLength
76
74
 
77
75
  desc 'Default: run the unit tests.'
78
- task default: [:all, :rubocop, :yard]
79
-
76
+ task default: %i[all rubocop yard]
80
77
 
81
78
  desc 'Test the plugin under all supported Rails versions.'
82
79
  task :all do |_t|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.2
data/asana.gemspec CHANGED
@@ -1,32 +1,34 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'asana/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "asana"
8
+ spec.name = 'asana'
8
9
  spec.version = Asana::VERSION
9
- spec.authors = ["Txus"]
10
- spec.email = ["me@txus.io"]
10
+ spec.authors = ['Txus']
11
+ spec.email = ['me@txus.io']
11
12
 
12
- spec.summary = %q{Official Ruby client for the Asana API}
13
- spec.description = %q{Official Ruby client for the Asana API}
14
- spec.homepage = "https://github.com/asana/ruby-asana"
15
- spec.license = "MIT"
13
+ spec.summary = 'Official Ruby client for the Asana API'
14
+ spec.description = 'Official Ruby client for the Asana API'
15
+ spec.homepage = 'https://github.com/asana/ruby-asana'
16
+ spec.license = 'MIT'
16
17
 
17
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
+ spec.bindir = 'exe'
19
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
+ spec.require_paths = ['lib']
21
22
 
22
- spec.required_ruby_version = '>= 2.5'
23
+ spec.required_ruby_version = '>= 2.7'
23
24
 
24
- spec.add_dependency "oauth2", ">= 1.4", '< 3'
25
- spec.add_dependency "faraday", "~> 1.0"
26
- spec.add_dependency "faraday_middleware", "~> 1.0"
27
- spec.add_dependency "faraday_middleware-multi_json", "~> 0.0"
25
+ spec.add_dependency 'faraday', '~> 2.0'
26
+ spec.add_dependency 'faraday-follow_redirects'
27
+ spec.add_dependency 'faraday-multipart'
28
+ spec.add_dependency 'oauth2', '>= 1.4', '< 3'
28
29
 
29
- spec.add_development_dependency "rake", "~> 13.0"
30
- spec.add_development_dependency "rspec", "~> 3.2"
31
30
  spec.add_development_dependency 'appraisal', '~> 2.1', '>= 2.1'
31
+ spec.add_development_dependency 'rake', '~> 13.0'
32
+ spec.add_development_dependency 'rspec', '~> 3.2'
33
+ spec.metadata['rubygems_mfa_required'] = 'true'
32
34
  end
data/examples/cli_app.rb CHANGED
@@ -17,9 +17,9 @@ client = Asana::Client.new do |c|
17
17
  end
18
18
 
19
19
  puts "My Workspaces:"
20
- client.workspaces.find_all.each do |workspace|
20
+ client.workspaces.get_workspaces.each do |workspace|
21
21
  puts "\t* #{workspace.name} - tags:"
22
- client.tags.find_by_workspace(workspace: workspace.id).each do |tag|
22
+ client.tags.get_tags_for_workspace(workspace: workspace.id).each do |tag|
23
23
  puts "\t\t- #{tag.name}"
24
24
  end
25
25
  end
data/examples/events.rb CHANGED
@@ -13,10 +13,10 @@ client = Asana::Client.new do |c|
13
13
  c.authentication :access_token, access_token
14
14
  end
15
15
 
16
- workspace = client.workspaces.find_all.first
17
- task = client.tasks.find_all(assignee: "me", workspace: workspace.id).first
16
+ workspace = client.workspaces.get_workspaces.first
17
+ task = client.tasks.get_tasks(assignee: "me", workspace: workspace.id).first
18
18
  unless task
19
- task = client.tasks.create(workspace: workspace.id, name: "Hello world!", assignee: "me")
19
+ task = client.tasks.create_task(workspace: workspace.id, name: "Hello world!", assignee: "me")
20
20
  end
21
21
 
22
22
  Thread.abort_on_exception = true
@@ -13,9 +13,9 @@ client = Asana::Client.new do |c|
13
13
  end
14
14
 
15
15
  puts "My Workspaces:"
16
- client.workspaces.find_all.each do |workspace|
16
+ client.workspaces.get_workspaces.each do |workspace|
17
17
  puts "\t* #{workspace.name} - tags:"
18
- client.tags.find_by_workspace(workspace: workspace.id).each do |tag|
18
+ client.tags.get_tags_for_workspace(workspace: workspace.id).each do |tag|
19
19
  puts "\t\t- #{tag.name}"
20
20
  end
21
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Asana
2
4
  module Authentication
3
5
  module OAuth2
@@ -43,7 +45,8 @@ module Asana
43
45
  # Returns nothing.
44
46
  def configure(connection)
45
47
  @token = @token.refresh! if @token.expired?
46
- connection.request :oauth2, @token.token
48
+
49
+ connection.request :authorization, 'Bearer', @token.token
47
50
  end
48
51
  end
49
52
  end