asana 0.10.3 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) 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/.rubocop.yml +38 -3
  7. data/.ruby-version +1 -1
  8. data/Appraisals +8 -3
  9. data/Gemfile +7 -3
  10. data/Gemfile.lock +166 -0
  11. data/Guardfile +12 -10
  12. data/README.md +45 -20
  13. data/Rakefile +20 -27
  14. data/VERSION +1 -1
  15. data/asana.gemspec +20 -18
  16. data/examples/Gemfile.lock +2 -2
  17. data/examples/cli_app.rb +2 -2
  18. data/examples/events.rb +3 -3
  19. data/examples/personal_access_token.rb +2 -2
  20. data/lib/asana/authentication/oauth2/access_token_authentication.rb +4 -1
  21. data/lib/asana/authentication/oauth2/bearer_token_authentication.rb +3 -2
  22. data/lib/asana/authentication/oauth2/client.rb +2 -0
  23. data/lib/asana/authentication/oauth2.rb +6 -4
  24. data/lib/asana/authentication/token_authentication.rb +3 -1
  25. data/lib/asana/authentication.rb +2 -0
  26. data/lib/asana/client/configuration.rb +6 -5
  27. data/lib/asana/client.rb +13 -11
  28. data/lib/asana/errors.rb +16 -11
  29. data/lib/asana/http_client/environment_info.rb +9 -8
  30. data/lib/asana/http_client/error_handling.rb +26 -20
  31. data/lib/asana/http_client/response.rb +2 -0
  32. data/lib/asana/http_client.rb +66 -65
  33. data/lib/asana/resource_includes/attachment_uploading.rb +6 -6
  34. data/lib/asana/resource_includes/collection.rb +4 -4
  35. data/lib/asana/resource_includes/event.rb +2 -0
  36. data/lib/asana/resource_includes/event_subscription.rb +2 -0
  37. data/lib/asana/resource_includes/events.rb +4 -1
  38. data/lib/asana/resource_includes/registry.rb +2 -0
  39. data/lib/asana/resource_includes/resource.rb +8 -5
  40. data/lib/asana/resource_includes/response_helper.rb +2 -0
  41. data/lib/asana/resources/audit_log_api.rb +42 -0
  42. data/lib/asana/resources/gen/attachments_base.rb +7 -6
  43. data/lib/asana/resources/gen/audit_log_api_base.rb +37 -0
  44. data/lib/asana/resources/gen/goal_relationships_base.rb +83 -0
  45. data/lib/asana/resources/gen/goals_base.rb +153 -0
  46. data/lib/asana/resources/gen/memberships_base.rb +71 -0
  47. data/lib/asana/resources/gen/portfolios_base.rb +3 -3
  48. data/lib/asana/resources/gen/project_briefs_base.rb +68 -0
  49. data/lib/asana/resources/gen/project_templates_base.rb +73 -0
  50. data/lib/asana/resources/gen/projects_base.rb +17 -4
  51. data/lib/asana/resources/gen/status_updates_base.rb +72 -0
  52. data/lib/asana/resources/gen/tasks_base.rb +13 -15
  53. data/lib/asana/resources/gen/teams_base.rb +41 -13
  54. data/lib/asana/resources/gen/time_periods_base.rb +47 -0
  55. data/lib/asana/resources/gen/typeahead_base.rb +2 -2
  56. data/lib/asana/resources/gen/users_base.rb +3 -4
  57. data/lib/asana/resources/gen/webhooks_base.rb +13 -0
  58. data/lib/asana/resources/gen/workspaces_base.rb +1 -1
  59. data/lib/asana/resources/goal.rb +54 -0
  60. data/lib/asana/resources/goal_relationship.rb +32 -0
  61. data/lib/asana/resources/membership.rb +20 -0
  62. data/lib/asana/resources/portfolio.rb +3 -3
  63. data/lib/asana/resources/project_brief.rb +30 -0
  64. data/lib/asana/resources/project_template.rb +36 -0
  65. data/lib/asana/resources/status_update.rb +54 -0
  66. data/lib/asana/resources/time_period.rb +30 -0
  67. data/lib/asana/resources/typeahead.rb +1 -1
  68. data/lib/asana/resources.rb +4 -4
  69. data/lib/asana/ruby2_0_0_compatibility.rb +2 -0
  70. data/lib/asana/version.rb +1 -1
  71. data/lib/asana.rb +2 -0
  72. data/package-lock.json +115 -0
  73. data/samples/attachments_sample.yaml +4 -4
  74. data/samples/audit_log_api_sample.yaml +11 -0
  75. data/samples/goal_relationships_sample.yaml +51 -0
  76. data/samples/goals_sample.yaml +101 -0
  77. data/samples/memberships_sample.yaml +41 -0
  78. data/samples/project_briefs_sample.yaml +41 -0
  79. data/samples/project_templates_sample.yaml +41 -0
  80. data/samples/projects_sample.yaml +10 -0
  81. data/samples/status_updates_sample.yaml +41 -0
  82. data/samples/teams_sample.yaml +24 -4
  83. data/samples/time_periods_sample.yaml +21 -0
  84. data/samples/webhooks_sample.yaml +10 -0
  85. metadata +75 -40
  86. 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: 4ada25852a2524b32361d8966247b0f5a3a1422969da1bbfd63f30eeb6b00a23
