Class: Asana::Resources::CustomFieldSetting

Inherits:
CustomFieldSettingsBase show all
Defined in:
lib/asana/resources/custom_field_settings.rb

Overview

Custom fields are applied to a particular project or portfolio with the Custom Field Settings resource. This resource both represents the many-to-many join of the Custom Field and Project or Portfolio as well as stores information that is relevant to that particular pairing; for instance, the ‘is_important` property determines some possible application-specific handling of that custom field and parent.

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from CustomFieldSettingsBase

get_custom_field_settings_for_portfolio, get_custom_field_settings_for_project, inherited

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

Instance Attribute Details

#created_atObject (readonly)



18
19
20
# File 'lib/asana/resources/custom_field_settings.rb', line 18

def created_at
  @created_at
end

#custom_fieldObject (readonly)



26
27
28
# File 'lib/asana/resources/custom_field_settings.rb', line 26

def custom_field
  @custom_field
end

#gidObject (readonly)



14
15
16
# File 'lib/asana/resources/custom_field_settings.rb', line 14

def gid
  @gid
end

#is_importantObject (readonly)



20
21
22
# File 'lib/asana/resources/custom_field_settings.rb', line 20

def is_important
  @is_important
end

#parentObject (readonly)



22
23
24
# File 'lib/asana/resources/custom_field_settings.rb', line 22

def parent
  @parent
end

#projectObject (readonly)



24
25
26
# File 'lib/asana/resources/custom_field_settings.rb', line 24

def project
  @project
end

#resource_typeObject (readonly)



16
17
18
# File 'lib/asana/resources/custom_field_settings.rb', line 16

def resource_type
  @resource_type
end

Class Method Details

.find_by_portfolio(client, portfolio: required("portfolio"), per_page: 20, options: {}) ⇒ Object

Returns a list of all of the custom fields settings on a portfolio.

Parameters:

  • portfolio (Gid) (defaults to: required("portfolio"))

    The ID of the portfolio for which to list custom field settings

  • per_page (Integer) (defaults to: 20)

    the number of records to fetch per page.

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

    the request I/O options.



49
50
51
52
# File 'lib/asana/resources/custom_field_settings.rb', line 49

def find_by_portfolio(client, portfolio: required("portfolio"), per_page: 20, options: {})
  params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
  Collection.new(parse(client.get("/portfolios/#{portfolio}/custom_field_settings", params: params, options: options)), type: Resource, client: client)
end

.find_by_project(client, project: required("project"), per_page: 20, options: {}) ⇒ Object

Returns a list of all of the custom fields settings on a project.

Parameters:

  • project (Gid) (defaults to: required("project"))

    The ID of the project for which to list custom field settings

  • per_page (Integer) (defaults to: 20)

    the number of records to fetch per page.

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

    the request I/O options.



39
40
41
42
# File 'lib/asana/resources/custom_field_settings.rb', line 39

def find_by_project(client, project: required("project"), per_page: 20, options: {})
  params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
  Collection.new(parse(client.get("/projects/#{project}/custom_field_settings", params: params, options: options)), type: Resource, client: client)
end

.plural_nameObject

Returns the plural name of the resource.



30
31
32
# File 'lib/asana/resources/custom_field_settings.rb', line 30

def plural_name
  'custom_field_settings'
end