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



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
  parse(client.post(path, body: data, options: options)).first
end

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

Add a portfolio item



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



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
  parse(client.post(path, body: data, options: options)).first
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.



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



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



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



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.



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



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



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



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
  parse(client.post(path, body: data, options: options)).first
end

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

Update a portfolio



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