Class: Spark::Room

Inherits:
Base
  • Object
show all
Defined in:
lib/room.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #delete, #refresh, #update

Constructor Details

#initialize(data) ⇒ Room

Returns a new instance of Room.



4
5
6
7
8
# File 'lib/room.rb', line 4

def initialize(data)
    @api_endpoint = 'rooms'
    @update_fields = [:title]
    super
end

Instance Attribute Details

#createdObject

Returns the value of attribute created.



3
4
5
# File 'lib/room.rb', line 3

def created
  @created
end

#creatorIdObject

Returns the value of attribute creatorId.



3
4
5
# File 'lib/room.rb', line 3

def creatorId
  @creatorId
end

#errorsObject

Returns the value of attribute errors.



3
4
5
# File 'lib/room.rb', line 3

def errors
  @errors
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/room.rb', line 3

def id
  @id
end

#isLockedObject

Returns the value of attribute isLocked.



3
4
5
# File 'lib/room.rb', line 3

def isLocked
  @isLocked
end

#lastActivityObject

Returns the value of attribute lastActivity.



3
4
5
# File 'lib/room.rb', line 3

def lastActivity
  @lastActivity
end

#sipAddressObject

Returns the value of attribute sipAddress.



3
4
5
# File 'lib/room.rb', line 3

def sipAddress
  @sipAddress
end

#teamIdObject

Returns the value of attribute teamId.



3
4
5
# File 'lib/room.rb', line 3

def teamId
  @teamId
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/room.rb', line 3

def title
  @title
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/room.rb', line 3

def type
  @type
end

Class Method Details

.Create(title, teamId = nil) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/room.rb', line 19

def Create(title, teamId = nil)
    payload = {}
    payload[:title] = title
    payload[:teamId] = teamId if teamId
    res = Spark::rest('POST',"/rooms", {:payload => payload})
    if res.ok
        room = Spark::Room.new(JSON.parse(res.body))
        return room
    end
    return nil
end

.Get(id) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/room.rb', line 11

def Get(id)
    res = Spark::rest('GET',"/rooms/#{id}")
    if res.ok
        room = Spark::Room.new(JSON.parse(res.body))
        return room
    end
    return nil
end