Class: Asana::Resources::CustomFieldSetting

Inherits:
Resource
  • Object
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 Resource

inherited, #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)



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

def created_at
  @created_at
end

#custom_fieldObject (readonly)



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

def custom_field
  @custom_field
end

#gidObject (readonly)



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

def gid
  @gid
end

#idObject (readonly)



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

def id
  @id
end

#is_importantObject (readonly)



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

def is_important
  @is_important
end

#parentObject (readonly)



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

def parent
  @parent
end

#projectObject (readonly)



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

def project
  @project
end

#resource_typeObject (readonly)



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

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.



52
53
54
55
# File 'lib/asana/resources/custom_field_settings.rb', line 52

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.



42
43
44
45
# File 'lib/asana/resources/custom_field_settings.rb', line 42

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.



33
34
35
# File 'lib/asana/resources/custom_field_settings.rb', line 33

def plural_name
  'custom_field_settings'
end