asana 0.10.2 → 0.10.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +24 -0
- data/.github/workflows/pubilsh-to-rubygem.yml +18 -0
- data/.github/workflows/publish-to-github-releases.yml +16 -0
- data/.gitignore +0 -1
- data/.swagger-codegen-ignore +0 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +174 -0
- data/README.md +22 -9
- data/Rakefile +10 -14
- data/VERSION +1 -0
- data/asana.gemspec +3 -3
- data/examples/Gemfile.lock +10 -10
- data/lib/asana/http_client/error_handling.rb +11 -4
- data/lib/asana/resource_includes/attachment_uploading.rb +14 -7
- data/lib/asana/resources/gen/audit_log_api_base.rb +37 -0
- data/lib/asana/resources/gen/goals_base.rb +218 -0
- data/lib/asana/resources/gen/project_briefs_base.rb +68 -0
- data/lib/asana/resources/gen/project_templates_base.rb +73 -0
- data/lib/asana/resources/gen/projects_base.rb +14 -1
- data/lib/asana/resources/gen/status_updates_base.rb +72 -0
- data/lib/asana/resources/gen/tags_base.rb +14 -0
- data/lib/asana/resources/gen/tasks_base.rb +3 -6
- data/lib/asana/resources/gen/teams_base.rb +15 -1
- data/lib/asana/resources/gen/time_periods_base.rb +47 -0
- data/lib/asana/resources/gen/typeahead_base.rb +1 -1
- data/lib/asana/resources/gen/users_base.rb +4 -5
- data/lib/asana/resources/gen/webhooks_base.rb +13 -0
- data/lib/asana/resources/portfolio.rb +3 -3
- data/lib/asana/version.rb +1 -1
- data/package-lock.json +115 -0
- data/samples/attachments_sample.yaml +41 -0
- data/samples/audit_log_api_sample.yaml +11 -0
- data/samples/batch_api_sample.yaml +11 -0
- data/samples/custom_field_settings_sample.yaml +21 -0
- data/samples/custom_fields_sample.yaml +81 -0
- data/samples/events_sample.yaml +11 -0
- data/samples/goals_sample.yaml +161 -0
- data/samples/jobs_sample.yaml +11 -0
- data/samples/organization_exports_sample.yaml +21 -0
- data/samples/portfolio_memberships_sample.yaml +31 -0
- data/samples/portfolios_sample.yaml +121 -0
- data/samples/project_briefs_sample.yaml +41 -0
- data/samples/project_memberships_sample.yaml +21 -0
- data/samples/project_statuses_sample.yaml +41 -0
- data/samples/project_templates_sample.yaml +41 -0
- data/samples/projects_sample.yaml +191 -0
- data/samples/sections_sample.yaml +71 -0
- data/samples/status_updates_sample.yaml +41 -0
- data/samples/stories_sample.yaml +51 -0
- data/samples/tags_sample.yaml +81 -0
- data/samples/tasks_sample.yaml +261 -0
- data/samples/team_memberships_sample.yaml +41 -0
- data/samples/teams_sample.yaml +61 -0
- data/samples/time_periods_sample.yaml +21 -0
- data/samples/typeahead_sample.yaml +11 -0
- data/samples/user_task_lists_sample.yaml +21 -0
- data/samples/users_sample.yaml +51 -0
- data/samples/webhooks_sample.yaml +51 -0
- data/samples/workspace_memberships_sample.yaml +31 -0
- data/samples/workspaces_sample.yaml +51 -0
- data/swagger_templates/api_doc.mustache +12 -0
- data/swagger_templates/ruby-config.json +1 -2
- metadata +58 -11
- data/.travis.yml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55b562fe54f91259bd904bcd2ce861b02b6236eeef272e935407bb3cfc6c7182
|
4
|
+
data.tar.gz: 79640f7a520ad19b498502e076208f6c7bb2a3ac284ddaef4d975467779c0d5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92d9114d414e5f1fe3f643090638ca938d6b0d6cb711c14845f6a0a2f95ffe987a4509816dcfd832225e22694486562c3ccc8432ec06af198cd6f0d508cadf08
|
7
|
+
data.tar.gz: 7c9f140a07660d26dee5c6cac953c257068de2269c1c98941a1c5714d1c53eeabf8868212600a1b254fd303aeba15de6bceec226fb563efe5f940a9aa9b7df18
|
@@ -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
data/.swagger-codegen-ignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
asana (0.10.13)
|
5
|
+
faraday (~> 1.0)
|
6
|
+
faraday_middleware (~> 1.0)
|
7
|
+
faraday_middleware-multi_json (~> 0.0)
|
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 (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
|
+
hashie (5.0.0)
|
73
|
+
jwt (2.4.1)
|
74
|
+
listen (3.7.1)
|
75
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
76
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
77
|
+
lumberjack (1.2.8)
|
78
|
+
method_source (1.0.0)
|
79
|
+
multi_json (1.15.0)
|
80
|
+
multi_xml (0.6.0)
|
81
|
+
multipart-post (2.2.3)
|
82
|
+
nenv (0.3.0)
|
83
|
+
notiffany (0.1.3)
|
84
|
+
nenv (~> 0.1)
|
85
|
+
shellany (~> 0.0)
|
86
|
+
oauth2 (2.0.0)
|
87
|
+
faraday (>= 0.17.3, < 3.0)
|
88
|
+
jwt (>= 1.0, < 3.0)
|
89
|
+
multi_xml (~> 0.5)
|
90
|
+
rack (>= 1.2, < 3)
|
91
|
+
rash_alt (>= 0.4, < 1)
|
92
|
+
version_gem (~> 1.0)
|
93
|
+
parallel (1.22.1)
|
94
|
+
parser (2.7.2.0)
|
95
|
+
ast (~> 2.4.1)
|
96
|
+
powerpack (0.1.3)
|
97
|
+
pry (0.14.1)
|
98
|
+
coderay (~> 1.1)
|
99
|
+
method_source (~> 1.0)
|
100
|
+
rack (2.2.3.1)
|
101
|
+
rack-protection (1.5.5)
|
102
|
+
rack
|
103
|
+
rainbow (3.1.1)
|
104
|
+
rake (13.0.6)
|
105
|
+
rash_alt (0.4.12)
|
106
|
+
hashie (>= 3.4)
|
107
|
+
rb-fsevent (0.11.1)
|
108
|
+
rb-inotify (0.10.1)
|
109
|
+
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)
|
117
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
118
|
+
rspec-support (~> 3.11.0)
|
119
|
+
rspec-mocks (3.11.1)
|
120
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
121
|
+
rspec-support (~> 3.11.0)
|
122
|
+
rspec-support (3.11.0)
|
123
|
+
rubocop (0.52.1)
|
124
|
+
parallel (~> 1.10)
|
125
|
+
parser (>= 2.4.0.2, < 3.0)
|
126
|
+
powerpack (~> 0.1)
|
127
|
+
rainbow (>= 2.2.2, < 4.0)
|
128
|
+
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)
|
133
|
+
ruby2_keywords (0.0.5)
|
134
|
+
shellany (0.0.1)
|
135
|
+
simplecov (0.21.2)
|
136
|
+
docile (~> 1.1)
|
137
|
+
simplecov-html (~> 0.11)
|
138
|
+
simplecov_json_formatter (~> 0.1)
|
139
|
+
simplecov-html (0.12.3)
|
140
|
+
simplecov_json_formatter (0.1.4)
|
141
|
+
thor (1.2.1)
|
142
|
+
tomparse (0.4.2)
|
143
|
+
unicode-display_width (1.8.0)
|
144
|
+
version_gem (1.0.0)
|
145
|
+
webrick (1.7.0)
|
146
|
+
yard (0.9.28)
|
147
|
+
webrick (~> 1.7.0)
|
148
|
+
yard-tomdoc (0.7.1)
|
149
|
+
tomparse (>= 0.4.0)
|
150
|
+
yard
|
151
|
+
|
152
|
+
PLATFORMS
|
153
|
+
universal-darwin-21
|
154
|
+
x86_64-linux
|
155
|
+
|
156
|
+
DEPENDENCIES
|
157
|
+
appraisal (~> 2.1, >= 2.1)
|
158
|
+
asana!
|
159
|
+
byebug
|
160
|
+
guard
|
161
|
+
guard-rspec
|
162
|
+
guard-rubocop
|
163
|
+
guard-yard
|
164
|
+
rack-protection (= 1.5.5)
|
165
|
+
rake (~> 13.0)
|
166
|
+
rspec (~> 3.2)
|
167
|
+
rubocop (~> 0.52.1)
|
168
|
+
rubocop-rspec (~> 1.22.2)
|
169
|
+
simplecov
|
170
|
+
yard
|
171
|
+
yard-tomdoc
|
172
|
+
|
173
|
+
BUNDLED WITH
|
174
|
+
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://
|
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
|
-
|
218
|
-
|
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.
|
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
|
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
|
-
|
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
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.10.13
|
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 = '
|
22
|
+
spec.required_ruby_version = '>= 2.5'
|
23
23
|
|
24
|
-
spec.add_dependency "oauth2", "
|
24
|
+
spec.add_dependency "oauth2", ">= 1.4", '< 3'
|
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", "~>
|
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
|
data/examples/Gemfile.lock
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
asana (0.
|
5
|
-
faraday (~> 0
|
6
|
-
faraday_middleware (~> 0
|
4
|
+
asana (0.10.5)
|
5
|
+
faraday (~> 1.0)
|
6
|
+
faraday_middleware (~> 1.0)
|
7
7
|
faraday_middleware-multi_json (~> 0.0)
|
8
8
|
oauth2 (~> 1.4)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
faraday (0.
|
13
|
+
faraday (1.0.1)
|
14
14
|
multipart-post (>= 1.2, < 3)
|
15
|
-
faraday_middleware (0.
|
16
|
-
faraday (
|
15
|
+
faraday_middleware (1.0.0)
|
16
|
+
faraday (~> 1.0)
|
17
17
|
faraday_middleware-multi_json (0.0.6)
|
18
18
|
faraday_middleware
|
19
19
|
multi_json
|
20
20
|
jwt (2.2.1)
|
21
|
-
multi_json (1.
|
21
|
+
multi_json (1.15.0)
|
22
22
|
multi_xml (0.6.0)
|
23
23
|
multipart-post (2.1.1)
|
24
|
-
oauth2 (1.4.
|
25
|
-
faraday (>= 0.8, <
|
24
|
+
oauth2 (1.4.4)
|
25
|
+
faraday (>= 0.8, < 2.0)
|
26
26
|
jwt (>= 1.0, < 3.0)
|
27
27
|
multi_json (~> 1.3)
|
28
28
|
multi_xml (~> 0.5)
|
29
29
|
rack (>= 1.2, < 3)
|
30
|
-
rack (2.
|
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
|
-
|
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(
|
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
|
48
|
-
handle(
|
54
|
+
if num_retries < MAX_RETRIES
|
55
|
+
handle(num_retries + 1, &request)
|
49
56
|
else
|
50
57
|
raise e
|
51
58
|
end
|
@@ -5,8 +5,9 @@ module Asana
|
|
5
5
|
module AttachmentUploading
|
6
6
|
# Uploads a new attachment to the resource.
|
7
7
|
#
|
8
|
-
# filename - [String] the absolute path of the file to upload
|
8
|
+
# filename - [String] the absolute path of the file to upload OR the desired filename when using +io+
|
9
9
|
# mime - [String] the MIME type of the file
|
10
|
+
# io - [IO] an object which returns the file's content on +#read+, e.g. a +::StringIO+
|
10
11
|
# options - [Hash] the request I/O options
|
11
12
|
# data - [Hash] extra attributes to post
|
12
13
|
#
|
@@ -14,16 +15,22 @@ module Asana
|
|
14
15
|
# rubocop:disable Metrics/MethodLength
|
15
16
|
def attach(filename: required('filename'),
|
16
17
|
mime: required('mime'),
|
17
|
-
options: {}, **data)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
io: nil, options: {}, **data)
|
19
|
+
|
20
|
+
upload = if io.nil?
|
21
|
+
path = File.expand_path(filename)
|
22
|
+
raise ArgumentError, "file #{filename} doesn't exist" unless File.exist?(path)
|
23
|
+
|
24
|
+
Faraday::FilePart.new(path, mime)
|
25
|
+
else
|
26
|
+
Faraday::FilePart.new(io, mime, filename)
|
27
|
+
end
|
28
|
+
|
23
29
|
response = client.post("/#{self.class.plural_name}/#{gid}/attachments",
|
24
30
|
body: data,
|
25
31
|
upload: upload,
|
26
32
|
options: options)
|
33
|
+
|
27
34
|
Attachment.new(parse(response).first, client: client)
|
28
35
|
end
|
29
36
|
# rubocop:enable Metrics/MethodLength
|
@@ -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
|