Class: Unchained::Client

Inherits:
Object
  • Object
show all
Includes:
Archetypes, Attributes, Factions, MOTD, Patcher, Races, Servers, Request
Defined in:
lib/unchained/client.rb,
lib/unchained/client/motd.rb,
lib/unchained/client/races.rb,
lib/unchained/client/patcher.rb,
lib/unchained/client/servers.rb,
lib/unchained/client/factions.rb,
lib/unchained/client/archetypes.rb,
lib/unchained/client/attributes.rb,
lib/unchained/client/mixins/resource.rb

Defined Under Namespace

Modules: Archetypes, Attributes, Factions, MOTD, Mixins, Patcher, Races, Servers

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Servers

#servers

Methods included from Patcher

#patcher_alerts, #patcher_hero_contents

Methods included from Races

#race, #races

Methods included from MOTD

#motd

Methods included from Factions

#faction, #factions

Methods included from Attributes

#attribute_offsets, #attributes

Methods included from Archetypes

#archetype, #archetypes

Methods included from Request

#get, #get_resource, #get_resources

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



19
20
21
22
23
24
25
26
# File 'lib/unchained/client.rb', line 19

def initialize(opts={})
  @cache = {}

  config = Unchained.configuration.merge(opts)
  Unchained::Configuration::KEYS.each do |key|
    send("#{key}=", config[key])
  end
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



17
18
19
# File 'lib/unchained/client.rb', line 17

def cache
  @cache
end

Instance Method Details

#base_urlObject



28
29
30
# File 'lib/unchained/client.rb', line 28

def base_url
  'http://api.camelotunchained.com/v1'
end

#clear_cache!Object

Helper method to bust the cache.



33
34
35
# File 'lib/unchained/client.rb', line 33

def clear_cache!
  @cache = {}
end