Class: PipedriveJetrockets::FieldService

Inherits:
Service
  • Object
show all
Defined in:
lib/pipedrive_jetrockets/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, #update

Constructor Details

#initialize(resource_name) ⇒ FieldService

Returns a new instance of FieldService.



5
6
7
# File 'lib/pipedrive_jetrockets/field_service.rb', line 5

def initialize(resource_name)
  @resource_name = resource_name
end

Instance Method Details

#key_field_hashObject



9
10
11
# File 'lib/pipedrive_jetrockets/field_service.rb', line 9

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



13
14
15
# File 'lib/pipedrive_jetrockets/field_service.rb', line 13

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



17
18
19
# File 'lib/pipedrive_jetrockets/field_service.rb', line 17

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