asana 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmFmMWNhNTVhYWY5NjkwYmQ3YjA4NWE4NzJkMDhmNWY1YjJhNTBmZA==
4
+ MGY4ZTk0NDM4YmM4MmU3MjVjZTQ2NDM3ZGYzZWU5YTg3NWNhYzc4Yg==
5
5
  data.tar.gz: !binary |-
6
- N2VhZDRkN2YyMDQ2NGE2ZmVkYTU4NGVhOGUwYmM2YmQyZGEyOWZiNA==
6
+ NTNlYzI5OTg1MWY4YzA1ODAxMGYyNjk5MDUxODZiZDU5YTI4YzUxMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzY0MzQxYjZhMzhlOWYxOTBkNTViMWY3M2ZkMWE5YmU4OTUyODNjZmUxYzYz
10
- MWNkMWU4YjIzYzFhZGJmODIyZDI1ZmM1ZGE0YzdiMTU2OWJhNzdlZjFiOGIw
11
- ZmE5MzY5MDFjODVmNjg0NDI3M2FmNDkzNjM0NWQ1YjM4NmUxMzQ=
9
+ ZGMwNWM0NjI2ZjhlZmVlZjk3MzA3ZTE5ODhmMjA2ZGM4YzY3ZGEwYThmMDlk
10
+ ZmJhOWY4MjAxNGEwNGI1MjFmODc1YzBiYjUzYzE4NDIxNjE3YTgwOGFmM2Yy
11
+ NmYzNDAyMDBlNDYwYjZmMDkwN2QyZWEyNzY3MWY5YmYwZjEzYzA=
12
12
  data.tar.gz: !binary |-
13
- YTczZDZlNzRiZDhjNThkMDZjM2MwZjgyZGQ1YjgzYjhlYmEzMjMwYTljYjFl
14
- NjU4MzQ2YmQ1MGFiNWFkZWJjNTBiMzBlMGM1MTk1ZTNiMmIzOWUyNTE5ZWZk
15
- YWQxZjFjMzllYTY5OWZjZmUzZGZiMGJlY2RlZTVjYmM2OTZhZjY=
13
+ Mjk3OGIzNDY1ZjI0NDg0ZWIxMDU2NGU5YmU3YzJhYzIwMzZjNTk3M2E5ODU0
14
+ YWY1ZjRjZWFiOTZlYjFkNGExMTVmOWZmNzY5YmNjYTYyODE0ODU2YzlmMzIx
15
+ NjJmZWFhYTE5NmNmMzYzZmUxMmRjNzkwMGE1ODJkNzA4ODhhNjY=
data/README.md CHANGED
@@ -351,5 +351,5 @@ to make a release, as they'll need to run a release script from the
351
351
 
352
352
  [apidocs]: https://asana.com/developers
353
353
  [io]: https://asana.com/developers/documentation/getting-started/input-output-options
354
- [docs]: https://asana.github.com/ruby-asana
354
+ [docs]: http://www.rubydoc.info/github/Asana/ruby-asana/master
355
355
  [meta]: https://github.com/asana/asana-api-meta
@@ -16,17 +16,27 @@ module Asana
16
16
  include EventSubscription
17
17
 
18
18
 
19
+ attr_reader :name
20
+
19
21
  attr_reader :id
20
22
 
21
- attr_reader :archived
23
+ attr_reader :owner
22
24
 
23
- attr_reader :created_at
25
+ attr_reader :current_status
24
26
 
25
- attr_reader :followers
27
+ attr_reader :due_date
28
+
29
+ attr_reader :created_at
26
30
 
27
31
  attr_reader :modified_at
28
32
 
29
- attr_reader :name
33
+ attr_reader :archived
34
+
35
+ attr_reader :public
36
+
37
+ attr_reader :members
38
+
39
+ attr_reader :followers
30
40
 
31
41
  attr_reader :color
32
42
 
@@ -186,6 +196,49 @@ module Asana
186
196
  Collection.new(parse(client.get("/projects/#{id}/tasks", params: params, options: options)), type: Task, client: client)
187
197
  end
188
198
 
