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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7e067666054f042bfbbc6c06ba9dc0097be619f6091ee77e4c2cfb8667deead
4
- data.tar.gz: 44858543741b3d8c5e421159eb0c170f830299eea6c8897cc91e61149a2adce5
3
+ metadata.gz: a2da63e8aadca7da78829e16acbf420934d8c39c63eaf2b761c931a84ba84c75
4
+ data.tar.gz: 5abf90728ebbd012b700bce472dd29e00307218062c6faa8865c151949e7b3db
5
5
  SHA512:
6
- metadata.gz: 2fcac1831ce273584e5c486793d56fe9c671ef5244d316cd41b3b5092e61c1593c9e47447653237a69e30225908e27f8842a0a5e318fdabbcfd5760e2fe62d4c
7
- data.tar.gz: bec2326ce354996184af94806f8da9bf6120fa0f4c3d17c9f494f8d635a2010214c8a2e2e80c200423e73af449cd3799e73499cf93b23b5143a434f70c4a0a44
6
+ metadata.gz: 2bddb470b53a632fe92412e174c958abfcafa75565b771991864567d3627bdde4560c9082fe46793a3926e32c75a3d913306e2979733a730f2018b424a797298
7
+ data.tar.gz: 6db94c479e44de7fa283a76fd41db46db547bf30d743fbc1b842a715226fa544bea0fef7498c396b2fbbbeefaea06d17ec55433d511c507ce0bfb989413e63cb
@@ -0,0 +1,4 @@
1
+ # Swagger Codegen Ignore
2
+
3
+ docs/*
4
+ test/*
data/README.md CHANGED
@@ -413,7 +413,7 @@ to make a release, as they'll need to run a release script from the
413
413
  4. Push to the branch (`git push origin my-new-feature`)
414
414
  5. Create a new Pull Request
415
415
 
416
- [apidocs]: https://asana.com/developers
417
- [io]: https://asana.com/developers/documentation/getting-started/input-output-options
416
+ [apidocs]: https://developers.asana.com/docs
417
+ [io]: https://developers.asana.com/docs/#input-output-options
418
418
  [docs]: http://www.rubydoc.info/github/Asana/ruby-asana/master
419
419
  [meta]: https://github.com/asana/asana-api-meta
@@ -108,11 +108,17 @@ module Asana
108
108
  #
109
109
  # resource_uri - [String] the resource URI relative to the base Asana API
110
110
  # URL, e.g "/tags".
111
+ # options - [Hash] the request I/O options
111
112
  #
112
113
  # Returns an [Asana::HttpClient::Response] if everything went well.
113
114
  # Raises [Asana::Errors::APIError] if anything went wrong.
114
- def delete(resource_uri)
115
- perform_request(:delete, resource_uri)
115
+ def delete(resource_uri, params: {}, options: {})
116
+ opts = options.reduce({}) do |acc, (k, v)|
117
+ acc.tap do |hash|
118
+ hash[:"opt_#{k}"] = v.is_a?(Array) ? v.join(',') : v
119
+ end
120
+ end
121
+ perform_request(:delete, resource_uri, params.merge(opts), options[:headers])
116
122
  end
117
123
 
118
124
  private
@@ -36,6 +36,11 @@ module Asana
36
36
  end
37
37
  end
38
38
 
39
+ # Public: Returns the last item in the collection.
40
+ def last
41
+ @elements.last
42
+ end
43
+
39
44
  # Public: Returns the size of the collection.
40
45
  def size
41
46
  to_a.size
@@ -9,10 +9,6 @@ module Asana
9
9
  include ResponseHelper
10
10
  extend ResponseHelper
11
11
 
12
- def self.inherited(base)
13
- Registry.register(base)
14
- end
15
-
16
12
  def initialize(data, client: required('client'))
17
13
  @_client = client
18
14
  @_data = data
@@ -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/attachments_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
6
5
  # An _attachment_ object represents any file attached to a task in Asana,
7
6
  # whether it's an uploaded file or one associated via a third-party service
8
7
  # such as Dropbox or Google Drive.
9
- class Attachment < Resource
8
+ class Attachment < AttachmentsBase
10
9
 
11
10
 
12
- attr_reader :id
13
-
14
11
  attr_reader :gid
15
12
 
16
13
  attr_reader :resource_type
@@ -0,0 +1,15 @@
1
+ require_relative 'gen/batch_api_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class BatchAPI < BatchAPIBase
6
+
7
+ class << self
8
+ # Returns the plural name of the resource.
9
+ def plural_name
10
+ 'batch_apis'
11
+ end
12
+ end
13
+ end
14
+ end
15
+ 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/custom_field_settings_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -9,11 +8,9 @@ module Asana
9
8
  # stores information that is relevant to that particular pairing; for instance,
10
9
  # the `is_important` property determines some possible application-specific
11
10
  # handling of that custom field and parent.
12
- class CustomFieldSetting < Resource
11
+ class CustomFieldSetting < CustomFieldSettingsBase
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/custom_fields_base'
3
2
 
4
3
  module Asana
5
4
  module Resources
@@ -13,11 +12,9 @@ module Asana
13
12
  # fields](/guide/help/premium/custom-fields#gl-lock-fields), which will make
14
13
  # them read-only when accessed by other users. Attempting to edit a locked
15
14
  # custom field will return HTTP error code `403 Forbidden`.
16
- class CustomField < Resource
15
+ class CustomField < CustomFieldsBase
17
16
 
18
17
 
19
- attr_reader :id
20
-
21
18
  attr_reader :gid
22
19
 
23
20
  attr_reader :resource_type
@@ -0,0 +1,28 @@
1
+ require_relative 'gen/events_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class EventResponse < EventsBase
6
+
7
+
8
+ attr_reader :user
9
+
10
+ attr_reader :resource
11
+
12
+ attr_reader :type
13
+
14
+ attr_reader :action
15
+
16
+ attr_reader :parent
17
+
18
+ attr_reader :created_at
19
+
20
+ class << self
21
+ # Returns the plural name of the resource.
22
+ def plural_name
23
+ 'event_responses'
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,56 @@
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 AttachmentsBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Delete an attachment
16
+ #
17
+ # attachment_gid - [str] (required) Globally unique identifier for the attachment.
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
+ def delete_attachment(client, attachment_gid: required("attachment_gid"), options: {})
22
+ path = "/attachments/{attachment_gid}"
23
+ path["{attachment_gid}"] = attachment_gid
24
+ parse(client.delete(path, options: options)).first
25
+ end
26
+
27
+ # Get an attachment
28
+ #
29
+ # attachment_gid - [str] (required) Globally unique identifier for the attachment.
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 get_attachment(client, attachment_gid: required("attachment_gid"), options: {})
34
+ path = "/attachments/{attachment_gid}"
35
+ path["{attachment_gid}"] = attachment_gid
36
+ Attachment.new(parse(client.get(path, options: options)).first, client: client)
37
+ end
38
+
39
+ # Get attachments for a task
40
+ #
41
+ # task_gid - [str] (required) The task to operate on.
42
+ # options - [Hash] the request I/O options
43
+ # > 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.'
44
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
45
+ # > 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.
46
+ # > 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.
47
+ def get_attachments_for_task(client, task_gid: required("task_gid"), options: {})
48
+ path = "/tasks/{task_gid}/attachments"
49
+ path["{task_gid}"] = task_gid
50
+ Collection.new(parse(client.get(path, options: options)), type: Attachment, client: client)
51
+ end
52
+
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,30 @@
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 BatchAPIBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Submit parallel requests
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_batch_request(client, options: {}, **data)
23
+ path = "/batch"
24
+ Collection.new(parse(client.post(path, body: data, options: options)), type: Resource, client: client)
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,46 @@
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 CustomFieldSettingsBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Get a portfolio's custom fields
16
+ #
17
+ # portfolio_gid - [str] (required) Globally unique identifier for the portfolio.
18
+ # options - [Hash] the request I/O options
19
+ # > 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.'
20
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
21
+ # > 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.
22
+ # > 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.
23
+ def get_custom_field_settings_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {})
24
+ path = "/portfolios/{portfolio_gid}/custom_field_settings"
25
+ path["{portfolio_gid}"] = portfolio_gid
26
+ Collection.new(parse(client.get(path, options: options)), type: CustomFieldSetting, client: client)
27
+ end
28
+
29
+ # Get a project's custom fields
30
+ #
31
+ # project_gid - [str] (required) Globally unique identifier for the project.
32
+ # options - [Hash] the request I/O options
33
+ # > 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.'
34
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
35
+ # > 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.
36
+ # > 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.
37
+ def get_custom_field_settings_for_project(client, project_gid: required("project_gid"), options: {})
38
+ path = "/projects/{project_gid}/custom_field_settings"
39
+ path["{project_gid}"] = project_gid
40
+ Collection.new(parse(client.get(path, options: options)), type: CustomFieldSetting, client: client)
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,124 @@
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 CustomFieldsBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Create a custom field
16
+ #
17
+
18
+ # options - [Hash] the request I/O options
19
+ # > 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.'
20
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
21
+ # > 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.
22
+ # > 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.
23
+ # data - [Hash] the attributes to POST
24
+ def create_custom_field(client, options: {}, **data)
25
+ path = "/custom_fields"
26
+ CustomField.new(parse(client.post(path, body: data, options: options)).first, client: client)
27
+ end
28
+
29
+ # Create an enum option
30
+ #
31
+ # custom_field_gid - [str] (required) Globally unique identifier for the custom field.
32
+ # options - [Hash] the request I/O options
33
+ # > 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.'
34
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
35
+ # > 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.
36
+ # > 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.
37
+ # data - [Hash] the attributes to POST
38
+ def create_enum_option_for_custom_field(client, custom_field_gid: required("custom_field_gid"), options: {}, **data)
39
+ path = "/custom_fields/{custom_field_gid}/enum_options"
40
+ path["{custom_field_gid}"] = custom_field_gid
41
+ parse(client.post(path, body: data, options: options)).first
42
+ end
43
+
44
+ # Delete a custom field
45
+ #
46
+ # custom_field_gid - [str] (required) Globally unique identifier for the custom field.
47
+ # options - [Hash] the request I/O options
48
+ # > 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.
49
+ # > 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.
50
+ def delete_custom_field(client, custom_field_gid: required("custom_field_gid"), options: {})
51
+ path = "/custom_fields/{custom_field_gid}"
52
+ path["{custom_field_gid}"] = custom_field_gid
53
+ parse(client.delete(path, options: options)).first
54
+ end
55
+
56
+ # Get a custom field
57
+ #
58
+ # custom_field_gid - [str] (required) Globally unique identifier for the custom field.
59
+ # options - [Hash] the request I/O options
60
+ # > 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.
61
+ # > 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.
62
+ def get_custom_field(client, custom_field_gid: required("custom_field_gid"), options: {})
63
+ path = "/custom_fields/{custom_field_gid}"
64
+ path["{custom_field_gid}"] = custom_field_gid
65
+ CustomField.new(parse(client.get(path, options: options)).first, client: client)
66
+ end
67
+
68
+ # Get a workspace's custom fields
69
+ #
70
+ # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
71
+ # options - [Hash] the request I/O options
72
+ # > 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.'
73
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
74
+ # > 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.
75
+ # > 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.
76
+ def get_custom_fields_for_workspace(client, workspace_gid: required("workspace_gid"), options: {})
77
+ path = "/workspaces/{workspace_gid}/custom_fields"
78
+ path["{workspace_gid}"] = workspace_gid
79
+ Collection.new(parse(client.get(path, options: options)), type: CustomField, client: client)
80
+ end
81
+
82
+ # Reorder a custom field's enum
83
+ #
84
+ # custom_field_gid - [str] (required) Globally unique identifier for the custom field.
85
+ # options - [Hash] the request I/O options
86
+ # > 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.
87
+ # > 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.
88
+ # data - [Hash] the attributes to POST
89
+ def insert_enum_option_for_custom_field(client, custom_field_gid: required("custom_field_gid"), options: {}, **data)
90
+ path = "/custom_fields/{custom_field_gid}/enum_options/insert"
91
+ path["{custom_field_gid}"] = custom_field_gid
92
+ parse(client.post(path, body: data, options: options)).first
93
+ end
94
+
95
+ # Update a custom field
96
+ #
97
+ # custom_field_gid - [str] (required) Globally unique identifier for the custom field.
98
+ # options - [Hash] the request I/O options
99
+ # > 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.
100
+ # > 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.
101
+ # data - [Hash] the attributes to PUT
102
+ def update_custom_field(client, custom_field_gid: required("custom_field_gid"), options: {}, **data)
103
+ path = "/custom_fields/{custom_field_gid}"
104
+ path["{custom_field_gid}"] = custom_field_gid
105
+ CustomField.new(parse(client.put(path, body: data, options: options)).first, client: client)
106
+ end
107
+
108
+ # Update an enum option
109
+ #
110
+ # enum_option_gid - [str] (required) Globally unique identifier for the enum option.
111
+ # options - [Hash] the request I/O options
112
+ # > 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.
113
+ # > 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.
114
+ # data - [Hash] the attributes to PUT
115
+ def update_enum_option(client, enum_option_gid: required("enum_option_gid"), options: {}, **data)
116
+ path = "/enum_options/{enum_option_gid}"
117
+ path["{enum_option_gid}"] = enum_option_gid
118
+ parse(client.put(path, body: data, options: options)).first
119
+ end
120
+
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,32 @@
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 EventsBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Get events on a resource
16
+ #
17
+
18
+ # resource - [str] (required) A resource ID to subscribe to. The resource can be a task or project.
19
+ # sync - [str] A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.*
20
+ # options - [Hash] the request I/O options
21
+ # > 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.
22
+ # > 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.
23
+ def get_events(client, resource: nil, sync: nil, options: {})
24
+ path = "/events"
25
+ params = { resource: resource, sync: sync }.reject { |_,v| v.nil? || Array(v).empty? }
26
+ Collection.new(parse(client.get(path, params: params, options: options)), type: Resource, client: client)
27
+ end
28
+
29
+ end
30
+ end
31
+ end
32
+ end