Class: PipedriveJetrockets::Field

Inherits:
Entity
  • Object
show all
Defined in:
lib/pipedrive_jetrockets/field.rb

Direct Known Subclasses

DealField, OrganizationField, PersonField

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#assign_custom_fields, #transform_field_name

Constructor Details

#initialize(hash) ⇒ Field

Returns a new instance of Field.



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

def initialize(hash)
  super
  @is_subfield ||= false
end

Instance Attribute Details

#is_subfieldObject

Returns the value of attribute is_subfield.



3
4
5
# File 'lib/pipedrive_jetrockets/field.rb', line 3

def is_subfield
  @is_subfield
end

#option_idObject

Returns the value of attribute option_id.



3
4
5
# File 'lib/pipedrive_jetrockets/field.rb', line 3

def option_id
  @option_id
end

Instance Method Details

#options_hashObject



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

def options_hash
  return {} unless @options
  @options.map{|option|{option['id'].to_s => option['label']}}.inject(:merge)
end

#valueObject



14
15
16
# File 'lib/pipedrive_jetrockets/field.rb', line 14

def value
  options_hash[option_id]
end