asana 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,8 +10,18 @@ module Asana
10
10
 
11
11
  attr_reader :id
12
12
 
13
+ attr_reader :gid
14
+
15
+ attr_reader :resource_type
16
+
13
17
  attr_reader :name
14
18
 
19
+ attr_reader :description
20
+
21
+ attr_reader :html_description
22
+
23
+ attr_reader :organization
24
+
15
25
  class << self
16
26
  # Returns the plural name of the resource.
17
27
  def plural_name
@@ -61,7 +71,7 @@ module Asana
61
71
  # options - [Hash] the request I/O options.
62
72
  def users(per_page: 20, options: {})
63
73
  params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
64
- Collection.new(parse(client.get("/teams/#{id}/users", params: params, options: options)), type: User, client: client)
74
+ Collection.new(parse(client.get("/teams/#{gid}/users", params: params, options: options)), type: User, client: client)
65
75
  end
66
76
 
67
77
  # The user making this call must be a member of the team in order to add others.
@@ -77,7 +87,7 @@ module Asana
77
87
  # data - [Hash] the attributes to post.
78
88
  def add_user(user: required("user"), options: {}, **data)
79
89
  with_params = data.merge(user: user).reject { |_,v| v.nil? || Array(v).empty? }
80
- User.new(parse(client.post("/teams/#{id}/addUser", body: with_params, options: options)).first, client: client)
90
+ User.new(parse(client.post("/teams/#{gid}/addUser", body: with_params, options: options)).first, client: client)
81
91
  end
82
92
 
83
93
  # The user to remove can be referenced by their globally unique user ID or their email address.
@@ -91,7 +101,7 @@ module Asana
91
101
  # data - [Hash] the attributes to post.
92
102
  def remove_user(user: required("user"), options: {}, **data)
93
103
  with_params = data.merge(user: user).reject { |_,v| v.nil? || Array(v).empty? }
94
- client.post("/teams/#{id}/removeUser", body: with_params, options: options) && true
104
+ client.post("/teams/#{gid}/removeUser", body: with_params, options: options) && true
95
105
  end
96
106
 
97
107
  end
@@ -14,6 +14,10 @@ module Asana
14
14
 
15
15
  attr_reader :id
16
16
 
17
+ attr_reader :gid
18
+
19
+ attr_reader :resource_type
20
+
17
21
  attr_reader :name
18
22
 
19
23
  attr_reader :email
@@ -72,6 +76,17 @@ module Asana
72
76
  end
73
77
  end
74
78
 
79
+ # Returns all of a user's favorites in the given workspace, of the given type.
80
+ # Results are given in order (The same order as Asana's sidebar).
81
+ #
82
+ # workspace - [Id] The workspace in which to get favorites.
83
+ # resource_type - [Enum] The resource type of favorites to be returned.
84
+ # options - [Hash] the request I/O options.
85
+ def get_user_favorites(workspace: required("workspace"), resource_type: required("resource_type"), options: {})
86
+ params = { workspace: workspace, resource_type: resource_type }.reject { |_,v| v.nil? || Array(v).empty? }
87
+ Collection.new(parse(client.get("/users/#{gid}/favorites", params: params, options: options)), type: Resource, client: client)
88
+ end
89
+
75
90
  end
76
91
  end
77
92
  end
