Module: GSGraph::Connections::Invited

Included in:
Event
Defined in:
lib/gs_graph/connections/invited.rb

Instance Method Summary collapse

Instance Method Details

#invite!(*users) ⇒ Object



25
26
27
28
29
# File 'lib/gs_graph/connections/invited.rb', line 25

def invite!(*users)
  options = users.extract_options!
  options[:users] ||= Array(users).flatten.collect(&:identifier).join(',')
  post options.merge(:connection => :invited)
end

#invited(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/gs_graph/connections/invited.rb', line 4

def invited(options = {})
  members = self.connection :invited, options
  members.map! do |member|
    User.new member[:id], member.merge(
      :access_token => options[:access_token] || self.access_token
    )
  end
end

#invited?(user, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gs_graph/connections/invited.rb', line 13

def invited?(user, options = {})
  member = self.connection(
    :invited, options.merge(:connection_scope => user.identifier)
  ).first
  member.present? && User.new(
    member[:id],
    member.merge(
      :access_token => options[:access_token] || self.access_token
    )
  ).rsvp_status.to_sym
end

#uninvite!(user, options = {}) ⇒ Object



31
32
33
# File 'lib/gs_graph/connections/invited.rb', line 31

def uninvite!(user, options ={})
  delete options.merge(:connection => :invited, :connection_scope => user.identifier)
end