Class: Warframe::Client
- Inherits:
-
Cache
- Object
- Cache
- Warframe::Client
- Includes:
- API
- Defined in:
- lib/warframe/client.rb
Overview
The main application Client for access live feed data.
Example Usage
client = Warframe::Client.new
client.nightwave.tag # => 'Radio Legion Intermission'
Accepted Platforms
default = 'pc'
all_platorms = [ 'pc', 'ps4', 'xb1', 'swi' ]
client = Waframe::Client.new(platform: 'ps4')
client.platform # => 'ps4'
client.language # => 'en'
Accepted Languages
default = 'en'
all_languages = [ 'de', 'es', 'en', 'fr', 'it', 'ko', 'pl', 'pt', 'ru', 'zh' ]
client = Warframe::Client.new(language: 'fr')
client.language # => 'fr'
client.platform # => 'pc'
Setting both Platform and Language
client = Warframe::Client.new(platform: 'ps4', language: 'de')
client.platform # => 'ps4'
client.language # => 'de'
Constant Summary collapse
- BASE_URL =
The base Warframe Stat API link
'https://api.warframestat.us/'
- DEFAULT_OPTIONS =
Default attributes
{ platform: 'pc', language: 'en' }.freeze
Instance Attribute Summary collapse
-
#language ⇒ Object
The Client Cache.
-
#platform ⇒ Object
The Client Cache.
Instance Method Summary collapse
-
#base_url ⇒ String
The base url and platform combined.
-
#get(path, klass) ⇒ Object
Performs a get operation on the requested path, and returns a mapped response of the requested model.
-
#initialize(platform: 'pc', language: 'en') ⇒ Warframe::Client
constructor
Initialize the client.
Methods included from API::VallisCycle
Methods included from API::SyndicateMissions
Methods included from API::SteelPath
Methods included from API::Sortie
Methods included from API::Nightwave
Methods included from API::News
Methods included from API::Invasions
Methods included from API::GlobalUpgrades
Methods included from API::ConclaveChallenges
Methods included from API::Cetus
Methods included from API::CambionDrift
Methods included from API::Alerts
Constructor Details
#initialize(platform: 'pc', language: 'en') ⇒ Warframe::Client
Initialize the client.
54 55 56 57 58 |
# File 'lib/warframe/client.rb', line 54 def initialize(platform: 'pc', language: 'en') super({}) @platform = platform @language = language end |
Instance Attribute Details
#language ⇒ Object
The Client Cache
46 47 48 |
# File 'lib/warframe/client.rb', line 46 def language @language end |
#platform ⇒ Object
The Client Cache
46 47 48 |
# File 'lib/warframe/client.rb', line 46 def platform @platform end |
Instance Method Details
#base_url ⇒ String
Returns the base url and platform combined.
61 62 63 |
# File 'lib/warframe/client.rb', line 61 def base_url "#{BASE_URL}#{platform}" end |
#get(path, klass) ⇒ Object
Performs a get operation on the requested path, and returns a mapped response of the requested model.
68 69 70 71 72 73 |
# File 'lib/warframe/client.rb', line 68 def get(path, klass) return get_from_cache(path) if find_in_cache(path) result = get_request(path, klass) add_to_cache(path, result) end |