Module: Highrise::HasSubjectData

Included in:
Person
Defined in:
lib/highrise/has_subject_data.rb

Instance Method Summary collapse

Instance Method Details

#field(field_name) ⇒ Object



12
13
14
15
16
# File 'lib/highrise/has_subject_data.rb', line 12

def field(field_name)
  (attributes["subject_datas"] || []).detect do |sd|
    sd.subject_field_label == field_name.to_s
  end
end

#subject_data_hashObject



4
5
6
7
8
9
10
# File 'lib/highrise/has_subject_data.rb', line 4

def subject_data_hash
  if attributes.has_key?(:subject_datas)
    Hash[subject_datas.map(&:attributes).map {|attrs| [attrs[:subject_field_label].to_s.underscore, attrs[:value]] }]
  else
    {}
  end
end