asana 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +38 -3
- data/Appraisals +7 -6
- data/Gemfile +5 -3
- data/Gemfile.lock +22 -12
- data/Guardfile +12 -10
- data/README.md +3 -1
- data/Rakefile +14 -17
- data/VERSION +1 -1
- data/asana.gemspec +19 -17
- data/lib/asana/authentication/oauth2/access_token_authentication.rb +2 -0
- data/lib/asana/authentication/oauth2/bearer_token_authentication.rb +2 -0
- data/lib/asana/authentication/oauth2/client.rb +2 -0
- data/lib/asana/authentication/oauth2.rb +6 -4
- data/lib/asana/authentication/token_authentication.rb +2 -0
- data/lib/asana/authentication.rb +2 -0
- data/lib/asana/client/configuration.rb +6 -5
- data/lib/asana/client.rb +13 -11
- data/lib/asana/errors.rb +16 -11
- data/lib/asana/http_client/environment_info.rb +9 -8
- data/lib/asana/http_client/error_handling.rb +24 -23
- data/lib/asana/http_client/response.rb +2 -0
- data/lib/asana/http_client.rb +58 -60
- data/lib/asana/resource_includes/attachment_uploading.rb +2 -4
- data/lib/asana/resource_includes/collection.rb +4 -4
- data/lib/asana/resource_includes/event.rb +2 -0
- data/lib/asana/resource_includes/event_subscription.rb +2 -0
- data/lib/asana/resource_includes/events.rb +4 -1
- data/lib/asana/resource_includes/registry.rb +2 -0
- data/lib/asana/resource_includes/resource.rb +8 -5
- data/lib/asana/resource_includes/response_helper.rb +2 -0
- data/lib/asana/resources/audit_log_api.rb +42 -0
- data/lib/asana/resources/gen/attachments_base.rb +1 -1
- data/lib/asana/resources/gen/audit_log_api_base.rb +1 -1
- data/lib/asana/resources/gen/memberships_base.rb +71 -0
- data/lib/asana/resources/gen/tasks_base.rb +1 -1
- data/lib/asana/resources/goal.rb +54 -0
- data/lib/asana/resources/goal_relationship.rb +32 -0
- data/lib/asana/resources/membership.rb +20 -0
- data/lib/asana/resources/project_brief.rb +30 -0
- data/lib/asana/resources/project_template.rb +36 -0
- data/lib/asana/resources/status_update.rb +54 -0
- data/lib/asana/resources/time_period.rb +30 -0
- data/lib/asana/resources/typeahead.rb +1 -1
- data/lib/asana/resources.rb +4 -4
- data/lib/asana/ruby2_0_0_compatibility.rb +2 -0
- data/lib/asana/version.rb +1 -1
- data/lib/asana.rb +2 -0
- data/samples/memberships_sample.yaml +41 -0
- metadata +49 -38
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../errors'
|
2
4
|
|
3
5
|
module Asana
|
@@ -25,37 +27,34 @@ module Asana
|
|
25
27
|
# Raises [Asana::Errors::ServerError] when there's a server problem.
|
26
28
|
# Raises [Asana::Errors::APIError] when the API returns an unknown error.
|
27
29
|
#
|
28
|
-
# rubocop:disable
|
29
|
-
def handle(num_retries=0, &request)
|
30
|
+
# rubocop:disable Metrics/AbcSize
|
31
|
+
def handle(num_retries = 0, &request)
|
30
32
|
request.call
|
31
33
|
rescue Faraday::ClientError => e
|
32
34
|
raise e unless e.response
|
35
|
+
|
33
36
|
case e.response[:status]
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
when 400 then raise invalid_request(e.response)
|
38
|
+
when 401 then raise not_authorized(e.response)
|
39
|
+
when 402 then raise payment_required(e.response)
|
40
|
+
when 403 then raise forbidden(e.response)
|
41
|
+
when 404 then raise not_found(e.response)
|
42
|
+
when 412 then recover_response(e.response)
|
43
|
+
when 429 then raise rate_limit_enforced(e.response)
|
44
|
+
when 500 then raise server_error(e.response)
|
45
|
+
else raise api_error(e.response)
|
43
46
|
end
|
44
47
|
# Retry for timeouts or 500s from Asana
|
45
48
|
rescue Faraday::ServerError => e
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
raise server_error(e.response)
|
50
|
-
end
|
49
|
+
raise server_error(e.response) unless num_retries < MAX_RETRIES
|
50
|
+
|
51
|
+
handle(num_retries + 1, &request)
|
51
52
|
rescue Net::ReadTimeout => e
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
raise e
|
56
|
-
end
|
53
|
+
raise e unless num_retries < MAX_RETRIES
|
54
|
+
|
55
|
+
handle(num_retries + 1, &request)
|
57
56
|
end
|
58
|
-
# rubocop:enable
|
57
|
+
# rubocop:enable Metrics/AbcSize
|
59
58
|
|
60
59
|
# Internal: Returns an InvalidRequest exception including a list of
|
61
60
|
# errors.
|
@@ -110,13 +109,15 @@ module Asana
|
|
110
109
|
|
111
110
|
# Internal: Parser a response body from JSON.
|
112
111
|
def body(response)
|
113
|
-
JSON.
|
112
|
+
JSON.parse(response[:body])
|
114
113
|
end
|
115
114
|
|
115
|
+
# rubocop:disable Style/OpenStructUse
|
116
116
|
def recover_response(response)
|
117
117
|
r = response.dup.tap { |res| res[:body] = body(response) }
|
118
118
|
Response.new(OpenStruct.new(env: OpenStruct.new(r)))
|
119
119
|
end
|
120
|
+
# rubocop:enable Style/OpenStructUse
|
120
121
|
end
|
121
122
|
end
|
122
123
|
end
|
data/lib/asana/http_client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'faraday/follow_redirects'
|
3
5
|
|
@@ -10,7 +12,7 @@ module Asana
|
|
10
12
|
# parsing and common options.
|
11
13
|
class HttpClient
|
12
14
|
# Internal: The API base URI.
|
13
|
-
BASE_URI = 'https://app.asana.com/api/1.0'
|
15
|
+
BASE_URI = 'https://app.asana.com/api/1.0'
|
14
16
|
|
15
17
|
# Public: Initializes an HttpClient to make requests to the Asana API.
|
16
18
|
#
|
@@ -130,7 +132,7 @@ module Asana
|
|
130
132
|
configure_format(builder)
|
131
133
|
add_middleware(builder)
|
132
134
|
configure_redirects(builder)
|
133
|
-
@config
|
135
|
+
@config&.call(builder)
|
134
136
|
use_adapter(builder, @adapter)
|
135
137
|
end
|
136
138
|
end
|
@@ -173,79 +175,75 @@ module Asana
|
|
173
175
|
end
|
174
176
|
|
175
177
|
def log_request(method, url, body)
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
178
|
+
warn format('[%<klass>s] %<method>s %<url>s (%<bodt>s)',
|
179
|
+
klass: self.class,
|
180
|
+
method: method.to_s.upcase,
|
181
|
+
url: url,
|
182
|
+
body: body.inspect)
|
181
183
|
end
|
182
184
|
|
185
|
+
# rubocop:disable Metrics/AbcSize
|
186
|
+
# rubocop:disable Metrics/MethodLength
|
183
187
|
def log_asana_change_headers(request_headers, response_headers)
|
184
188
|
change_header_key = nil
|
185
189
|
|
186
190
|
response_headers.each_key do |key|
|
187
|
-
if key.downcase == 'asana-change'
|
188
|
-
change_header_key = key
|
189
|
-
end
|
191
|
+
change_header_key = key if key.downcase == 'asana-change'
|
190
192
|
end
|
191
193
|
|
192
|
-
if change_header_key
|
193
|
-
accounted_for_flags = Array.new
|
194
|
+
return if change_header_key.nil?
|
194
195
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
elsif req_header.downcase == 'asana-disable'
|
205
|
-
request_headers[req_header].split(',').each do |flag|
|
206
|
-
accounted_for_flags.push(flag)
|
207
|
-
end
|
196
|
+
accounted_for_flags = []
|
197
|
+
|
198
|
+
request_headers = {} if request_headers.nil?
|
199
|
+
# Grab the request's asana-enable flags
|
200
|
+
request_headers.each_key do |req_header|
|
201
|
+
case req_header.downcase
|
202
|
+
when 'asana-enable', 'asana-disable'
|
203
|
+
request_headers[req_header].split(',').each do |flag|
|
204
|
+
accounted_for_flags.push(flag)
|
208
205
|
end
|
209
206
|
end
|
207
|
+
end
|
208
|
+
|
209
|
+
changes = response_headers[change_header_key].split(',')
|
210
|
+
|
211
|
+
changes.each do |unsplit_change|
|
212
|
+
change = unsplit_change.split(';')
|
210
213
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
field[1]
|
225
|
-
|
226
|
-
|
227
|
-
elsif field[0] == 'info'
|
228
|
-
info = field[1]
|
229
|
-
elsif field[0] == 'affected'
|
230
|
-
affected = field[1]
|
231
|
-
end
|
232
|
-
|
233
|
-
# Only show the error if the flag was not in the request's asana-enable header
|
234
|
-
if !(accounted_for_flags.include? name) && (affected == 'true')
|
235
|
-
message1 = 'This request is affected by the "%s"' +
|
236
|
-
' deprecation. Please visit this url for more info: %s'
|
237
|
-
message2 = 'Adding "%s" to your "Asana-Enable" or ' +
|
238
|
-
'"Asana-Disable" header will opt in/out to this deprecation ' +
|
239
|
-
'and suppress this warning.'
|
240
|
-
|
241
|
-
STDERR.puts format(message1, name, info)
|
242
|
-
STDERR.puts format(message2, name)
|
243
|
-
end
|
214
|
+
name = nil
|
215
|
+
info = nil
|
216
|
+
affected = nil
|
217
|
+
|
218
|
+
change.each do |unsplit_field|
|
219
|
+
field = unsplit_field.split('=')
|
220
|
+
|
221
|
+
field[0].strip!
|
222
|
+
field[1].strip!
|
223
|
+
case field[0]
|
224
|
+
when 'name'
|
225
|
+
name = field[1]
|
226
|
+
when 'info'
|
227
|
+
info = field[1]
|
228
|
+
when 'affected'
|
229
|
+
affected = field[1]
|
244
230
|
end
|
231
|
+
|
232
|
+
# Only show the error if the flag was not in the request's asana-enable header
|
233
|
+
next unless !(accounted_for_flags.include? name) && (affected == 'true')
|
234
|
+
|
235
|
+
message1 = 'This request is affected by the "%s" ' \
|
236
|
+
'deprecation. Please visit this url for more info: %s'
|
237
|
+
message2 = 'Adding "%s" to your "Asana-Enable" or ' \
|
238
|
+
'"Asana-Disable" header will opt in/out to this deprecation ' \
|
239
|
+
'and suppress this warning.'
|
240
|
+
|
241
|
+
warn format(message1, name, info)
|
242
|
+
warn format(message2, name)
|
245
243
|
end
|
246
244
|
end
|
247
245
|
end
|
246
|
+
# rubocop:enable Metrics/AbcSize
|
247
|
+
# rubocop:enable Metrics/MethodLength
|
248
248
|
end
|
249
249
|
end
|
250
|
-
|
251
|
-
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday/multipart'
|
2
4
|
|
3
5
|
module Asana
|
@@ -13,8 +15,6 @@ module Asana
|
|
13
15
|
# options - [Hash] the request I/O options
|
14
16
|
# data - [Hash] extra attributes to post
|
15
17
|
#
|
16
|
-
# rubocop:disable Metrics/AbcSize
|
17
|
-
# rubocop:disable Metrics/MethodLength
|
18
18
|
def attach(filename: required('filename'),
|
19
19
|
mime: required('mime'),
|
20
20
|
io: nil, options: {}, **data)
|
@@ -35,8 +35,6 @@ module Asana
|
|
35
35
|
|
36
36
|
Attachment.new(parse(response).first, client: client)
|
37
37
|
end
|
38
|
-
# rubocop:enable Metrics/MethodLength
|
39
|
-
# rubocop:enable Metrics/AbcSize
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'response_helper'
|
2
4
|
|
3
5
|
module Asana
|
@@ -40,7 +42,7 @@ module Asana
|
|
40
42
|
def last
|
41
43
|
@elements.last
|
42
44
|
end
|
43
|
-
|
45
|
+
|
44
46
|
# Public: Returns the size of the collection.
|
45
47
|
def size
|
46
48
|
to_a.size
|
@@ -49,9 +51,7 @@ module Asana
|
|
49
51
|
|
50
52
|
# Public: Returns a String representation of the collection.
|
51
53
|
def to_s
|
52
|
-
"#<Asana::Collection<#{@type}> "
|
53
|
-
"[#{@elements.map(&:inspect).join(', ')}" +
|
54
|
-
(@next_page_data ? ', ...' : '') + ']>'
|
54
|
+
"#<Asana::Collection<#{@type}> [#{@elements.map(&:inspect).join(', ')}#{@next_page_data ? ', ...' : ''}]>"
|
55
55
|
end
|
56
56
|
alias inspect to_s
|
57
57
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'event'
|
2
4
|
|
3
5
|
module Asana
|
@@ -89,13 +91,14 @@ module Asana
|
|
89
91
|
|
90
92
|
# Internal: Returns the formatted params for the poll request.
|
91
93
|
def params
|
92
|
-
{ resource: @resource, sync: @sync }.
|
94
|
+
{ resource: @resource, sync: @sync }.compact
|
93
95
|
end
|
94
96
|
|
95
97
|
# Internal: Executes a block if at least @wait seconds have passed since
|
96
98
|
# @last_poll.
|
97
99
|
def rate_limiting
|
98
100
|
return if @last_poll && Time.now - @last_poll <= @wait
|
101
|
+
|
99
102
|
yield.tap { @last_poll = Time.now }
|
100
103
|
end
|
101
104
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'registry'
|
2
4
|
require_relative 'response_helper'
|
3
5
|
|
@@ -21,6 +23,7 @@ module Asana
|
|
21
23
|
def refresh
|
22
24
|
raise "#{self.class.name} does not respond to #find_by_id" unless \
|
23
25
|
self.class.respond_to?(:find_by_id)
|
26
|
+
|
24
27
|
self.class.find_by_id(client, gid)
|
25
28
|
end
|
26
29
|
|
@@ -30,17 +33,17 @@ module Asana
|
|
30
33
|
# Returns the value for the requested property.
|
31
34
|
#
|
32
35
|
# Raises a NoMethodError if the property doesn't exist.
|
33
|
-
def method_missing(
|
34
|
-
super unless respond_to_missing?(
|
35
|
-
cache(
|
36
|
+
def method_missing(method_name, *args)
|
37
|
+
super unless respond_to_missing?(method_name, *args)
|
38
|
+
cache(method_name, wrapped(to_h[method_name.to_s]))
|
36
39
|
end
|
37
40
|
|
38
41
|
# Internal: Guard for the method_missing proxy. Checks if the resource
|
39
42
|
# actually has a specific piece of data at all.
|
40
43
|
#
|
41
44
|
# Returns true if the resource has the property, false otherwise.
|
42
|
-
def respond_to_missing?(
|
43
|
-
to_h.key?(
|
45
|
+
def respond_to_missing?(method_name, *)
|
46
|
+
to_h.key?(method_name.to_s)
|
44
47
|
end
|
45
48
|
|
46
49
|
# Public:
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative 'gen/audit_log_api_base'
|
2
|
+
|
3
|
+
module Asana
|
4
|
+
module Resources
|
5
|
+
class AuditLogAPI < AuditLogAPIBase
|
6
|
+
|
7
|
+
|
8
|
+
attr_reader :gid
|
9
|
+
|
10
|
+
attr_reader :actor
|
11
|
+
|
12
|
+
attr_reader :context
|
13
|
+
|
14
|
+
attr_reader :api_authentication_method
|
15
|
+
|
16
|
+
attr_reader :client_ip_address
|
17
|
+
|
18
|
+
attr_reader :context_type
|
19
|
+
|
20
|
+
attr_reader :oauth_app_name
|
21
|
+
|
22
|
+
attr_reader :user_agent
|
23
|
+
|
24
|
+
attr_reader :created_at
|
25
|
+
|
26
|
+
attr_reader :details
|
27
|
+
|
28
|
+
attr_reader :event_category
|
29
|
+
|
30
|
+
attr_reader :event_type
|
31
|
+
|
32
|
+
attr_reader :resource
|
33
|
+
|
34
|
+
class << self
|
35
|
+
# Returns the plural name of the resource.
|
36
|
+
def plural_name
|
37
|
+
'audit_log_apis'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -39,7 +39,7 @@ module Asana
|
|
39
39
|
# Get attachments from an object
|
40
40
|
#
|
41
41
|
|
42
|
-
# parent - [str] (required) Globally unique identifier for object to fetch statuses from. Must be a GID for a
|
42
|
+
# parent - [str] (required) Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`.
|
43
43
|
# options - [Hash] the request I/O options
|
44
44
|
# > 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.'
|
45
45
|
# > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
|
@@ -17,7 +17,7 @@ module Asana
|
|
17
17
|
# workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
|
18
18
|
# start_at - [datetime] Filter to events created after this time (inclusive).
|
19
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 [
|
20
|
+
# event_type - [str] Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values.
|
21
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
22
|
# actor_gid - [str] Filter to events triggered by the actor with this ID.
|
23
23
|
# resource_gid - [str] Filter to events with this resource ID.
|
@@ -0,0 +1,71 @@
|
|
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 MembershipsBase < Resource
|
9
|
+
|
10
|
+
def self.inherited(base)
|
11
|
+
Registry.register(base)
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
# Create a membership
|
16
|
+
#
|
17
|
+
|
18
|
+
# options - [Hash] the request I/O options
|
19
|
+
# > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
|
20
|
+
# > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
|
21
|
+
# data - [Hash] the attributes to POST
|
22
|
+
def create_membership(client, options: {}, **data)
|
23
|
+
path = "/memberships"
|
24
|
+
parse(client.post(path, body: data, options: options)).first
|
25
|
+
end
|
26
|
+
|
27
|
+
# Delete a membership
|
28
|
+
#
|
29
|
+
# membership_gid - [str] (required) Globally unique identifier for the membership.
|
30
|
+
# options - [Hash] the request I/O options
|
31
|
+
# > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
|
32
|
+
# > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
|
33
|
+
def delete_membership(client, membership_gid: required("membership_gid"), options: {})
|
34
|
+
path = "/memberships/{membership_gid}"
|
35
|
+
path["{membership_gid}"] = membership_gid
|
36
|
+
parse(client.delete(path, options: options)).first
|
37
|
+
end
|
38
|
+
|
39
|
+
# Get multiple memberships
|
40
|
+
#
|
41
|
+
|
42
|
+
# parent - [str] (required) Globally unique identifier for `project`, `portfolio`, `team`, `goal`, and `workspace`.
|
43
|
+
# member - [str] Globally unique identifier for `team` and `user`.
|
44
|
+
# options - [Hash] the request I/O options
|
45
|
+
# > 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.'
|
46
|
+
# > limit - [int] Pagination limit for the request.
|
47
|
+
# > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
|
48
|
+
# > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
|
49
|
+
def get_memberships(client, parent: nil, member: nil, options: {})
|
50
|
+
path = "/memberships"
|
51
|
+
params = { parent: parent, member: member }.reject { |_,v| v.nil? || Array(v).empty? }
|
52
|
+
Collection.new(parse(client.get(path, params: params, options: options)), type: Resource, client: client)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Update a membership
|
56
|
+
#
|
57
|
+
# membership_gid - [str] (required) Globally unique identifier for the membership.
|
58
|
+
# options - [Hash] the request I/O options
|
59
|
+
# > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
|
60
|
+
# > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
|
61
|
+
# data - [Hash] the attributes to PUT
|
62
|
+
def update_membership(client, membership_gid: required("membership_gid"), options: {}, **data)
|
63
|
+
path = "/memberships/{membership_gid}"
|
64
|
+
path["{membership_gid}"] = membership_gid
|
65
|
+
parse(client.put(path, body: data, options: options)).first
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -186,7 +186,7 @@ module Asana
|
|
186
186
|
|
187
187
|
# assignee - [str] The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.*
|
188
188
|
# project - [str] The project to filter tasks on.
|
189
|
-
# section - [str] The section to filter tasks on.
|
189
|
+
# section - [str] The section to filter tasks on.
|
190
190
|
# workspace - [str] The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.*
|
191
191
|
# completed_since - [datetime] Only return tasks that are either incomplete or that have been completed since this time.
|
192
192
|
# modified_since - [datetime] Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.*
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative 'gen/goals_base'
|
2
|
+
|
3
|
+
module Asana
|
4
|
+
module Resources
|
5
|
+
class Goal < GoalsBase
|
6
|
+
|
7
|
+
|
8
|
+
attr_reader :gid
|
9
|
+
|
10
|
+
attr_reader :resource_type
|
11
|
+
|
12
|
+
attr_reader :due_on
|
13
|
+
|
14
|
+
attr_reader :html_notes
|
15
|
+
|
16
|
+
attr_reader :is_workspace_level
|
17
|
+
|
18
|
+
attr_reader :liked
|
19
|
+
|
20
|
+
attr_reader :name
|
21
|
+
|
22
|
+
attr_reader :notes
|
23
|
+
|
24
|
+
attr_reader :start_on
|
25
|
+
|
26
|
+
attr_reader :status
|
27
|
+
|
28
|
+
attr_reader :current_status_update
|
29
|
+
|
30
|
+
attr_reader :followers
|
31
|
+
|
32
|
+
attr_reader :likes
|
33
|
+
|
34
|
+
attr_reader :metric
|
35
|
+
|
36
|
+
attr_reader :num_likes
|
37
|
+
|
38
|
+
attr_reader :owner
|
39
|
+
|
40
|
+
attr_reader :team
|
41
|
+
|
42
|
+
attr_reader :time_period
|
43
|
+
|
44
|
+
attr_reader :workspace
|
45
|
+
|
46
|
+
class << self
|
47
|
+
# Returns the plural name of the resource.
|
48
|
+
def plural_name
|
49
|
+
'goals'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'gen/goal_relationships_base'
|
2
|
+
|
3
|
+
module Asana
|
4
|
+
module Resources
|
5
|
+
class GoalRelationship < GoalRelationshipsBase
|
6
|
+
|
7
|
+
|
8
|
+
attr_reader :gid
|
9
|
+
|
10
|
+
attr_reader :resource_type
|
11
|
+
|
12
|
+
attr_reader :contribution_weight
|
13
|
+
|
14
|
+
attr_reader :resource_subtype
|
15
|
+
|
16
|
+
attr_reader :supported_goal
|
17
|
+
|
18
|
+
attr_reader :owner
|
19
|
+
|
20
|
+
attr_reader :supporting_resource
|
21
|
+
|
22
|
+
attr_reader :supporting_resource
|
23
|
+
|
24
|
+
class << self
|
25
|
+
# Returns the plural name of the resource.
|
26
|
+
def plural_name
|
27
|
+
'goal_relationships'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'gen/memberships_base'
|
2
|
+
|
3
|
+
module Asana
|
4
|
+
module Resources
|
5
|
+
class Membership < MembershipsBase
|
6
|
+
|
7
|
+
|
8
|
+
attr_reader :gid
|
9
|
+
|
10
|
+
attr_reader :resource_type
|
11
|
+
|
12
|
+
class << self
|
13
|
+
# Returns the plural name of the resource.
|
14
|
+
def plural_name
|
15
|
+
'memberships'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'gen/project_briefs_base'
|
2
|
+
|
3
|
+
module Asana
|
4
|
+
module Resources
|
5
|
+
class ProjectBrief < ProjectBriefsBase
|
6
|
+
|
7
|
+
|
8
|
+
attr_reader :gid
|
9
|
+
|
10
|
+
attr_reader :resource_type
|
11
|
+
|
12
|
+
attr_reader :html_text
|
13
|
+
|
14
|
+
attr_reader :title
|
15
|
+
|
16
|
+
attr_reader :permalink_url
|
17
|
+
|
18
|
+
attr_reader :project
|
19
|
+
|
20
|
+
attr_reader :text
|
21
|
+
|
22
|
+
class << self
|
23
|
+
# Returns the plural name of the resource.
|
24
|
+
def plural_name
|
25
|
+
'project_briefs'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|