199
+ # Adds the specified list of users as followers to the project. Followers are a subset of members, therefore if
200
+ # the users are not already members of the project they will also become members as a result of this operation.
201
+ # Returns the updated project record.
202
+ #
203
+ # followers - [Array] An array of followers to add to the project.
204
+ # options - [Hash] the request I/O options.
205
+ # data - [Hash] the attributes to post.
206
+ def add_followers(followers: required("followers"), options: {}, **data)
207
+ with_params = data.merge(followers: followers).reject { |_,v| v.nil? || Array(v).empty? }
208
+ refresh_with(parse(client.post("/projects/#{id}/addFollowers", body: with_params, options: options)).first)
209
+ end
210
+
211
+ # Removes the specified list of users from following the project, this will not affect project membership status.
212
+ # Returns the updated project record.
213
+ #
214
+ # followers - [Array] An array of followers to remove from the project.
215
+ # options - [Hash] the request I/O options.
216
+ # data - [Hash] the attributes to post.
217
+ def remove_followers(followers: required("followers"), options: {}, **data)
218
+ with_params = data.merge(followers: followers).reject { |_,v| v.nil? || Array(v).empty? }
219
+ refresh_with(parse(client.post("/projects/#{id}/removeFollowers", body: with_params, options: options)).first)
220
+ end
221
+
222
+ # Adds the specified list of users as members of the project. Returns the updated project record.
223
+ #
224
+ # members - [Array] An array of members to add to the project.
225
+ # options - [Hash] the request I/O options.
226
+ # data - [Hash] the attributes to post.
227
+ def add_members(members: required("members"), options: {}, **data)
228
+ with_params = data.merge(members: members).reject { |_,v| v.nil? || Array(v).empty? }
229
+ refresh_with(parse(client.post("/projects/#{id}/addMembers", body: with_params, options: options)).first)
230
+ end
231
+
232
+ # Removes the specified list of members from the project. Returns the updated project record.
233
+ #
234
+ # members - [Array] An array of members to remove from the project.
235
+ # options - [Hash] the request I/O options.
236
+ # data - [Hash] the attributes to post.
237
+ def remove_members(members: required("members"), options: {}, **data)
238
+ with_params = data.merge(members: members).reject { |_,v| v.nil? || Array(v).empty? }
239
+ refresh_with(parse(client.post("/projects/#{id}/removeMembers", body: with_params, options: options)).first)
240
+ end
241
+
189
242
  end
190
243
  end
191
244
  end
@@ -41,16 +41,6 @@ module Asana
41
41
  'stories'
42
42
  end
43
43
 
44
- # Returns the full record for a single story.
45
- #
46
- # id - [Id] Globally unique identifier for the story.
47
- #
48
- # options - [Hash] the request I/O options.
49
- def find_by_id(client, id, options: {})
50
-
51
- self.new(parse(client.get("/stories/#{id}", options: options)).first, client: client)
52
- end
53
-
54
44
  # Returns the compact records for all stories on the task.
55
45
  #
56
46
  # task - [Id] Globally unique identifier for the task.
@@ -62,6 +52,16 @@ module Asana
62
52
  Collection.new(parse(client.get("/tasks/#{task}/stories", params: params, options: options)), type: self, client: client)
63
53
  end
64
54
 
55
+ # Returns the full record for a single story.
56
+ #
57
+ # id - [Id] Globally unique identifier for the story.
58
+ #
59
+ # options - [Hash] the request I/O options.
60
+ def find_by_id(client, id, options: {})
61
+
62
+ self.new(parse(client.get("/stories/#{id}", options: options)).first, client: client)
63
+ end
64
+
65
65
  # Adds a comment to a task. The comment will be authored by the
66
66
  # currently authenticated user, and timestamped when the server receives
67
67
  # the request.
@@ -54,6 +54,8 @@ module Asana
54
54
 
55
55
  attr_reader :memberships
56
56
 
57
+ attr_reader :tags
58
+
57
59
  class << self
58
60
  # Returns the plural name of the resource.
59
61
  def plural_name
@@ -125,7 +127,7 @@ module Asana
125
127
  # Returns the compact task records for some filtered set of tasks. Use one
126
128
  # or more of the parameters provided to filter the tasks returned.
127
129
  #
128
- # assignee - [Id] The assignee to filter tasks on.
130
+ # assignee - [String] The assignee to filter tasks on.
129
131
  # workspace - [Id] The workspace or organization to filter tasks on.
130
132
  # completed_since - [String] Only return tasks that are either incomplete or that have been
131
133
  # completed since this time.
@@ -50,6 +50,36 @@ module Asana
50
50
  Collection.new(parse(client.get("/teams/#{id}/users", params: params, options: options)), type: User, client: client)
51
51
  end
52
52
 
