asana 0.9.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.swagger-codegen-ignore +4 -0
  3. data/README.md +2 -2
  4. data/lib/asana/http_client.rb +8 -2
  5. data/lib/asana/resource_includes/collection.rb +5 -0
  6. data/lib/asana/resource_includes/resource.rb +0 -4
  7. data/lib/asana/resources/attachment.rb +2 -5
  8. data/lib/asana/resources/batch_api.rb +15 -0
  9. data/lib/asana/resources/custom_field_settings.rb +2 -5
  10. data/lib/asana/resources/custom_fields.rb +2 -5
  11. data/lib/asana/resources/events.rb +28 -0
  12. data/lib/asana/resources/gen/attachments_base.rb +56 -0
  13. data/lib/asana/resources/gen/batch_api_base.rb +30 -0
  14. data/lib/asana/resources/gen/custom_field_settings_base.rb +46 -0
  15. data/lib/asana/resources/gen/custom_fields_base.rb +124 -0
  16. data/lib/asana/resources/gen/events_base.rb +32 -0
  17. data/lib/asana/resources/gen/jobs_base.rb +30 -0
  18. data/lib/asana/resources/gen/organization_exports_base.rb +44 -0
  19. data/lib/asana/resources/gen/portfolio_memberships_base.rb +63 -0
  20. data/lib/asana/resources/gen/portfolios_base.rb +173 -0
  21. data/lib/asana/resources/gen/project_memberships_base.rb +46 -0
  22. data/lib/asana/resources/gen/project_statuses_base.rb +69 -0
  23. data/lib/asana/resources/gen/projects_base.rb +259 -0
  24. data/lib/asana/resources/gen/sections_base.rb +108 -0
  25. data/lib/asana/resources/gen/stories_base.rb +84 -0
  26. data/lib/asana/resources/gen/tags_base.rb +116 -0
  27. data/lib/asana/resources/gen/tasks_base.rb +424 -0
  28. data/lib/asana/resources/gen/team_memberships_base.rb +77 -0
  29. data/lib/asana/resources/gen/teams_base.rb +88 -0
  30. data/lib/asana/resources/gen/typeahead_base.rb +35 -0
  31. data/lib/asana/resources/gen/user_task_lists_base.rb +44 -0
  32. data/lib/asana/resources/gen/users_base.rb +88 -0
  33. data/lib/asana/resources/gen/webhooks_base.rb +70 -0
  34. data/lib/asana/resources/gen/workspace_memberships_base.rb +60 -0
  35. data/lib/asana/resources/gen/workspaces_base.rb +82 -0
  36. data/lib/asana/resources/job.rb +2 -3
  37. data/lib/asana/resources/organization_export.rb +2 -5
  38. data/lib/asana/resources/portfolio.rb +2 -5
  39. data/lib/asana/resources/portfolio_membership.rb +2 -5
  40. data/lib/asana/resources/project.rb +2 -5
  41. data/lib/asana/resources/project_membership.rb +2 -5
  42. data/lib/asana/resources/project_status.rb +2 -5
  43. data/lib/asana/resources/section.rb +18 -22
  44. data/lib/asana/resources/story.rb +2 -5
  45. data/lib/asana/resources/tag.rb +2 -5
  46. data/lib/asana/resources/task.rb +2 -5
  47. data/lib/asana/resources/team.rb +2 -5
  48. data/lib/asana/resources/team_membership.rb +26 -0
  49. data/lib/asana/resources/typeahead.rb +22 -0
  50. data/lib/asana/resources/user.rb +2 -5
  51. data/lib/asana/resources/user_task_list.rb +2 -5
  52. data/lib/asana/resources/webhook.rb +2 -5
  53. data/lib/asana/resources/workspace.rb +2 -6
  54. data/lib/asana/resources/workspace_membership.rb +32 -0
  55. data/lib/asana/version.rb +1 -1
  56. data/swagger_templates/api.mustache +41 -0
  57. data/swagger_templates/ruby-config.json +7 -0
  58. metadata +34 -2