@@ -0,0 +1,93 @@
1
+ ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
+ ### edit it manually.
3
+
4
+ module Asana
5
+ module Resources
6
+ # A _user task list_ represents the tasks assigned to a particular user. It provides API access to a user's "My Tasks" view in Asana.
7
+ #
8
+ # A user's "My Tasks" represent all of the tasks assigned to that user. It is
9
+ # visually divided into regions based on the task's
10
+ # [`assignee_status`](/developers/api-reference/tasks#field-assignee_status)
11
+ # for Asana users to triage their tasks based on when they can address them.
12
+ # When building an integration it's worth noting that tasks with due dates will
13
+ # automatically move through `assignee_status` states as their due dates
14
+ # approach; read up on [task
15
+ # auto-promotion](/guide/help/fundamentals/my-tasks#gl-auto-promote) for more
16
+ # infomation.
17
+ class UserTaskList < Resource
18
+
19
+
20
+ attr_reader :id
21
+
22
+ attr_reader :gid
23
+
24
+ attr_reader :resource_type
25
+
26
+ attr_reader :name
27
+
28
+ attr_reader :owner
29
+
30
+ attr_reader :workspace
31
+
32
+ class << self
33
+ # Returns the plural name of the resource.
34
+ def plural_name
35
+ 'user_task_lists'
36
+ end
37
+
38
+ # Returns the full record for the user task list for the given user
39
+ #
40
+ # user - [String] An identifier for the user. Can be one of an email address,
41
+ # the globally unique identifier for the user, or the keyword `me`
42
+ # to indicate the current user making the request.
43
+ #
44
+ # workspace - [Gid] Globally unique identifier for the workspace or organization.
45
+ #
46
+ # options - [Hash] the request I/O options.
47
+ def find_by_user(client, user: required("user"), workspace: required("workspace"), options: {})
48
+ params = { workspace: workspace }.reject { |_,v| v.nil? || Array(v).empty? }
49
+ Resource.new(parse(client.get("/users/#{user}/user_task_list", params: params, options: options)).first, client: client)
50
+ end
51
+
52
+ # Returns the full record for a user task list.
53
+ #
54
+ # id - [Gid] Globally unique identifier for the user task list.
55
+ #
56
+ # options - [Hash] the request I/O options.
57
+ def find_by_id(client, id, options: {})
58
+
59
+ self.new(parse(client.get("/user_task_lists/#{id}", options: options)).first, client: client)
60
+ end
61
+ end
62
+
63
+ # Returns the compact list of tasks in a user's My Tasks list. The returned
64
+ # tasks will be in order within each assignee status group of `Inbox`,
65
+ # `Today`, and `Upcoming`.
66
+ #
67
+ # **Note:** tasks in `Later` have a different ordering in the Asana web app
68
+ # than the other assignee status groups; this endpoint will still return
69
+ # them in list order in `Later` (differently than they show up in Asana,
70
+ # but the same order as in Asana's mobile apps).
71
+ #
72
+ # **Note:** Access control is enforced for this endpoint as with all Asana
73
+ # API endpoints, meaning a user's private tasks will be filtered out if the
74
+ # API-authenticated user does not have access to them.
75
+ #
76
+ # **Note:** Both complete and incomplete tasks are returned by default
77
+ # unless they are filtered out (for example, setting `completed_since=now`
78
+ # will return only incomplete tasks, which is the default view for "My
79
+ # Tasks" in Asana.)
80
+ #
81
+ # completed_since - [String] Only return tasks that are either incomplete or that have been
82
+ # completed since this time.
83
+ #
84
+ # per_page - [Integer] the number of records to fetch per page.
85
+ # options - [Hash] the request I/O options.
86
+ def tasks(completed_since: nil, per_page: 20, options: {})
87
+ params = { completed_since: completed_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
88
+ Collection.new(parse(client.get("/user_task_lists/#{gid}/tasks", params: params, options: options)), type: Task, client: client)
89
+ end
90
+
91
+ end
92
+ end
93
+ end
@@ -22,12 +22,14 @@ module Asana
22
22
  # {\
23
23
  # "resource": {\
24
24
  # "id": 1337,\
25
+ # "resource_type": "task",\
25
26
  # "name": "My Task"\
26
27
  # },\
27
28
  # "parent": null,\
28
29
  # "created_at": "2013-08-21T18:20:37.972Z",\
29
30
  # "user": {\
30
31
  # "id": 1123,\
32
+ # "resource_type": "user",\
31
33
  # "name": "Tom Bizarro"\
32
34
  # },\
33
35
  # "action": "changed",\
@@ -52,6 +54,10 @@ module Asana
52
54
 
53
55
  attr_reader :id
54
56
 
57
+ attr_reader :gid
58
+
59
+ attr_reader :resource_type
60
+
55
61
  attr_reader :resource
56
62
 
57
63
  attr_reader :target
@@ -129,7 +135,7 @@ module Asana
129
135
  # webhook, but no further requests will be issued.
130
136
  def delete_by_id()
131
137
 
132
- self.class.new(parse(client.delete("/webhooks/#{id}")).first, client: client)
138
+ self.class.new(parse(client.delete("/webhooks/#{gid}")).first, client: client)
133
139
  end
134
140
 
135
141
  end
@@ -22,6 +22,10 @@ module Asana
22
22
 
23
23
  attr_reader :id
24
24
 
25
+ attr_reader :gid
26
+
27
+ attr_reader :resource_type
28
+
25
29
  attr_reader :name
26
30
 
27
31
  attr_reader :is_organization
@@ -64,7 +68,7 @@ module Asana
64
68
  # data - [Hash] the attributes to post.
65
69
  def update(options: {}, **data)
66
70
 
67
- refresh_with(parse(client.put("/workspaces/#{id}", body: data, options: options)).first)
71
+ refresh_with(parse(client.put("/workspaces/#{gid}", body: data, options: options)).first)
68
72
  end
69
73
 
70
74
  # Retrieves objects in the workspace based on an auto-completion/typeahead
@@ -73,11 +77,13 @@ module Asana
73
77
  # result set is limited to a single page of results with a maximum size,
74
78
  # so you won't be able to fetch large numbers of results.
75
79
  #
76
- # type - [Enum] The type of values the typeahead should return. You can choose from
80
+ # resource_type - [Enum] The type of values the typeahead should return. You can choose from
77
81
  # one of the following: custom_field, project, tag, task, and user.
78
82
  # Note that unlike in the names of endpoints, the types listed here are
79
83
  # in singular form (e.g. `task`). Using multiple types is not yet supported.
80
84
  #
85
+ # type - [Enum] **Deprecated: new integrations should prefer the resource_type field.**
86
+ #
81
87
  # query - [String] The string that will be used to search for relevant objects. If an
82
88
  # empty string is passed in, the API will currently return an empty
83
89
  # result set.
@@ -88,9 +94,9 @@ module Asana
88
94
  #
89
95
  # per_page - [Integer] the number of records to fetch per page.
90
96
  # options - [Hash] the request I/O options.
91
- def typeahead(type: required("type"), query: nil, count: nil, per_page: 20, options: {})
92
- params = { type: type, query: query, count: count, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
93
- Collection.new(parse(client.get("/workspaces/#{id}/typeahead", params: params, options: options)), type: Resource, client: client)
97
+ def typeahead(resource_type: nil, type: nil, query: nil, count: nil, per_page: 20, options: {})
98
+ params = { resource_type: resource_type || type, query: query, count: count, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
99
+ Collection.new(parse(client.get("/workspaces/#{gid}/typeahead", params: params, options: options)), type: Resource, client: client)
94
100
  end
95
101
 
96
102
  # The user can be referenced by their globally unique user ID or their email address.
@@ -104,7 +110,7 @@ module Asana
104
110
  # data - [Hash] the attributes to post.
105
111
  def add_user(user: required("user"), options: {}, **data)
106
112
  with_params = data.merge(user: user).reject { |_,v| v.nil? || Array(v).empty? }
107
- User.new(parse(client.post("/workspaces/#{id}/addUser", body: with_params, options: options)).first, client: client)
113
+ User.new(parse(client.post("/workspaces/#{gid}/addUser", body: with_params, options: options)).first, client: client)
108
114
  end
109
115
 
110
116
  # The user making this call must be an admin in the workspace.
@@ -118,7 +124,7 @@ module Asana
118
124
  # data - [Hash] the attributes to post.
119
125
  def remove_user(user: required("user"), options: {}, **data)
120
126
  with_params = data.merge(user: user).reject { |_,v| v.nil? || Array(v).empty? }
121
- client.post("/workspaces/#{id}/removeUser", body: with_params, options: options) && true
127
+ client.post("/workspaces/#{gid}/removeUser", body: with_params, options: options) && true
122
128
  end
123
129
 
124
130
  end
@@ -1,5 +1,5 @@
1
1
  #:nodoc:
2
2
  module Asana
3
3
  # Public: Version of the gem.
4
- VERSION = '0.8.1'.freeze
4
+ VERSION = '0.9.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asana
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Txus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-08 00:00:00.000000000 Z
11
+ date: 2019-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.0'
69
- - !ruby/object:Gem::Dependency
70
- name: bundler
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.7'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.7'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rake
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -112,20 +98,20 @@ dependencies:
112
98
  name: appraisal
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
- - - "~>"
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: '2.1'
118
- - - ">="
104
+ - - "~>"
119
105
  - !ruby/object:Gem::Version
120
106
  version: '2.1'
121
107
  type: :development
122
108
  prerelease: false
123
109
  version_requirements: !ruby/object:Gem::Requirement
124
110
  requirements:
125
- - - "~>"
111
+ - - ">="
126
112
  - !ruby/object:Gem::Version
127
113
  version: '2.1'
128
- - - ">="
114
+ - - "~>"
129
115
  - !ruby/object:Gem::Version
130
116
  version: '2.1'
131
117
  description: Official Ruby client for the Asana API
@@ -139,6 +125,7 @@ files:
139
125
  - ".gitignore"
140
126
  - ".rspec"
141
127
  - ".rubocop.yml"
128
+ - ".ruby-version"
142
129
  - ".travis.yml"
143
130
  - ".yardopts"
144
131
  - Appraisals
@@ -183,7 +170,10 @@ files:
183
170
  - lib/asana/resources/attachment.rb
184
171
  - lib/asana/resources/custom_field_settings.rb
185
172
  - lib/asana/resources/custom_fields.rb
173
+ - lib/asana/resources/job.rb
186
174
  - lib/asana/resources/organization_export.rb
175
+ - lib/asana/resources/portfolio.rb
176
+ - lib/asana/resources/portfolio_membership.rb
187
177
  - lib/asana/resources/project.rb
188
178
  - lib/asana/resources/project_membership.rb
189
179
  - lib/asana/resources/project_status.rb
@@ -193,6 +183,7 @@ files:
193
183
  - lib/asana/resources/task.rb
194
184
  - lib/asana/resources/team.rb
195
185
  - lib/asana/resources/user.rb
186
+ - lib/asana/resources/user_task_list.rb
196
187
  - lib/asana/resources/webhook.rb
197
188
  - lib/asana/resources/workspace.rb
198
189
  - lib/asana/ruby2_0_0_compatibility.rb
@@ -219,8 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
210
  - !ruby/object:Gem::Version
220
211
  version: '0'
221
212
  requirements: []
222
- rubyforge_project:
223
- rubygems_version: 2.7.7
213
+ rubygems_version: 3.0.4
224
214
  signing_key:
225
215
  specification_version: 4
226
216
  summary: Official Ruby client for the Asana API