53
+ # The user making this call must be a member of the team in order to add others.
54
+ # The user to add must exist in the same organization as the team in order to be added.
55
+ # The user to add can be referenced by their globally unique user ID or their email address.
56
+ # Returns the full user record for the added user.
57
+ #
58
+ # user - [String] An identifier for the user. Can be one of an email address,
59
+ # the globally unique identifier for the user, or the keyword `me`
60
+ # to indicate the current user making the request.
61
+ #
62
+ # options - [Hash] the request I/O options.
63
+ # data - [Hash] the attributes to post.
64
+ def add_user(user: required("user"), options: {}, **data)
65
+ with_params = data.merge(user: user).reject { |_,v| v.nil? || Array(v).empty? }
66
+ User.new(parse(client.post("/teams/#{id}/addUser", body: with_params, options: options)).first, client: client)
67
+ end
68
+
69
+ # The user to remove can be referenced by their globally unique user ID or their email address.
70
+ # Removes the user from the specified team. Returns an empty data record.
71
+ #
72
+ # user - [String] An identifier for the user. Can be one of an email address,
73
+ # the globally unique identifier for the user, or the keyword `me`
74
+ # to indicate the current user making the request.
75
+ #
76
+ # options - [Hash] the request I/O options.
77
+ # data - [Hash] the attributes to post.
78
+ def remove_user(user: required("user"), options: {}, **data)
79
+ with_params = data.merge(user: user).reject { |_,v| v.nil? || Array(v).empty? }
80
+ client.post("/teams/#{id}/removeUser", body: with_params, options: options) && true
81
+ end
82
+
53
83
  end
54
84
  end
55
85
  end
@@ -38,12 +38,14 @@ module Asana
38
38
 
39
39
  # Returns the full user record for the single user with the provided ID.
40
40
  #
41
- # id - [Id] Globally unique identifier for the user.
41
+ # user - [String] An identifier for the user. Can be one of an email address,
42
+ # the globally unique identifier for the user, or the keyword `me`
43
+ # to indicate the current user making the request.
42
44
  #
43
45
  # options - [Hash] the request I/O options.
44
- def find_by_id(client, id, options: {})
45
-
46
- self.new(parse(client.get("/users/#{id}", options: options)).first, client: client)
46
+ def find_by_id(client, user: required("user"), options: {})
47
+ params = { user: user }.reject { |_,v| v.nil? || Array(v).empty? }
48
+ Resource.new(parse(client.get("/users/%s", params: params, options: options)).first, client: client)
47
49
  end
48
50
 
49
51
  # Returns the user records for all users in the specified workspace or
@@ -92,6 +92,34 @@ module Asana
92
92
  Collection.new(parse(client.get("/workspaces/#{id}/typeahead", params: params, options: options)), type: Resource, client: client)
93
93
  end
94
94
 
95
+ # The user can be referenced by their globally unique user ID or their email address.
96
+ # Returns the full user record for the invited user.
97
+ #
98
+ # user - [String] An identifier for the user. Can be one of an email address,
99
+ # the globally unique identifier for the user, or the keyword `me`
100
+ # to indicate the current user making the request.
101
+ #
102
+ # options - [Hash] the request I/O options.
103
+ # data - [Hash] the attributes to post.
104
+ def add_user(user: required("user"), options: {}, **data)
105
+ with_params = data.merge(user: user).reject { |_,v| v.nil? || Array(v).empty? }
106
+ User.new(parse(client.post("/workspaces/#{id}/addUser", body: with_params, options: options)).first, client: client)
107
+ end
108
+
109
+ # The user making this call must be an admin in the workspace.
110
+ # Returns an empty data record.
111
+ #
112
+ # user - [String] An identifier for the user. Can be one of an email address,
113
+ # the globally unique identifier for the user, or the keyword `me`
114
+ # to indicate the current user making the request.
115
+ #
116
+ # options - [Hash] the request I/O options.
117
+ # data - [Hash] the attributes to post.
118
+ def remove_user(user: required("user"), options: {}, **data)
119
+ with_params = data.merge(user: user).reject { |_,v| v.nil? || Array(v).empty? }
120
+ client.post("/workspaces/#{id}/removeUser", body: with_params, options: options) && true
121
+ end
122
+
95
123
  end
96
124
  end
97
125
  end
data/lib/asana/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #:nodoc:
2
2
  module Asana
3
3
  # Public: Version of the gem.
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Txus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-02 00:00:00.000000000 Z
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2