Class: PipedriveJetrockets::FieldService
- 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
-
#initialize(resource_name) ⇒ FieldService
constructor
A new instance of FieldService.
- #key_field_hash ⇒ Object
- #key_name_hash ⇒ Object
- #name_key_hash ⇒ Object
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_hash ⇒ Object
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_hash ⇒ Object
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_hash ⇒ Object
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 |