Class: Schatter::Session

Inherits:
Resource show all
Defined in:
lib/schatter/session.rb

Instance Method Summary collapse

Methods inherited from Resource

#delete, #destroy, #formatted_timestamp, #get, #initialize, #links, #post, #resource, #timestamp, #uuid

Constructor Details

This class inherits a constructor from Schatter::Resource

Instance Method Details

#conversations(reload = false) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/schatter/session.rb', line 5

def conversations reload=false
  @conversations = nil if reload
  return @conversations if @conversations
  @conversations = Hash[get(links[:conversations])['conversations'].map do |resource|
    [resource['uuid'], Schatter::Conversation.new(resource: resource)]
  end]
end

#create_conversation(name) ⇒ Object



13
14
15
16
# File 'lib/schatter/session.rb', line 13

def create_conversation name
  resource = post links[:conversations], name: name
  Schatter::Conversation.new resource: resource
end