Class: Shark::Group

Inherits:
Base
  • Object
show all
Extended by:
ContactService::Resource
Defined in:
lib/shark/group.rb

Instance Method Summary collapse

Methods inherited from Base

add_datetime_accessors

Instance Method Details

#contact?(contact_id) ⇒ Boolean Also known as: has_contact?

Returns:

  • (Boolean)


9
10
11
12
13
14
# File 'lib/shark/group.rb', line 9

def contact?(contact_id)
  contacts = relationships['contacts']
  return false if contacts.blank? || contacts['data'].blank?

  contacts['data'].any? { |c| c['type'] == 'contacts' && c['id'].to_s == contact_id.to_s }
end