asana 0.10.13 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) 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 +59 -67
  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 +7 -6
  39. data/lib/asana/resources/gen/audit_log_api_base.rb +1 -1
  40. data/lib/asana/resources/gen/goal_relationships_base.rb +83 -0
  41. data/lib/asana/resources/gen/goals_base.rb +15 -80
  42. data/lib/asana/resources/gen/memberships_base.rb +71 -0
  43. data/lib/asana/resources/gen/portfolios_base.rb +3 -3
  44. data/lib/asana/resources/gen/projects_base.rb +4 -4
  45. data/lib/asana/resources/gen/status_updates_base.rb +1 -1
  46. data/lib/asana/resources/gen/tasks_base.rb +11 -9
  47. data/lib/asana/resources/gen/teams_base.rb +28 -14
  48. data/lib/asana/resources/gen/typeahead_base.rb +1 -1
  49. data/lib/asana/resources/gen/workspaces_base.rb +1 -1
  50. data/lib/asana/resources/goal.rb +54 -0
  51. data/lib/asana/resources/goal_relationship.rb +32 -0
  52. data/lib/asana/resources/membership.rb +20 -0
  53. data/lib/asana/resources/project_brief.rb +30 -0
  54. data/lib/asana/resources/project_template.rb +36 -0
  55. data/lib/asana/resources/status_update.rb +54 -0
  56. data/lib/asana/resources/time_period.rb +30 -0
  57. data/lib/asana/resources/typeahead.rb +1 -1
  58. data/lib/asana/resources.rb +4 -4
  59. data/lib/asana/ruby2_0_0_compatibility.rb +2 -0
  60. data/lib/asana/version.rb +1 -1
  61. data/lib/asana.rb +2 -0
  62. data/samples/attachments_sample.yaml +4 -4
  63. data/samples/goal_relationships_sample.yaml +51 -0
  64. data/samples/goals_sample.yaml +5 -65
  65. data/samples/memberships_sample.yaml +41 -0
  66. data/samples/teams_sample.yaml +14 -4
  67. metadata +59 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55b562fe54f91259bd904bcd2ce861b02b6236eeef272e935407bb3cfc6c7182
4
- data.tar.gz: 79640f7a520ad19b498502e076208f6c7bb2a3ac284ddaef4d975467779c0d5b
3
+ metadata.gz: 4ada25852a2524b32361d8966247b0f5a3a1422969da1bbfd63f30eeb6b00a23
4
+ data.tar.gz: d990cc72c8696eb77eabdf6a7e06d614df05e1fd30dffa25afa77955ab8e8f38
5
5
  SHA512:
6
- metadata.gz: 92d9114d414e5f1fe3f643090638ca938d6b0d6cb711c14845f6a0a2f95ffe987a4509816dcfd832225e22694486562c3ccc8432ec06af198cd6f0d508cadf08
7
- data.tar.gz: 7c9f140a07660d26dee5c6cac953c257068de2269c1c98941a1c5714d1c53eeabf8868212600a1b254fd303aeba15de6bceec226fb563efe5f940a9aa9b7df18
6
+ metadata.gz: 94acd3938c48e0b2e1331c2030357b639a1b09f4e3e1d1990990fa1f7b465ef310b7fd307ba4b26d7ab0054ea1bc2882705650eed851b931cdd6b899564be3dc
7
+ data.tar.gz: e237230684b1df343a4a8bfaedf8ebe009f0118018ef3fc457883864eff95a8ad2ea48146e600f81d2fb894a47f7a027308ea221cca37f944755de92350a48ff
@@ -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.4.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 (0.10.13)
5
- faraday (~> 1.0)
6
- faraday_middleware (~> 1.0)
7
- faraday_middleware-multi_json (~> 0.0)
4
+ asana (2.0.3)
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.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)
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,78 +50,88 @@ GEM
70
50
  guard (>= 1.1.0)
71
51
  yard (>= 0.7.0)
72
52
  hashie (5.0.0)