@@ -0,0 +1,82 @@
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 WorkspacesBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Add a user to a workspace or organization
16
+ #
17
+ # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
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 add_user_for_workspace(client, workspace_gid: required("workspace_gid"), options: {}, **data)
23
+ path = "/workspaces/{workspace_gid}/addUser"
24
+ path["{workspace_gid}"] = workspace_gid
25
+ User.new(parse(client.post(path, body: data, options: options)).first, client: client)
26
+ end
27
+
28
+ # Get a workspace
29
+ #
30
+ # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
31
+ # options - [Hash] the request I/O options
32
+ # > 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.
33
+ # > 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.
34
+ def get_workspace(client, workspace_gid: required("workspace_gid"), options: {})
35
+ path = "/workspaces/{workspace_gid}"
36
+ path["{workspace_gid}"] = workspace_gid
37
+ Workspace.new(parse(client.get(path, options: options)).first, client: client)
38
+ end
39
+
40
+ # Get multiple workspaces
41
+ #
42
+
43
+ # options - [Hash] the request I/O options
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
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
46
+ # > 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.
47
+ # > 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.
48
+ def get_workspaces(client, options: {})
49
+ path = "/workspaces"
50
+ Collection.new(parse(client.get(path, options: options)), type: Workspace, client: client)
51
+ end
52
+
53
+ # Remove a user from a workspace or organization
54
+ #
55
+ # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
56
+ # options - [Hash] the request I/O options
57
+ # > 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.
58
+ # > 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.
59
+ # data - [Hash] the attributes to POST
60
+ def remove_user_for_workspace(client, workspace_gid: required("workspace_gid"), options: {}, **data)
61
+ path = "/workspaces/{workspace_gid}/removeUser"
62
+ path["{workspace_gid}"] = workspace_gid
63
+ parse(client.post(path, body: data, options: options)).first
64
+ end
65
+
66
+ # Update a workspace
67
+ #
68
+ # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
69
+ # options - [Hash] the request I/O options
70
+ # > 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.
71
+ # > 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.
72
+ # data - [Hash] the attributes to PUT
73
+ def update_workspace(client, workspace_gid: required("workspace_gid"), options: {}, **data)
74
+ path = "/workspaces/{workspace_gid}"
75
+ path["{workspace_gid}"] = workspace_gid
76
+ Workspace.new(parse(client.put(path, body: data, options: options)).first, client: client)
77
+ end
78
+
79
+ end
80
+ end
81
+ end
82
+ end
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/jobs_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -7,7 +6,7 @@ module Asana
7
6
  #
8
7
  # Jobs are created when an endpoint requests an action that will be handled asynchronously.
9
8
  # Such as project or task duplication.
10
- class Job < Resource
9
+ class Job < JobsBase
11
10
 
12
11
 
13
12
  attr_reader :gid
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/organization_exports_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -16,11 +15,9 @@ module Asana
16
15
  #
17
16
  # **Note:** These endpoints are only available to [Service Accounts](/guide/help/premium/service-accounts)
18
17
  # of an [Enterprise](/enterprise) Organization.
19
- class OrganizationExport < Resource
18
+ class OrganizationExport < OrganizationExportsBase
20
19
 
21
20
 
22
- attr_reader :id
23
-
24
21
  attr_reader :gid
25
22
 
26
23
  attr_reader :created_at
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/portfolios_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -10,11 +9,9 @@ module Asana
10
9
  #
11
10
  # Portfolios have some restrictions on size. Each portfolio has a maximum of 250
12
11
  # items and, like projects, a maximum of 20 custom fields.
13
- class Portfolio < Resource
12
+ class Portfolio < PortfoliosBase
14
13
 
15
14
 
16
- attr_reader :id
17
-
18
15
  attr_reader :gid
19
16
 
20
17
  attr_reader :resource_type
@@ -1,14 +1,11 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/portfolio_memberships_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
6
5
  # This object determines if a user is a member of a portfolio.
7
- class PortfolioMembership < Resource
6
+ class PortfolioMembership < PortfolioMembershipsBase
8
7
 
9
8
 
10
- attr_reader :id
11
-
12
9
  attr_reader :gid
13
10
 
14
11
  attr_reader :resource_type
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/projects_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -12,13 +11,11 @@ module Asana
12
11
  # change the team of a project via the API. Non-organization workspaces do not
13
12
  # have teams and so you should not specify the team of project in a regular
14
13
  # workspace.