4
+ data.tar.gz: d990cc72c8696eb77eabdf6a7e06d614df05e1fd30dffa25afa77955ab8e8f38
5
5
  SHA512:
6
- metadata.gz: b04794c205e810df61ae3e97b66c5b17671f5a0ab0843ba2a53d72aa3ed6904c2cc75a9142a517c86831de681c4f77278b1189cfd3f997c09bbd53802dce7e73
7
- data.tar.gz: fabf06e3ccd2ea24f09daf62597db360b56b4d666e89d214f793fcaa9159a29a16f0f68cfdbd67fab587b0e0ecc9a1ef6cec8bc86b37617ac56473f6fa51e4b9
6
+ metadata.gz: 94acd3938c48e0b2e1331c2030357b639a1b09f4e3e1d1990990fa1f7b465ef310b7fd307ba4b26d7ab0054ea1bc2882705650eed851b931cdd6b899564be3dc
7
+ data.tar.gz: e237230684b1df343a4a8bfaedf8ebe009f0118018ef3fc457883864eff95a8ad2ea48146e600f81d2fb894a47f7a027308ea221cca37f944755de92350a48ff
@@ -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.7, 3.0, 3.1]
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/.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 ADDED
@@ -0,0 +1,166 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ asana (2.0.3)
5
+ faraday (~> 2.0)
6
+ faraday-follow_redirects
7
+ faraday-multipart
8
+ oauth2 (>= 1.4, < 3)
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 (2.7.4)
23
+ faraday-net_http (>= 2.0, < 3.1)
24
+ ruby2_keywords (>= 0.0.4)
25
+ faraday-follow_redirects (0.3.0)
26
+ faraday (>= 1, < 3)
27
+ faraday-multipart (1.0.4)
28
+ multipart-post (~> 2)
29
+ faraday-net_http (3.0.2)
30
+ ffi (1.15.5)
31
+ formatador (1.1.0)
32
+ guard (2.18.0)
33
+ formatador (>= 0.2.4)
34
+ listen (>= 2.7, < 4.0)
35
+ lumberjack (>= 1.0.12, < 2.0)
36
+ nenv (~> 0.1)
37
+ notiffany (~> 0.0)
38
+ pry (>= 0.13.0)
39
+ shellany (~> 0.0)
40
+ thor (>= 0.18.1)
41
+ guard-compat (1.2.1)
42
+ guard-rspec (4.7.3)
43
+ guard (~> 2.1)
44
+ guard-compat (~> 1.1)
45
+ rspec (>= 2.99.0, < 4.0)
46
+ guard-rubocop (1.5.0)
47
+ guard (~> 2.0)
48
+ rubocop (< 2.0)
49
+ guard-yard (2.2.1)
50
+ guard (>= 1.1.0)
51
+ yard (>= 0.7.0)
52
+ hashie (5.0.0)
53
+ json (2.6.3)
54
+ jwt (2.7.0)
55
+ listen (3.8.0)
56
+ rb-fsevent (~> 0.10, >= 0.10.3)
57
+ rb-inotify (~> 0.9, >= 0.9.10)
58
+ lumberjack (1.2.8)
59
+ method_source (1.0.0)
60
+ multi_xml (0.6.0)
61
+ multipart-post (2.3.0)
62
+ nenv (0.3.0)
63
+ notiffany (0.1.3)
64
+ nenv (~> 0.1)
65
+ shellany (~> 0.0)
66
+ oauth2 (2.0.9)
67
+ faraday (>= 0.17.3, < 3.0)
68
+ jwt (>= 1.0, < 3.0)
69
+ multi_xml (~> 0.5)
70
+ rack (>= 1.2, < 4)
71
+ snaky_hash (~> 2.0)
72
+ version_gem (~> 1.1)
73
+ parallel (1.22.1)
74
+ parser (3.2.2.0)
75
+ ast (~> 2.4.1)
76
+ pry (0.14.2)
77
+ coderay (~> 1.1)
78
+ method_source (~> 1.0)
79
+ rack (3.0.7)
80
+ rack-protection (1.5.5)
81
+ rack
82
+ rainbow (3.1.1)
83
+ rake (13.0.6)
84
+ rb-fsevent (0.11.2)
85
+ rb-inotify (0.10.1)
86
+ ffi (~> 1.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)
96
+ diff-lcs (>= 1.2.0, < 2.0)
97
+ rspec-support (~> 3.12.0)
98
+ rspec-mocks (3.12.5)
99
+ diff-lcs (>= 1.2.0, < 2.0)
100
+ rspec-support (~> 3.12.0)
101
+ rspec-support (3.12.0)
102
+ rubocop (1.47.0)
103
+ json (~> 2.3)
104
+ parallel (~> 1.10)
105
+ parser (>= 3.2.0.0)
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)
110
+ ruby-progressbar (~> 1.7)
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)
120
+ ruby2_keywords (0.0.5)
121
+ shellany (0.0.1)
122
+ simplecov (0.22.0)
123
+ docile (~> 1.1)
124
+ simplecov-html (~> 0.11)
125
+ simplecov_json_formatter (~> 0.1)
126
+ simplecov-html (0.12.3)
127
+ simplecov_json_formatter (0.1.4)
128
+ snaky_hash (2.0.1)
129
+ hashie
130
+ version_gem (~> 1.1, >= 1.1.1)
131
+ thor (1.2.1)
132
+ tomparse (0.4.2)
133
+ unicode-display_width (2.4.2)
134
+ version_gem (1.1.2)
135
+ webrick (1.7.0)
136
+ yard (0.9.28)
137
+ webrick (~> 1.7.0)
138
+ yard-tomdoc (0.7.1)
139
+ tomparse (>= 0.4.0)
140
+ yard
141
+
142
+ PLATFORMS
143
+ ruby
144
+ universal-darwin-21
145
+ x86_64-linux
146
+
147
+ DEPENDENCIES
148
+ appraisal (~> 2.1, >= 2.1)
149
+ asana!
150
+ byebug
151
+ guard
152
+ guard-rspec
153
+ guard-rubocop
154
+ guard-yard
155
+ oauth2 (~> 2.0.3)
156
+ rack-protection (= 1.5.5)
157
+ rake (~> 13.0)
158
+ rspec (~> 3.2)
159
+ rubocop (~> 1.47.0)
160
+ rubocop-rspec (~> 2.18.1)
161
+ simplecov
162
+ yard
163
+ yard-tomdoc
164
+
165
+ BUNDLED WITH
166
+ 2.3.13
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
@@ -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
 
