Method: TentD::Model::Follower.create_follower

Defined in:
lib/tentd/model/follower.rb

.create_follower(data, authorized_scopes = []) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/tentd/model/follower.rb', line 38

def self.create_follower(data, authorized_scopes = [])
  if authorized_scopes.include?(:write_followers) && authorized_scopes.include?(:write_secrets)
    follower = create(data.slice(:entity, :groups, :public, :profile, :licenses, :notification_path, :mac_key_id, :mac_key, :mac_algorithm, :mac_timestamp_delta))
  else
    follower = create(data.slice('entity', 'licenses', 'profile', 'notification_path'))
  end
  (data.types || ['all']).each do |type_url|
    follower.notification_subscriptions.create(:type => type_url)
  end
  follower
end