Class: PipeRocket::Field

Inherits:
Entity
  • Object
show all
Defined in:
lib/pipe_rocket/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/pipe_rocket/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/pipe_rocket/field.rb', line 3

def is_subfield
  @is_subfield
end

#option_idObject

Returns the value of attribute option_id.



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

def option_id
  @option_id
end

Instance Method Details

#options_hashObject

Return hash option_value



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

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

#valueObject

Return value of field



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

def value
  options_hash[option_id]
end