@@ -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')
@@ -132,7 +134,7 @@ get '/auth/:name/callback' do
132
134
  $client = Asana::Client.new do |c|
133
135
  c.authentication :oauth2, access_token
134
136
  end
135
-
137
+
136
138
  redirect '/'
137
139
  end
138
140
  ```
@@ -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
 
@@ -214,8 +216,10 @@ In any request against the Asana API, there a number of errors that could
214
216
  arise. Those are well documented in the [Asana API Documentation][apidocs], and
215
217
  are represented as exceptions under the namespace `Asana::Errors`.
216
218
 
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.
219
+ The Asana client automatically handles and retries requests upon receipt of
220
+ 500 (Internal Server Error) responses from the Asana API. If you want to handle
221
+ any 4xx errors, you will have to do that yourself; you can do this by rescuing
222
+ `Asana::Errors::APIError`, the parent class of all Asana API errors.
219
223
 
220
224
  ### I/O options
221
225
 
@@ -224,7 +228,7 @@ All requests (except `DELETE`) accept extra I/O options
224
228
  request:
225
229
 
226
230
  ```ruby
227
- client.tasks.find_by_id(12, options: { expand: ['workspace'] })
231
+ client.tasks.get_task(12, options: { expand: ['workspace'] })
228
232
  ```
229
233
 
230
234
  ### Attachment uploading
@@ -233,7 +237,7 @@ To attach a file to a task or a project, you just need its absolute path on your
233
237
  filesystem and its MIME type, and the file will be uploaded for you:
234
238
 
235
239
  ```ruby
236
- task = client.tasks.find_by_id(12)
240
+ task = client.tasks.get_task(12)
237
241
  attachment = task.attach(filename: '/absolute/path/to/my/file.png',
238
242
  mime: 'image/png')
239
243
  attachment.name # => 'file.png'
@@ -245,7 +249,7 @@ To subscribe to an event stream of a task or a project, just call `#events` on
245
249
  it:
246
250
 
