Class: Spaceship::Tunes::Members

Inherits:
TunesBase show all
Defined in:
spaceship/lib/spaceship/tunes/members.rb

Instance Attribute Summary

Attributes inherited from Base

#client, #raw_data

Class Method Summary collapse

Methods inherited from TunesBase

client

Methods inherited from Base

attr_accessor, attr_mapping, attributes, #attributes, factory, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s

Constructor Details

This class inherits a constructor from Spaceship::Base

Class Method Details

.allObject



7
8
9
10
11
12
13
14
# File 'spaceship/lib/spaceship/tunes/members.rb', line 7

def all
  response = client.members
  return_members = []
  response.each  do |member|
    return_members << Tunes::Member.factory(member)
  end
  return_members
end

.create!(firstname: nil, lastname: nil, email_address: nil, roles: [], apps: []) ⇒ Object



25
26
27
# File 'spaceship/lib/spaceship/tunes/members.rb', line 25

def create!(firstname: nil, lastname: nil, email_address: nil, roles: [], apps: [])
  client.create_member!(firstname: firstname, lastname: lastname, email_address: email_address, roles: roles, apps: apps)
end

.find(email) ⇒ Object



16
17
18
19
20
21
22
23
# File 'spaceship/lib/spaceship/tunes/members.rb', line 16

def find(email)
  all.each do |member|
    if member.email_address.casecmp?(email)
      return member
    end
  end
  return nil
end

.update_member_roles!(member, roles: [], apps: []) ⇒ Object



29
30
31
# File 'spaceship/lib/spaceship/tunes/members.rb', line 29

def update_member_roles!(member, roles: [], apps: [])
  client.update_member_roles!(member, roles: roles, apps: apps)
end