73
- jwt (2.4.1)
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.0)
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)
91
- rash_alt (>= 0.4, < 1)
92
- version_gem (~> 1.0)
70
+ rack (>= 1.2, < 4)
71
+ snaky_hash (~> 2.0)
72
+ version_gem (~> 1.1)
93
73
  parallel (1.22.1)
94
- parser (2.7.2.0)
74
+ parser (3.2.2.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.3.1)
79
+ rack (3.0.7)
101
80
  rack-protection (1.5.5)
102
81
  rack
103
82
  rainbow (3.1.1)
104
83
  rake (13.0.6)
105
- rash_alt (0.4.12)
106
- hashie (>= 3.4)
107
- rb-fsevent (0.11.1)
84
+ rb-fsevent (0.11.2)
108
85
  rb-inotify (0.10.1)
109
86
  ffi (~> 1.0)
110
- rspec (3.11.0)
111
- rspec-core (~> 3.11.0)
112
- rspec-expectations (~> 3.11.0)
113
- rspec-mocks (~> 3.11.0)
114
- rspec-core (3.11.0)
115
- rspec-support (~> 3.11.0)
116
- 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)
117
96
  diff-lcs (>= 1.2.0, < 2.0)
118
- rspec-support (~> 3.11.0)
119
- rspec-mocks (3.11.1)
97
+ rspec-support (~> 3.12.0)
98
+ rspec-mocks (3.12.5)
120
99
  diff-lcs (>= 1.2.0, < 2.0)
121
- rspec-support (~> 3.11.0)
122
- rspec-support (3.11.0)
123
- 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)
124
104
  parallel (~> 1.10)
125
- parser (>= 2.4.0.2, < 3.0)
126
- powerpack (~> 0.1)
105
+ parser (>= 3.2.0.0)
127
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)
128
110
  ruby-progressbar (~> 1.7)
129
- unicode-display_width (~> 1.0, >= 1.0.1)
130
- rubocop-rspec (1.22.2)
131
- rubocop (>= 0.52.1)
132
- ruby-progressbar (1.11.0)
111
+ unicode-display_width (>= 2.4.0, < 3.0)
112
+ rubocop-ast (1.28.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)
133
120
  ruby2_keywords (0.0.5)
134
121
  shellany (0.0.1)
135
- simplecov (0.21.2)
122
+ simplecov (0.22.0)
136
123
  docile (~> 1.1)
137
124
  simplecov-html (~> 0.11)
138
125
  simplecov_json_formatter (~> 0.1)
139
126
  simplecov-html (0.12.3)
140
127
  simplecov_json_formatter (0.1.4)
128
+ snaky_hash (2.0.1)
129
+ hashie
130
+ version_gem (~> 1.1, >= 1.1.1)
141
131
  thor (1.2.1)
142
132
  tomparse (0.4.2)
143
- unicode-display_width (1.8.0)
144
- version_gem (1.0.0)
133
+ unicode-display_width (2.4.2)
134
+ version_gem (1.1.2)
145
135
  webrick (1.7.0)
146
136
  yard (0.9.28)
147
137
  webrick (~> 1.7.0)
@@ -150,6 +140,7 @@ GEM
150
140
  yard
151
141
 
152
142
  PLATFORMS
143
+ ruby
153
144
  universal-darwin-21
154
145
  x86_64-linux
155
146
 
@@ -161,11 +152,12 @@ DEPENDENCIES
161
152
  guard-rspec
162
153
  guard-rubocop
163
154
  guard-yard
155
+ oauth2 (~> 2.0.3)
164
156
  rack-protection (= 1.5.5)
165
157
  rake (~> 13.0)
166
158
  rspec (~> 3.2)
167
- rubocop (~> 0.52.1)
168
- rubocop-rspec (~> 1.22.2)
159
+ rubocop (~> 1.47.0)
160
+ rubocop-rspec (~> 2.18.1)
169
161
  simplecov
170
162
  yard
171
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
- 0.10.13
1
+ 2.0.3
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