Class: GlipSdk::REST::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rc_sdk) ⇒ Client

Returns a new instance of Client.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/glip_sdk/rest/client.rb', line 15

def initialize(rc_sdk)
  @api = rc_sdk
  @logger = @api.config.logger
  puts ">>>\nGLIP_SCK_LOGGER_NAME [#{@api.config.logger.class.name}]\n<<<\n"

  @groups_cache = GlipSdk::REST::Cache::Groups.new

  @groups = GlipSdk::REST::Groups.new @api
  @persons = GlipSdk::REST::Persons.new @api
  @posts = GlipSdk::REST::Posts.new @api
end

Instance Attribute Details

#apiObject

Returns the value of attribute api.



8
9
10
# File 'lib/glip_sdk/rest/client.rb', line 8

def api
  @api
end

#groupsObject

Returns the value of attribute groups.



10
11
12
# File 'lib/glip_sdk/rest/client.rb', line 10

def groups
  @groups
end

#groups_cacheObject

Returns the value of attribute groups_cache.



11
12
13
# File 'lib/glip_sdk/rest/client.rb', line 11

def groups_cache
  @groups_cache
end

#loggerObject

Returns the value of attribute logger.



9
10
11
# File 'lib/glip_sdk/rest/client.rb', line 9

def logger
  @logger
end

#personsObject

Returns the value of attribute persons.



12
13
14
# File 'lib/glip_sdk/rest/client.rb', line 12

def persons
  @persons
end

#postsObject

Returns the value of attribute posts.



13
14
15
# File 'lib/glip_sdk/rest/client.rb', line 13

def posts
  @posts
end

Instance Method Details

#load_groups_cache(filepath = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/glip_sdk/rest/client.rb', line 27

def load_groups_cache(filepath = nil)
  if !filepath.nil? && File.exist?(filepath)
    groups_json = IO.read filepath
    all_groups = MultiJson.decode groups_json
    @groups_cache.load_groups all_groups
  else
    @groups_cache.load_groups @groups.all_groups          
  end

  @posts.groups_cache = @groups_cache
end