Class: GlipSdk::REST::Groups

Inherits:
Object
  • Object
show all
Defined in:
lib/glip_sdk/rest/groups.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rc_sdk) ⇒ Groups



6
7
8
# File 'lib/glip_sdk/rest/groups.rb', line 6

def initialize(rc_sdk)
  @api = rc_sdk
end

Instance Attribute Details

#subscriptionObject

Returns the value of attribute subscription.



4
5
6
# File 'lib/glip_sdk/rest/groups.rb', line 4

def subscription
  @subscription
end

Instance Method Details

#get(opts = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/glip_sdk/rest/groups.rb', line 10

def get(opts = {})
  if opts.key? :groupId
    return @api.http.get "glip/groups/#{opts[:groupId]}"
  end
  @api.http.get 'glip/groups', opts
end

#observe(observer) ⇒ Object



17
18
19
20
21
# File 'lib/glip_sdk/rest/groups.rb', line 17

def observe(observer)
  @subscription = @api.create_subscription
  @subscription.subscribe ['/restapi/v1.0/account/~/extension/~/glip/groups']
  @subscription.add_observer observer
end