Class: Asana::Resources::PortfoliosBase

Inherits:
Resource
  • Object
show all
Defined in:
lib/asana/resources/gen/portfolios_base.rb

Direct Known Subclasses

Portfolio

Class Method Summary collapse

Methods inherited from Resource

#initialize, #method_missing, #refresh, #respond_to_missing?, #to_h, #to_s

Methods included from ResponseHelper

#parse

Constructor Details

This class inherits a constructor from Asana::Resources::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Asana::Resources::Resource

Class Method Details

.add_custom_field_setting_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data) ⇒ Object

Add a custom field to a portfolio

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • bool (>])

    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.

  • data (Hash)

    the attributes to POST



21
22
23
24
25
# File 'lib/asana/resources/gen/portfolios_base.rb', line 21

def add_custom_field_setting_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data)
  path = "/portfolios/{portfolio_gid}/addCustomFieldSetting"
  path["{portfolio_gid}"] = portfolio_gid
  CustomFieldSetting.new(parse(client.post(path, body: data, options: options)).first, client: client)
end

.add_item_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data) ⇒ Object

Add a portfolio item

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • 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.

  • bool (>])

    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.

  • data (Hash)

    the attributes to POST



34
35
36
37
38
# File 'lib/asana/resources/gen/portfolios_base.rb', line 34

def add_item_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data)
  path = "/portfolios/{portfolio_gid}/addItem"
  path["{portfolio_gid}"] = portfolio_gid
  parse(client.post(path, body: data, options: options)).first
end

.add_members_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data) ⇒ Object

Add users to a portfolio

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • 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.

  • bool (>])

    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.

  • data (Hash)

    the attributes to POST



47
48
49
50
51
# File 'lib/asana/resources/gen/portfolios_base.rb', line 47

def add_members_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data)
  path = "/portfolios/{portfolio_gid}/addMembers"
  path["{portfolio_gid}"] = portfolio_gid
  Portfolio.new(parse(client.post(path, body: data, options: options)).first, client: client)
end

.create_portfolio(client, options: {}, **data) ⇒ Object

options - [Hash] the request I/O options > opt_fields - [list] 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. > 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.

Parameters:

  • data (Hash)

    the attributes to POST



60
61
62
63
# File 'lib/asana/resources/gen/portfolios_base.rb', line 60

def create_portfolio(client, options: {}, **data)
  path = "/portfolios"
  Portfolio.new(parse(client.post(path, body: data, options: options)).first, client: client)
end

.delete_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}) ⇒ Object

Delete a portfolio

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • 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.

  • bool (>])

    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.



71
72
73
74
75
# File 'lib/asana/resources/gen/portfolios_base.rb', line 71

def delete_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {})
  path = "/portfolios/{portfolio_gid}"
  path["{portfolio_gid}"] = portfolio_gid
  parse(client.delete(path, options: options)).first
end

.get_items_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}) ⇒ Object

Get portfolio items

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • str (>]'Note: You can only pass in an offset that was returned to you via a previously paginated request.')

    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.’

  • int (>])

    limit [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.

  • 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.

  • bool (>])

    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.



85
86
87
88
89
# File 'lib/asana/resources/gen/portfolios_base.rb', line 85

def get_items_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {})
  path = "/portfolios/{portfolio_gid}/items"
  path["{portfolio_gid}"] = portfolio_gid
  Collection.new(parse(client.get(path, options: options)), type: Project, client: client)
end

.get_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}) ⇒ Object

Get a portfolio

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • 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.

  • bool (>])

    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.



97
98
99
100
101
# File 'lib/asana/resources/gen/portfolios_base.rb', line 97

def get_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {})
  path = "/portfolios/{portfolio_gid}"
  path["{portfolio_gid}"] = portfolio_gid
  Portfolio.new(parse(client.get(path, options: options)).first, client: client)
end

.get_portfolios(client, workspace: nil, owner: nil, options: {}) ⇒ Object

workspace - [str] (required) The workspace or organization to filter portfolios on.

Parameters:

  • owner (str) (defaults to: nil)

    (required) The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own.

  • options (Hash) (defaults to: {})

    the request I/O options

  • str (>]'Note: You can only pass in an offset that was returned to you via a previously paginated request.')

    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.’

  • int (>])

    limit [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.

  • 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.

  • bool (>])

    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.



113
114
115
116
117
# File 'lib/asana/resources/gen/portfolios_base.rb', line 113

def get_portfolios(client, workspace: nil, owner: nil, options: {})
  path = "/portfolios"
  params = { workspace: workspace, owner: owner }.reject { |_,v| v.nil? || Array(v).empty? }
  Collection.new(parse(client.get(path, params: params, options: options)), type: Portfolio, client: client)
end

.inherited(base) ⇒ Object



10
11
12
# File 'lib/asana/resources/gen/portfolios_base.rb', line 10

def self.inherited(base)
  Registry.register(base)
end

.remove_custom_field_setting_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data) ⇒ Object

Remove a custom field from a portfolio

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • bool (>])

    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.

  • data (Hash)

    the attributes to POST



125
126
127
128
129
# File 'lib/asana/resources/gen/portfolios_base.rb', line 125

def remove_custom_field_setting_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data)
  path = "/portfolios/{portfolio_gid}/removeCustomFieldSetting"
  path["{portfolio_gid}"] = portfolio_gid
  parse(client.post(path, body: data, options: options)).first
end

.remove_item_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data) ⇒ Object

Remove a portfolio item

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • 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.

  • bool (>])

    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.

  • data (Hash)

    the attributes to POST



138
139
140
141
142
# File 'lib/asana/resources/gen/portfolios_base.rb', line 138

def remove_item_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data)
  path = "/portfolios/{portfolio_gid}/removeItem"
  path["{portfolio_gid}"] = portfolio_gid
  parse(client.post(path, body: data, options: options)).first
end

.remove_members_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data) ⇒ Object

Remove users from a portfolio

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • 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.

  • bool (>])

    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.

  • data (Hash)

    the attributes to POST



151
152
153
154
155
# File 'lib/asana/resources/gen/portfolios_base.rb', line 151

def remove_members_for_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data)
  path = "/portfolios/{portfolio_gid}/removeMembers"
  path["{portfolio_gid}"] = portfolio_gid
  Portfolio.new(parse(client.post(path, body: data, options: options)).first, client: client)
end

.update_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data) ⇒ Object

Update a portfolio

Parameters:

  • portfolio_gid (str) (defaults to: required("portfolio_gid"))

    (required) Globally unique identifier for the portfolio.

  • options (Hash) (defaults to: {})

    the request I/O options

  • 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.

  • bool (>])

    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.

  • data (Hash)

    the attributes to PUT



164
165
166
167
168
# File 'lib/asana/resources/gen/portfolios_base.rb', line 164

def update_portfolio(client, portfolio_gid: required("portfolio_gid"), options: {}, **data)
  path = "/portfolios/{portfolio_gid}"
  path["{portfolio_gid}"] = portfolio_gid
  Portfolio.new(parse(client.put(path, body: data, options: options)).first, client: client)
end