Class: BlizzardApi::Request
- Inherits:
-
Object
- Object
- BlizzardApi::Request
- Includes:
- ApiStandards
- Defined in:
- lib/blizzard_api/request.rb
Overview
Simplifies the requests to Blizzard APIS
Direct Known Subclasses
Diablo::Request, Hearthstone::Request, Starcraft::Request, Wow::Request
Constant Summary collapse
- CACHE_HOUR =
One hour cache
3600
- CACHE_DAY =
One day cache
24 * CACHE_HOUR
- CACHE_TRIMESTER =
Three (commercial) months cache
CACHE_DAY * 90
Constants included from ApiStandards
Instance Attribute Summary collapse
- #mode ⇒ :regular, :extended
-
#region ⇒ String
Api region.
Instance Method Summary collapse
-
#initialize(**options) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(**options) ⇒ Request
Returns a new instance of Request.
49 50 51 52 53 54 55 56 |
# File 'lib/blizzard_api/request.rb', line 49 def initialize(**) self.region = [:region] || BlizzardApi.region # Use the shared access_token, or create one if it doesn't exists. This avoids unnecessary calls to create tokens. create_access_token if BlizzardApi.access_token_expired? # Mode @mode = [:mode] || BlizzardApi.mode end |
Instance Attribute Details
#mode ⇒ :regular, :extended
45 46 47 |
# File 'lib/blizzard_api/request.rb', line 45 def mode @mode end |
#region ⇒ String
Returns Api region.
40 41 42 |
# File 'lib/blizzard_api/request.rb', line 40 def region @region end |