asana 0.5.0 → 0.6.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
- ZGY2NmI1NmY2YzM2ZmIzOWMzYzMxMmUwZDBiNTVkOTU4ODNlNTUwOQ==
4
+ ZDNhNmQzZDIzZWU1OWI4ZDJkMWU3MTg0MGFiMmZiNTg5YjczZDE3ZQ==
5
5
  data.tar.gz: !binary |-
6
- Mjk2OTM4ZWRmYzVjMzAwMzc5OGIxNDk5Mjg1NWI3MGZmYjExNTZjMg==
6
+ ZDQ3OThkZDJmNmExNTlhMjI4Y2VlZDQ1NWIzNmFmZDkzNzRkOWRiYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWE2YjgxNGU2ZmNhOGRkNGE1ODY3N2FkNTE5NjNlZDQzOTQ2YzFiM2JiYzY3
10
- NzVkMDI3YTk0MzUxYjFmMmRhMTQxNzZkNmZjMjAwZDkxOThkOGE1ZWQ1YTJk
11
- ZTY3YTdmYzYyZjllNGM0Y2Y4ZjEzYTQ4MTk0Y2IzZGRiN2E2Zjc=
9
+ ZjUxMWY3ZDc2ZDM2MDMyNmE4NTdkMjIxNjFlNTUzYzdiYTM5MTgyMGJhNWJk
10
+ NmRiNDY5Njc5ZjMyMjVkODFiZmIyZmE2NmY3OTYzNDg3NGMwMzAzMDRkMzU1
11
+ ZWYzMjFiNGYzMDdlZTkzNmE4ODNhYTQxNGQ0MzM3MDYxOGE0ZTU=
12
12
  data.tar.gz: !binary |-
13
- ZGJkODcyZGZmMzljZGQ5NTY5MmMyYjkxZGQ0ZTJmYzhkMzIyYmY0MDZkMDVj
14
- ZjI2MzdkODU1OGM5NDdiNTkwOTE2OWJlZjZhZWQzZGViYWY4ZWQxYzliZjgz
15
- NDM5MjUxYmQwMTNhM2MyNWEzYTQyMjhiMWFiYmZlZjE0YWVlY2Q=
13
+ NzEwMTI5ZjZlNjQxMzFhMzJmY2QzNWI2NTU1MzMwZjZlYTI1ODcwY2NmYWIz
14
+ ZjdjYzQ1MjE2Y2VhOTJhNWMzNWNlMWYyZmFlYmU1ZDM0YWU2NDJiZTgyMzg1
15
+ ZThjNDVlYThhZjY2ZmI1MDAzMzJjYjczMmU3NTdlODQyMzVkNzE=
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
4
- - 2.0.0
3
+ - 2.2.5
5
4
  deploy:
6
5
  provider: rubygems
7
6
  api_key:
data/Gemfile CHANGED
@@ -4,8 +4,13 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :tools do
7
- gem 'rubocop'
8
- gem 'rubocop-rspec'
7
+ # Currently we need to pin the version of Rubocop, due to an incompatibility
8
+ # with rubocop-rspec. However, this also solves the problem that Rubocop
9
+ # routinely adds new checks which can cause our build to "break" even when no
10
+ # changes have been made. In this situation it's better to intentionally
11
+ # upgrade Rubocop and fix issues at that time.
12
+ gem 'rubocop', '~> 0.35.0'
13
+ gem 'rubocop-rspec', '~> 1.2.0'
9
14
 
10
15
  gem 'guard'
11
16
  gem 'guard-rspec'
data/README.md CHANGED
@@ -12,8 +12,54 @@ Supported rubies:
12
12
 
13
13
  * MRI 2.0.0 up to 2.2.x stable
14
14
 
15
- ## Installation
15
+ ## Required: Security procedures for outdated OpenSSL versions
16
16
 
