Class: PipeRocket::FieldService

Inherits:
Service
  • Object
show all
Defined in:
lib/pipe_rocket/field_service.rb

Constant Summary collapse

HOST =
'https://api.pipedrive.com/v1'

Constants inherited from Service

Service::RESOURCES_WITH_CUSTOM_FIELDS

Instance Method Summary collapse

Methods inherited from Service

#all, #build_entity, #build_uri, #create, #find, #first, #initialize, #update

Constructor Details

This class inherits a constructor from PipeRocket::Service

Instance Method Details

#key_field_hashObject

Returns hash PipeRocket::Field object



6
7
8
# File 'lib/pipe_rocket/field_service.rb', line 6

def key_field_hash
  Pipedrive.send("#{@resource_name.split(/(?=[A-Z])/).first}_fields").all.select{|field|field.edit_flag || field.is_subfield}.map{|field|{field.key => field}}.inject(:merge) || {}
end

#key_name_hashObject

Returns hash custom_field_name



11
12
13
# File 'lib/pipe_rocket/field_service.rb', line 11

def key_name_hash
  Pipedrive.send("#{@resource_name.split(/(?=[A-Z])/).first}_fields").all.select{|field|field.edit_flag || field.is_subfield}.map{|field|{field.key => field.name}}.inject(:merge) || {}
end

#name_key_hashObject

Returns hash custom_field_key



16
17
18
# File 'lib/pipe_rocket/field_service.rb', line 16

def name_key_hash
  Pipedrive.send("#{@resource_name.split(/(?=[A-Z])/).first}_fields").all.select{|field|field.edit_flag || field.is_subfield}.map{|field|{field.name => field.key}}.inject(:merge) || {}
end