247
251
  ```ruby
248
- task = client.tasks.find_by_id(12)
252
+ task = client.tasks.get_task(12)
249
253
  task.events # => #<Asana::Events ...>
250
254
 
251
255
  # You can do the same with only the task id:
@@ -270,7 +274,7 @@ normal Ruby Enumerable. Read below to get some ideas.
270
274
 
271
275
  ```ruby
272
276
  # Run this in another thread so that we don't block forever
273
- events = client.tasks.find_by_id(12).events(wait: 2)
277
+ events = client.tasks.get_task(12).events(wait: 2)
274
278
  Thread.new do
275
279
  events.each do |event|
276
280
  notify_someone "New event arrived! #{event}"
@@ -284,7 +288,7 @@ To do that we need to call `#lazy` on the `Events` instance, just like with any
284
288
  other `Enumerable`.
285
289
 
286
290
  ```ruby
287
- events = client.tasks.find_by_id(12).events
291
+ events = client.tasks.get_task(12).events
288
292
  only_change_events = events.lazy.select { |event| event.action == 'changed' }
289
293
  Thread.new do
290
294
  only_change_events.each do |event|
@@ -305,7 +309,7 @@ If you receive one of these warnings, you should:
305
309
  You can add global headers, by setting default_headers
306
310
 
307
311
  c.default_headers "asana-enable" => "string_ids"
308
-
312
+
309
313
  Or you can add a header field to the options of each request.
310
314
 
311
315
  If you would rather suppress these warnings, you can set
@@ -314,7 +318,7 @@ If you would rather suppress these warnings, you can set
314
318
 
315
319
  ## Development
316
320
 
317
- You'll need Ruby 2.1+ 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.
318
322
 
319
323
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
320
324
  `bin/console` for an interactive prompt that will allow you to experiment.
@@ -327,17 +331,38 @@ To install this gem onto your local machine, run `bundle exec rake install`.
327
331
 
328
332
  ## Releasing a new version
329
333
 
330
- 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:
331
345
 
332
346
  rake bump:patch
333
347
  rake bump:minor
334
348
  rake bump:major
335
349
 
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
350
+ This will: update `lib/asana/version.rb` and `VERSION`, commit and tag the commit. Then you
351
+ just need to `push --tags` to let GitHub Actions build and release the new version to
338
352
  Rubygems:
339
353
 
340
- git push --tags
354
+ git push --tags origin master:master
355
+
356
+ ### Manual Deployment
357
+
358
+ 1. Merge in the desired changes into the `master` branch and commit them.
359
+ 2. Clone the repo, work on master.
360
+ 3. Edit package version in `lib/asana/version.rb` and `VERSION` to indicate the [semantic version](http://semver.org/) change.
361
+ 4. Commit the change
362
+ 5. Tag the commit with `v` plus the same version number you set in the file.
363
+ `git tag v1.2.3`
364
+ 6. Push changes to origin, including tags:
365
+ `git push --tags origin master:master`
341
366
 
342
367
  ### Code generation
343
368
 
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,24 +30,26 @@ 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)
32
- str = <<-EOS
33
- #:nodoc:
34
- module Asana
35
- # Public: Version of the gem.
36
- VERSION = '#{major}.#{minor}.#{patch}'
37
- end
38
- EOS
39
- File.open('./lib/asana/version.rb', 'w') do |f|
40
- f.write str
41
- end
34
+ File.write('VERSION', "#{major}.#{minor}.#{patch}")
35
+
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)
42
44
 
43
45
  new_version = "#{major}.#{minor}.#{patch}"
46
+ system('bundle lock --update')
47
+ system('git add Gemfile.lock')
48
+ system('git add VERSION')
44
49
  system('git add lib/asana/version.rb')
45
50
  system(%(git commit -m "Bumped to #{new_version}" && ) +
46
51
  %(git tag -a v#{new_version} -m "Version #{new_version}"))
47
- puts "\nRun git push --tags to release."
52
+ puts "\nRun git push --tags origin master:master to release."
48
53
  end
49
54
 
50
55
  desc 'Bumps a patch version'
@@ -65,24 +70,12 @@ EOS
65
70
  write_version major + 1, 0, 0
66
71
  end
67
72
  end
73
+ # rubocop:enable Metrics/BlockLength
68
74
 
69
75
  desc 'Default: run the unit tests.'
70
- task default: [:all, :rubocop, :yard]
71
-
76
+ task default: %i[all rubocop yard]
72
77
 
73
78
  desc 'Test the plugin under all supported Rails versions.'
74
79
  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
80
+ exec('bundle exec appraisal install && bundle exec rake appraisal spec')
88
81
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.3
1
+ 2.0.3