15
- class Project < Resource
14
+ class Project < ProjectsBase
16
15
 
17
16
  include EventSubscription
18
17
 
19
18
 
20
- attr_reader :id
21
-
22
19
  attr_reader :gid
23
20
 
24
21
  attr_reader :resource_type
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/project_memberships_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -7,11 +6,9 @@ module Asana
7
6
  # in a project comes with associated permissions. These permissions (whether a
8
7
  # user has full access to the project or comment-only access) are accessible
9
8
  # through the project memberships endpoints described here.
10
- class ProjectMembership < Resource
9
+ class ProjectMembership < ProjectMembershipsBase
11
10
 
12
11
 
13
- attr_reader :id
14
-
15
12
  attr_reader :gid
16
13
 
17
14
  attr_reader :resource_type
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/project_statuses_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -9,11 +8,9 @@ module Asana
9
8
  # at risk, and "red" for projects that are behind.
10
9
  #
11
10
  # Project statuses can be created and deleted, but not modified.
12
- class ProjectStatus < Resource
11
+ class ProjectStatus < ProjectStatusesBase
13
12
 
14
13
 
15
- attr_reader :id
16
-
17
14
  attr_reader :gid
18
15
 
19
16
  attr_reader :resource_type
@@ -1,16 +1,13 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/sections_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
6
5
  # A _section_ is a subdivision of a project that groups tasks together. It can
7
6
  # either be a header above a list of tasks in a list view or a column in a
8
7
  # board view of a project.
9
- class Section < Resource
8
+ class Section < SectionsBase
10
9
 
11
10
 
12
- attr_reader :id
13
-
14
11
  attr_reader :gid
15
12
 
16
13
  attr_reader :resource_type
@@ -56,23 +53,7 @@ module Asana
56
53
  # options - [Hash] the request I/O options.
57
54
  def find_by_id(client, id, options: {})
58
55
 
59
- self.new(parse(client.get("/sections/#{id}", options: options)).first, client: client)
60
- end
61
-
62
- # Add a task to a specific, existing section. This will remove the task from other sections of the project.
63
- #
64
- # The task will be inserted at the top of a section unless an `insert_before` or `insert_after` parameter is declared.
65
- #
66
- # This does not work for separators (tasks with the `resource_subtype` of section).
67
- #
68
- # task - [Gid] The task to add to this section
69
- # insert_before - [Gid] Insert the given task immediately before the task specified by this parameter. Cannot be provided together with `insert_after`.
70
- # insert_after - [Gid] Insert the given task immediately after the task specified by this parameter. Cannot be provided together with `insert_before`.
71
- # options - [Hash] the request I/O options.
72
- # data - [Hash] the attributes to post.
73
- def add_task(client, task: required("task"), insert_before: nil, insert_after: nil, options: {}, **data)
74
- with_params = data.merge(insert_before: insert_before, insert_after: insert_after).reject { |_,v| v.nil? || Array(v).empty? }
75
- Task.new(parse(client.post("/sections/#{task}/addTask", body: with_params, options: options)).first, client: client)
56
+ self.new(parse(client.get("/sections/#{gid}", options: options)).first, client: client)
76
57
  end
77
58
  end
78
59
 
@@ -107,6 +88,21 @@ module Asana
107
88
  client.delete("/sections/#{gid}") && true
108
89
  end
109
90
 
91
+ # Add a task to a specific, existing section. This will remove the task from other sections of the project.
92
+ #
93
+ # The task will be inserted at the top of a section unless an `insert_before` or `insert_after` parameter is declared.
94
+ #
95
+ # This does not work for separators (tasks with the `resource_subtype` of section).
96
+ #
97
+ # insert_before - [Gid] Insert the given task immediately before the task specified by this parameter. Cannot be provided together with `insert_after`.
98
+ # insert_after - [Gid] Insert the given task immediately after the task specified by this parameter. Cannot be provided together with `insert_before`.
99
+ # options - [Hash] the request I/O options.
100
+ # data - [Hash] the attributes to post.
101
+ def add_task(insert_before: nil, insert_after: nil, options: {}, **data)
102
+ with_params = data.merge(insert_before: insert_before, insert_after: insert_after).reject { |_,v| v.nil? || Array(v).empty? }
103
+ Task.new(parse(client.post("/sections/#{gid}/addTask", body: with_params, options: options)).first, client: client)
104
+ end
105
+
110
106
  # Move sections relative to each other in a board view. One of
