Class: GramV2Client::Base

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/gram_v2_client/base.rb

Direct Known Subclasses

Account, Group, Role

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.passwordObject



29
30
31
32
33
34
35
36
# File 'lib/gram_v2_client/base.rb', line 29

def password()
  if GramV2Client.configuration.password
    if super.to_s != GramV2Client.configuration.password
      reload_config
    end
  end
  super
end

.proxyObject



38
39
40
41
42
43
44
45
# File 'lib/gram_v2_client/base.rb', line 38

def proxy()
  if GramV2Client.configuration.proxy
    if super.to_s != URI.parse(GramV2Client.configuration.proxy).to_s
      reload_config
    end
  end
  super
end

.reload_configObject



48
49
50
51
52
53
# File 'lib/gram_v2_client/base.rb', line 48

def reload_config
  self.site= GramV2Client.configuration.site
  self.user= GramV2Client.configuration.user
  self.password=GramV2Client.configuration.password
  self.proxy=GramV2Client.configuration.proxy
end

.siteObject



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

def site
  if GramV2Client.configuration.site
    if super.to_s != URI.parse(GramV2Client.configuration.site).to_s
      reload_config
    end
  end
  super
end

.userObject



20
21
22
23
24
25
26
27
# File 'lib/gram_v2_client/base.rb', line 20

def user()
  if GramV2Client.configuration.user
    if super.to_s != GramV2Client.configuration.user
      reload_config
    end
  end
  super
end

Instance Method Details

#to_paramObject

This is set to enable Configuration change at runtime.



6
7
8
# File 'lib/gram_v2_client/base.rb', line 6

def to_param
  uuid
end