17
+ Older versions of OpenSSL can cause a problem when using `ruby-asana` In particular, at the time of this writing, at least **MacOS X 10.11 and below** ship with a very old version of OpenSSL:
18
+
19
+ $ openssl version
20
+ OpenSSL 0.9.8zh 14 Jan 2016
21
+
22
+ OpenSSL 0.9.8 was first released in 2005, and therefore only supports TLS (Transport Layer Security) version 1.0. Asana has deprecated and stopped accepting requests for clients which do not suport [TLS 1.0 and above](https://asa.na/tls), which unfortunately includes any software linked against this version of the library - this includes both the MacOS X provided Ruby interpreter and any homebrew installed Ruby that is not specifically configured to link against a newer version.
23
+
24
+ To see if your Ruby version is affected, run
25
+
26
+ $ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
27
+
28
+ If the version printed at the command line is older than `1.0.1`, when, in 2012, OpenSSL first supported TLS 1.1 and 1.2, you will not be able to use `ruby-asana` to connect to Asana. Specifically, you will recieve `400 Bad Request` responses with an error message in the response body about the lack of support for TLS 1.1 and above.
29
+
30
+ Asana highly recommends using a Ruby installation manager, either RVM or `rbenv`. Instructions on how to install an up-to-date `ruby` for each of these are below.
31
+
32
+ ### Solution when using RVM
33
+
34
+ RVM makes it easy to install both an updated OpenSSL and a Ruby interpreter that links to it. If you are using MacPorts or Homebrew, you're probably fine out of the box; RVM favors package management using either one of these to satisfy dependencies, and so can keep your ruby up to date automatically. If you are not using these, consider using them, as they're very simple to install and use.
35
+
36
+ If you don't use your package manager, you can use RVM's [package manager](https://rvm.io/packages) to install from source.
37
+
38
+ If you want to build OpenSSL from source yourself, you have to specify how to link to this OpenSSL installation:
39
+
40
+ $ rvm install ruby-{version} --with-openssl-dir={ssl_dir}
41
+ # Specify your openssl path prefix, wherever openssl dirs
42
+ # "bin", "include", and "lib" are installed; usually
43
+ # "/usr" for system installs, or $PREFIX for configure/make locally.
44
+ $ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION' # Verify inside Ruby
45
+ OpenSSL 1.0.2h 3 May 2016
46
+
47
+ If you see the version of OpenSSL greater than OpenSSL 1.0.1, then you're all set to start using `ruby-asana`
48
+
49
+ ### Solution when using rbenv
50
+
51
+ Similar to RVM, rbenv compiles rubies with knowledge of MacPorts and Homebrew libraries. When a newer version of OpenSSL is installed via the method above, all rubies built (after that time of course) will link to the newer version of OpenSSL.
52
+
53
+ If you don't use a package manager, as above, you can build by explicitly supplying the directory in which to find OpenSSL:
54
+
55
+ $ RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/local rbenv install ruby-{version}
56
+ # Specify your openssl path prefix, wherever openssl dirs
57
+ # "bin", "include", and "lib" are installed; usually
58
+ # "/usr" for system installs, or $PREFIX for configure/make locally.
59
+ $ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION' # Verify inside Ruby
60
+ OpenSSL 1.0.2h 3 May 2016
61
+
62
+ ## Gem Installation
17
63
  Add this line to your application's Gemfile:
18
64
 
19
65
  ```ruby
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ end
12
12
 
13
13
  desc 'Generates a test resource from a YAML using the resource template.'
14
14
  task :codegen do
15
+ # TODO: I believe this is obsolete and can be removed
15
16
  `node spec/support/codegen.js`
16
17
  end
17
18
 
@@ -62,4 +63,4 @@ EOS
62
63
  end
63
64
  end
64
65
 
65
- task default: [:codegen, :spec, :rubocop, :yard]
66
+ task default: [:spec, :rubocop, :yard]
@@ -79,7 +79,7 @@ module Asana
79
79
  adapter: config[:faraday_adapter],
80
80
  user_agent: config[:user_agent],
81
81
  debug_mode: config[:debug_mode],
82
- &config[:faraday_config])
82
+ &config[:faraday_configuration])
83
83
  end
84
84
 
85
85
  # Public: Performs a GET request against an arbitrary Asana URL. Allows for
@@ -0,0 +1,42 @@
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
+ # Custom fields are attached to a particular project with the Custom
7
+ # Field Settings resource. This resource both represents the many-to-many join
8
+ # of the Custom Field and Project as well as stores information that is relevant to that
9
+ # particular pairing; for instance, the `is_important` property determines
10
+ # some possible application-specific handling of that custom field (see below)
11
+ class CustomFieldSetting < Resource
12
+
13
+
14
+ attr_reader :id
15
+
16
+ attr_reader :created_at
17
+
18
+ attr_reader :is_important
19
+
20
+ attr_reader :project
21
+
22
+ attr_reader :custom_field
23
+
24
+ class << self
25
+ # Returns the plural name of the resource.
26
+ def plural_name
27
+ 'custom_field_settings'
28
+ end
29
+
30
+ # Returns a list of all of the custom fields settings on a project, in compact form. Note that, as in all queries to collections which return compact representation, `opt_fields` and `opt_expand` can be used to include more data than is returned in the compact representation. See the getting started guide on [input/output options](/developers/documentation/getting-started/input-output-options) for more information.
31
+ #
32
+ # project - [Id] The ID of the project for which to list custom field settings
33
+ # options - [Hash] the request I/O options.
34
+ def find_by_project(client, project: required("project"), options: {})
35
+
36
+ Resource.new(parse(client.get("/projects/#{project}/custom_field_settings", options: options)).first, client: client)
37
+ end
38
+ end
39
+
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,54 @@
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
+ # Custom Fields store the metadata that is used in order to add user-specified
7
+ # information to tasks in Asana. Be sure to reference the [Custom
8
+ # Fields](/developers/documentation/getting-started/custom-fields) developer
9
+ # documentation for more information about how custom fields relate to various
10
+ # resources in Asana.
11
+ class CustomField < Resource
12
+
13
+
14
+ attr_reader :id
15
+
16
+ attr_reader :created_at
17
+
18
+ attr_reader :name
19
+
20
+ attr_reader :type
21
+
22
+ attr_reader :enum_options
23
+
24
+ attr_reader :precision
25
+
26
+ class << self
27
+ # Returns the plural name of the resource.
28
+ def plural_name
29
+ 'custom_fields'
30
+ end
31
+
32
+ # Returns the complete definition of a custom field's metadata.
33
+ #
34
+ # id - [Id] Globally unique identifier for the custom field.
35
+ #
36
+ # options - [Hash] the request I/O options.
37
+ def find_by_id(client, id, options: {})
38
+
39
+ self.new(parse(client.get("/custom_fields/#{id}", options: options)).first, client: client)
40
+ end
41
+
42
+ # Returns a list of the compact representation of all of the custom fields in a workspace.
43
+ #
44
+ # workspace - [Id] The workspace or organization to find custom field definitions in.
45
+ # options - [Hash] the request I/O options.
46
+ def find_by_workspace(client, workspace: required("workspace"), options: {})
47
+
48
+ Resource.new(parse(client.get("/workspaces/#{workspace}/custom_fields", options: options)).first, client: client)
49
+ end
50
+ end
51
+
52
+ end
53
+ end
54
+ end
@@ -38,6 +38,8 @@ module Asana
38
38
 
39
39
  attr_reader :followers
40
40
 
41
+ attr_reader :custom_field_settings
42
+
41
43
  attr_reader :color
42
44
 
43
45
  attr_reader :notes
@@ -239,6 +241,34 @@ module Asana
239
241
  refresh_with(parse(client.post("/projects/#{id}/removeMembers", body: with_params, options: options)).first)
240
242
  end
241
243
 
244
+ # Create a new custom field setting on the project.
245
+ #
246
+ # custom_field - [Id] The id of the custom field to associate with this project.
247
+ # is_important - [Boolean] Whether this field should be considered important to this project.
248
+ #
249
+ # insert_before - [Id] An id of a Custom Field Settings on this project, before which the new Custom Field Settings will be added.
250
+ # `insert_before` and `insert_after` parameters cannot both be specified.
251
+ #
252
+ # insert_after - [Id] An id of a Custom Field Settings on this project, after which the new Custom Field Settings will be added.
253
+ # `insert_before` and `insert_after` parameters cannot both be specified.
254
+ #
255
+ # options - [Hash] the request I/O options.
256
+ # data - [Hash] the attributes to post.
257
+ def add_custom_field_setting(custom_field: required("custom_field"), is_important: nil, insert_before: nil, insert_after: nil, options: {}, **data)
258
+ with_params = data.merge(custom_field: custom_field, is_important: is_important, insert_before: insert_before, insert_after: insert_after).reject { |_,v| v.nil? || Array(v).empty? }
259
+ Resource.new(parse(client.post("/projects/#{id}/addCustomFieldSetting", body: with_params, options: options)).first, client: client)
260
+ end
261
+
262
+ # Remove a custom field setting on the project.
263
+ #
264
+ # custom_field - [Id] The id of the custom field to remove from this project.
265
+ # options - [Hash] the request I/O options.
266
+ # data - [Hash] the attributes to post.
267
+ def remove_custom_field_setting(custom_field: nil, options: {}, **data)
268
+ with_params = data.merge(custom_field: custom_field).reject { |_,v| v.nil? || Array(v).empty? }
269
+ Resource.new(parse(client.post("/projects/#{id}/removeCustomFieldSetting", body: with_params, options: options)).first, client: client)
270
+ end
271
+
242
272
  end
243
273
  end
244
274
  end
@@ -26,6 +26,8 @@ module Asana
26
26
 
27
27
  attr_reader :completed_at
28
28
 
29
+ attr_reader :custom_fields
30
+
29
31
  attr_reader :due_on
30
32
 
31
33
  attr_reader :due_at
@@ -68,7 +70,10 @@ module Asana
68
70
  #
69
71
  # Every task is required to be created in a specific workspace, and this
70
72
  # workspace cannot be changed once set. The workspace need not be set
71
- # explicitly if you specify a `project` or a `parent` task instead.
73
+ # explicitly if you specify `projects` or a `parent` task instead.
74
+ #
75
+ # `projects` can be a comma separated list of projects, or just a single
76
+ # project the task should belong to.
72
77
  #
73
78
  # workspace - [Id] The workspace to create a task in.
74
79
  # options - [Hash] the request I/O options.
@@ -125,9 +130,11 @@ module Asana
125
130
  end
126
131
 
127
132
  # Returns the compact task records for some filtered set of tasks. Use one
128
- # or more of the parameters provided to filter the tasks returned.
133
+ # or more of the parameters provided to filter the tasks returned. You must
134
+ # specify a `project` or `tag` if you do not specify `assignee` and `workspace`.
129
135
  #
130
136
  # assignee - [String] The assignee to filter tasks on.
137
+ # project - [Id] The project to filter tasks on.
131
138
  # workspace - [Id] The workspace or organization to filter tasks on.
132
139
  # completed_since - [String] Only return tasks that are either incomplete or that have been
133
140
  # completed since this time.
@@ -148,8 +155,8 @@ module Asana
148
155
  # just because another object it is associated with (e.g. a subtask)
149
156
  # is modified. Actions that count as modifying the task include
150
157
  # assigning, renaming, completing, and adding stories.
151
- def find_all(client, assignee: nil, workspace: nil, completed_since: nil, modified_since: nil, per_page: 20, options: {})
152
- params = { assignee: assignee, workspace: workspace, completed_since: completed_since, modified_since: modified_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
158
+ def find_all(client, assignee: nil, project: nil, workspace: nil, completed_since: nil, modified_since: nil, per_page: 20, options: {})
159
+ params = { assignee: assignee, project: project, workspace: workspace, completed_since: completed_since, modified_since: modified_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
153
160
  Collection.new(parse(client.get("/tasks", params: params, options: options)), type: self, client: client)
154
161
  end
155
162
  end
@@ -223,10 +230,10 @@ module Asana
223
230
  # Returns an empty data block.
224
231
  #
225
232
  # project - [Id] The project to add the task to.
226
- # insertAfter - [Id] A task in the project to insert the task after, or `null` to
233
+ # insert_after - [Id] A task in the project to insert the task after, or `null` to
227
234
  # insert at the beginning of the list.
228
235
  #
229
- # insertBefore - [Id] A task in the project to insert the task before, or `null` to
236
+ # insert_before - [Id] A task in the project to insert the task before, or `null` to
230
237
  # insert at the end of the list.
231
238
  #
232
239
  # section - [Id] A section in the project to insert the task into. The task will be
@@ -234,8 +241,8 @@ module Asana
234
241
  #
235
242
  # options - [Hash] the request I/O options.
236
243
  # data - [Hash] the attributes to post.
237
- def add_project(project: required("project"), insertAfter: nil, insertBefore: nil, section: nil, options: {}, **data)
238
- with_params = data.merge(project: project, insertAfter: insertAfter, insertBefore: insertBefore, section: section).reject { |_,v| v.nil? || Array(v).empty? }
244
+ def add_project(project: required("project"), insert_after: nil, insert_before: nil, section: nil, options: {}, **data)
245
+ with_params = data.merge(project: project, insert_after: insert_after, insert_before: insert_before, section: section).reject { |_,v| v.nil? || Array(v).empty? }
239
246
  client.post("/tasks/#{id}/addProject", body: with_params, options: options) && true
240
247
  end
241
248
 
@@ -39,6 +39,20 @@ module Asana
39
39
  params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
40
40
  Collection.new(parse(client.get("/organizations/#{organization}/teams", params: params, options: options)), type: self, client: client)
41
41
  end
42
+
43
+ # Returns the compact records for all teams to which user is assigned.
44
+ #
45
+ # user - [String] An identifier for the user. Can be one of an email address,
46
+ # the globally unique identifier for the user, or the keyword `me`
47
+ # to indicate the current user making the request.
48
+ #
49
+ # organization - [Id] The workspace or organization to filter teams on.
50
+ # per_page - [Integer] the number of records to fetch per page.
51
+ # options - [Hash] the request I/O options.
52
+ def find_by_user(client, user: required("user"), organization: nil, per_page: 20, options: {})
53
+ params = { organization: organization, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
54
+ Collection.new(parse(client.get("/users/#{user}/teams", params: params, options: options)), type: self, client: client)
55
+ end
42
56
  end
43
57
 
44
58
  # Returns the compact records for all users that are members of the team.
@@ -38,14 +38,14 @@ module Asana
38
38
 
39
39
  # Returns the full user record for the single user with the provided ID.
40
40
  #
41
- # user - [String] An identifier for the user. Can be one of an email address,
41
+ # id - [String] An identifier for the user. Can be one of an email address,
42
42
  # the globally unique identifier for the user, or the keyword `me`
43
43
  # to indicate the current user making the request.
44
44
  #
45
45
  # options - [Hash] the request I/O options.
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)
46
+ def find_by_id(client, id, options: {})
47
+
48
+ self.new(parse(client.get("/users/#{id}", options: options)).first, client: client)
49
49
  end
50
50
 
51
51
  # Returns the user records for all users in the specified workspace or
@@ -3,8 +3,6 @@
3
3
 
4
4
  module Asana
5
5
  module Resources
6
- # **Webhooks are currently in BETA - The information here may change.**
7
- #
8
6
  # Webhooks allow an application to be notified of changes. This is in addition
9
7
  # to the ability to fetch those changes directly as
10
8
  # [Events](/developers/api-reference/events) - in fact, Webhooks are just a way
@@ -136,4 +134,4 @@ module Asana
136
134
 
137
135
  end
138
136
  end
139
- end
137
+ end
@@ -1,5 +1,5 @@
1
1
  #:nodoc:
2
2
  module Asana
3
3
  # Public: Version of the gem.
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.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.5.0
4
+ version: 0.6.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-12-03 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -160,6 +160,8 @@ files:
160
160
  - lib/asana/resource_includes/response_helper.rb
161
161
  - lib/asana/resources.rb
162
162
  - lib/asana/resources/attachment.rb
163
+ - lib/asana/resources/custom_field_settings.rb
164
+ - lib/asana/resources/custom_fields.rb
163
165
  - lib/asana/resources/project.rb
164
166
  - lib/asana/resources/story.rb
165
167
  - lib/asana/resources/tag.rb