111
107
  # `before_section` or `after_section` is required.
112
108
  #
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/stories_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -7,11 +6,9 @@ module Asana
7
6
  # system. Stories are generated by the system whenever users take actions such
8
7
  # as creating or assigning tasks, or moving tasks between projects. _Comments_
9
8
  # are also a form of user-generated story.
10
- class Story < Resource
9
+ class Story < StoriesBase
11
10
 
12
11
 
13
- attr_reader :id
14
-
15
12
  attr_reader :gid
16
13
 
17
14
  attr_reader :resource_type
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/tags_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -10,11 +9,9 @@ module Asana
10
9
  # simplify them in the future so it is not encouraged to rely too heavily on it.
11
10
  # Unlike projects, tags do not provide any ordering on the tasks they
12
11
  # are associated with.
13
- class Tag < Resource
12
+ class Tag < TagsBase
14
13
 
15
14
 
16
- attr_reader :id
17
-
18
15
  attr_reader :gid
19
16
 
20
17
  attr_reader :resource_type
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/tasks_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -7,15 +6,13 @@ module Asana
7
6
  # centered. In the Asana application, multiple tasks populate the middle pane
8
7
  # according to some view parameters, and the set of selected tasks determines
9
8
  # the more detailed information presented in the details pane.
10
- class Task < Resource
9
+ class Task < TasksBase
11
10
 
12
11
  include AttachmentUploading
13
12
 
14
13
  include EventSubscription
15
14
 
16
15
 
17
- attr_reader :id
18
-
19
16
  attr_reader :gid
20
17
 
21
18
  attr_reader :resource_type
@@ -1,15 +1,12 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/teams_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
6
5
  # A _team_ is used to group related projects and people together within an
7
6
  # organization. Each project in an organization is associated with a team.
8
- class Team < Resource
7
+ class Team < TeamsBase
9
8
 
10
9
 
11
- attr_reader :id
12
-
13
10
  attr_reader :gid
14
11
 
15
12
  attr_reader :resource_type
@@ -0,0 +1,26 @@
1
+ require_relative 'gen/team_memberships_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class TeamMembership < TeamMembershipsBase
6
+
7
+
8
+ attr_reader :gid
9
+
10
+ attr_reader :resource_type
11
+
12
+ attr_reader :user
13
+
14
+ attr_reader :team
15
+
16
+ attr_reader :is_guest
17
+
18
+ class << self
19
+ # Returns the plural name of the resource.
20
+ def plural_name
21
+ 'team_memberships'
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ require_relative 'gen/typeahead_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class Typeahead < TypeaheadBase
6
+
7
+
8
+ attr_reader :gid
9
+
10
+ attr_reader :resource_type
11
+
12
+ attr_reader :name
13
+
14
+ class << self
15
+ # Returns the plural name of the resource.
16
+ def plural_name
17
+ 'typeaheads'
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/users_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -9,11 +8,9 @@ module Asana
9
8
  # Like other objects in the system, users are referred to by numerical IDs.
10
9
  # However, the special string identifier `me` can be used anywhere
11
10
  # a user ID is accepted, to refer to the current authenticated user.
12
- class User < Resource
11
+ class User < UsersBase
13
12
 
14
13
 
15
- attr_reader :id
16
-
17
14
  attr_reader :gid
18
15
 
19
16
  attr_reader :resource_type
@@ -1,5 +1,4 @@
1
- ### WARNING: This file is auto-generated by the asana-api-meta repo. Do not
2
- ### edit it manually.
1
+ require_relative 'gen/user_task_lists_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -14,11 +13,9 @@ module Asana
14
13
  # approach; read up on [task
15
14
  # auto-promotion](/guide/help/fundamentals/my-tasks#gl-auto-promote) for more
16
15
  # infomation.
17
- class UserTaskList < Resource
16
+ class UserTaskList < UserTaskListsBase
18
17
 
19
18
 
20
- attr_reader :id
21
-
22
19
  attr_reader :gid
23
20
 
24
21
  attr_reader :resource_type