warframe 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -3
  3. data/README.md +99 -93
  4. data/lib/warframe/cache.rb +37 -37
  5. data/lib/warframe/client_wrapper.rb +39 -39
  6. data/lib/warframe/models/alert.rb +30 -30
  7. data/lib/warframe/models/attributes/active.rb +31 -31
  8. data/lib/warframe/models/attributes/description.rb +21 -21
  9. data/lib/warframe/models/attributes/eta.rb +14 -14
  10. data/lib/warframe/models/attributes/expiry.rb +30 -30
  11. data/lib/warframe/models/attributes/id.rb +14 -14
  12. data/lib/warframe/models/attributes/reward_types.rb +14 -14
  13. data/lib/warframe/models/attributes/start_string.rb +14 -14
  14. data/lib/warframe/models/attributes/translations.rb +18 -18
  15. data/lib/warframe/models/base.rb +36 -36
  16. data/lib/warframe/models/cambion_drift.rb +26 -26
  17. data/lib/warframe/models/cetus.rb +40 -40
  18. data/lib/warframe/models/conclave_challenge.rb +54 -54
  19. data/lib/warframe/models/global_upgrade.rb +41 -41
  20. data/lib/warframe/models/invasion.rb +71 -71
  21. data/lib/warframe/models/news.rb +54 -54
  22. data/lib/warframe/models/nightwave.rb +40 -40
  23. data/lib/warframe/models/sortie.rb +36 -36
  24. data/lib/warframe/models/steel_path.rb +34 -34
  25. data/lib/warframe/models/syndicate_mission.rb +32 -32
  26. data/lib/warframe/rest/api/alerts.rb +23 -23
  27. data/lib/warframe/rest/api/cambion_drift.rb +23 -23
  28. data/lib/warframe/rest/api/cetus.rb +23 -23
  29. data/lib/warframe/rest/api/conclave_challenges.rb +23 -23
  30. data/lib/warframe/rest/api/global_upgrades.rb +23 -23
  31. data/lib/warframe/rest/api/invasions.rb +23 -23
  32. data/lib/warframe/rest/api/news.rb +23 -23
  33. data/lib/warframe/rest/api/nightwave.rb +23 -23
  34. data/lib/warframe/rest/api/sortie.rb +23 -23
  35. data/lib/warframe/rest/api/steel_path.rb +23 -23
  36. data/lib/warframe/rest/api/syndicate_missions.rb +23 -23
  37. data/lib/warframe/rest/api.rb +37 -37
  38. data/lib/warframe/rest/client.rb +42 -42
  39. data/lib/warframe/rest/request.rb +61 -61
  40. data/lib/warframe/rest/utils.rb +23 -23
  41. data/lib/warframe/version.rb +6 -6
  42. data/lib/warframe.rb +7 -7
  43. metadata +14 -43
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- require 'warframe/models/invasion'
4
- require_relative '../utils'
5
-
6
- module Warframe
7
- module REST
8
- module API
9
- # API endpoint for getting information on current Invasions data.
10
- #
11
- # {https://api.warframestat.us/pc/invasions Example Response}
12
- module Invasions
13
- include Warframe::REST::Utils
14
-
15
- # Gets the current Invasions data.
16
- # @return [Array<[Warframe::Models::Invasion]>]
17
- def invasions
18
- get('/invasions', Warframe::Models::Invasion)
19
- end
20
- end
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'warframe/models/invasion'
4
+ require_relative '../utils'
5
+
6
+ module Warframe
7
+ module REST
8
+ module API
9
+ # API endpoint for getting information on current Invasions data.
10
+ #
11
+ # {https://api.warframestat.us/pc/invasions Example Response}
12
+ module Invasions
13
+ include Warframe::REST::Utils
14
+
15
+ # Gets the current Invasions data.
16
+ # @return [Array<[Warframe::Models::Invasion]>]
17
+ def invasions
18
+ get('/invasions', Warframe::Models::Invasion)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- require 'warframe/models/news'
4
- require_relative '../utils'
5
-
6
- module Warframe
7
- module REST
8
- module API
9
- # API endpoint for getting information from the News route.
10
- #
11
- # {https://api.warframestat.us/pc/news Example Response}
12
- module News
13
- include Warframe::REST::Utils
14
-
15
- # Gets the current news data.
16
- # @return [Array<Warframe::Models::News>]
17
- def news
18
- get('/news', Warframe::Models::News)
19
- end
20
- end
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'warframe/models/news'
4
+ require_relative '../utils'
5
+
6
+ module Warframe
7
+ module REST
8
+ module API
9
+ # API endpoint for getting information from the News route.
10
+ #
11
+ # {https://api.warframestat.us/pc/news Example Response}
12
+ module News
13
+ include Warframe::REST::Utils
14
+
15
+ # Gets the current news data.
16
+ # @return [Array<Warframe::Models::News>]
17
+ def news
18
+ get('/news', Warframe::Models::News)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- require 'warframe/models/nightwave'
4
- require_relative '../utils'
5
-
6
- module Warframe
7
- module REST
8
- module API
9
- # API endpoint for getting information from the Nightwave route.
10
- #
11
- # {https://api.warframestat.us/pc/nightwave Example Response}
12
- module Nightwave
13
- include Warframe::REST::Utils
14
-
15
- # Gets the current Nightwave Mission data.
16
- # @return [Warframe::Models::Nightwave]
17
- def nightwave
18
- get('/nightwave', Warframe::Models::Nightwave)
19
- end
20
- end
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'warframe/models/nightwave'
4
+ require_relative '../utils'
5
+
6
+ module Warframe
7
+ module REST
8
+ module API
9
+ # API endpoint for getting information from the Nightwave route.
10
+ #
11
+ # {https://api.warframestat.us/pc/nightwave Example Response}
12
+ module Nightwave
13
+ include Warframe::REST::Utils
14
+
15
+ # Gets the current Nightwave Mission data.
16
+ # @return [Warframe::Models::Nightwave]
17
+ def nightwave
18
+ get('/nightwave', Warframe::Models::Nightwave)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- require 'warframe/models/sortie'
4
- require_relative '../utils'
5
-
6
- module Warframe
7
- module REST
8
- module API
9
- # API endpoint for getting information on current Sortie data.
10
- #
11
- # {https://api.warframestat.us/pc/sortie Example Response}
12
- module Sortie
13
- include Warframe::REST::Utils
14
-
15
- # Gets the current sortie missions.
16
- # @return [Array<Warframe::Models::Sortie>]
17
- def sortie
18
- get('/sortie', Warframe::Models::Sortie)
19
- end
20
- end
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'warframe/models/sortie'
4
+ require_relative '../utils'
5
+
6
+ module Warframe
7
+ module REST
8
+ module API
9
+ # API endpoint for getting information on current Sortie data.
10
+ #
11
+ # {https://api.warframestat.us/pc/sortie Example Response}
12
+ module Sortie
13
+ include Warframe::REST::Utils
14
+
15
+ # Gets the current sortie missions.
16
+ # @return [Array<Warframe::Models::Sortie>]
17
+ def sortie
18
+ get('/sortie', Warframe::Models::Sortie)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- require 'warframe/models/steel_path'
4
- require_relative '../utils'
5
-
6
- module Warframe
7
- module REST
8
- module API
9
- # API endpoint for getting information on current SteelPath data.
10
- #
11
- # {https://api.warframestat.us/pc/steelPath Example Response}
12
- module SteelPath
13
- include Warframe::REST::Utils
14
-
15
- # Steel Path data
16
- # @return [Warframe::Models::SteelPath]
17
- def steel_path
18
- get('/steelPath', Warframe::Models::SteelPath)
19
- end
20
- end
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'warframe/models/steel_path'
4
+ require_relative '../utils'
5
+
6
+ module Warframe
7
+ module REST
8
+ module API
9
+ # API endpoint for getting information on current SteelPath data.
10
+ #
11
+ # {https://api.warframestat.us/pc/steelPath Example Response}
12
+ module SteelPath
13
+ include Warframe::REST::Utils
14
+
15
+ # Steel Path data
16
+ # @return [Warframe::Models::SteelPath]
17
+ def steel_path
18
+ get('/steelPath', Warframe::Models::SteelPath)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- require 'warframe/models/syndicate_mission'
4
- require_relative '../utils'
5
-
6
- module Warframe
7
- module REST
8
- module API
9
- # API endpoint for getting information on current SyndicateMission data.
10
- #
11
- # {https://api.warframestat.us/pc/syndicateMissions Example Response}
12
- module SyndicateMissions
13
- include Warframe::REST::Utils
14
-
15
- # Gets the current syndicateMissions Data.
16
- # @return [Array<Warframe::Models::SyndicateMission>]
17
- def syndicate_missions
18
- get('/syndicateMissions', Warframe::Models::SyndicateMission)
19
- end
20
- end
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'warframe/models/syndicate_mission'
4
+ require_relative '../utils'
5
+
6
+ module Warframe
7
+ module REST
8
+ module API
9
+ # API endpoint for getting information on current SyndicateMission data.
10
+ #
11
+ # {https://api.warframestat.us/pc/syndicateMissions Example Response}
12
+ module SyndicateMissions
13
+ include Warframe::REST::Utils
14
+
15
+ # Gets the current syndicateMissions Data.
16
+ # @return [Array<Warframe::Models::SyndicateMission>]
17
+ def syndicate_missions
18
+ get('/syndicateMissions', Warframe::Models::SyndicateMission)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,37 +1,37 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'api/alerts'
4
- require_relative 'api/cambion_drift'
5
- require_relative 'api/cetus'
6
- require_relative 'api/conclave_challenges'
7
- require_relative 'api/global_upgrades'
8
- require_relative 'api/invasions'
9
- require_relative 'api/news'
10
- require_relative 'api/nightwave'
11
- require_relative 'api/sortie'
12
- require_relative 'api/steel_path'
13
- require_relative 'api/syndicate_missions'
14
-
15
- module Warframe
16
- # A REST-ful API service, provided by https://api.warframestat.us.
17
- module REST
18
- # The API Router for getting live data.
19
- #
20
- # Attempting to have every accessible route from {https://docs.warframestat.us Warframe Stat}.
21
- #
22
- # Module names are 'routes' to this API. See {Warframe::REST::API::Alerts Alerts} for example.
23
- module API
24
- include Warframe::REST::API::Alerts
25
- include Warframe::REST::API::CambionDrift
26
- include Warframe::REST::API::Cetus
27
- include Warframe::REST::API::ConclaveChallenges
28
- include Warframe::REST::API::GlobalUpgrades
29
- include Warframe::REST::API::Invasions
30
- include Warframe::REST::API::News
31
- include Warframe::REST::API::Nightwave
32
- include Warframe::REST::API::Sortie
33
- include Warframe::REST::API::SteelPath
34
- include Warframe::REST::API::SyndicateMissions
35
- end
36
- end
37
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'api/alerts'
4
+ require_relative 'api/cambion_drift'
5
+ require_relative 'api/cetus'
6
+ require_relative 'api/conclave_challenges'
7
+ require_relative 'api/global_upgrades'
8
+ require_relative 'api/invasions'
9
+ require_relative 'api/news'
10
+ require_relative 'api/nightwave'
11
+ require_relative 'api/sortie'
12
+ require_relative 'api/steel_path'
13
+ require_relative 'api/syndicate_missions'
14
+
15
+ module Warframe
16
+ # A REST-ful API service, provided by https://api.warframestat.us.
17
+ module REST
18
+ # The API Router for getting live data.
19
+ #
20
+ # Attempting to have every accessible route from {https://docs.warframestat.us Warframe Stat}.
21
+ #
22
+ # Module names are 'routes' to this API. See {Warframe::REST::API::Alerts Alerts} for example.
23
+ module API
24
+ include Warframe::REST::API::Alerts
25
+ include Warframe::REST::API::CambionDrift
26
+ include Warframe::REST::API::Cetus
27
+ include Warframe::REST::API::ConclaveChallenges
28
+ include Warframe::REST::API::GlobalUpgrades
29
+ include Warframe::REST::API::Invasions
30
+ include Warframe::REST::API::News
31
+ include Warframe::REST::API::Nightwave
32
+ include Warframe::REST::API::Sortie
33
+ include Warframe::REST::API::SteelPath
34
+ include Warframe::REST::API::SyndicateMissions
35
+ end
36
+ end
37
+ end
@@ -1,42 +1,42 @@
1
- # frozen_string_literal: true
2
-
3
- require 'warframe/client_wrapper'
4
- require_relative './api'
5
-
6
- module Warframe
7
- module REST
8
- # The main application Client for access live feed data.
9
- #
10
- # == Example Usage
11
- #
12
- # client = Warframe::REST::Client.new
13
- # client.nightwave.tag # => 'Radio Legion Intermission'
14
- #
15
- # == Accepted Platforms
16
- #
17
- # default = 'pc'
18
- # all_platorms = [ 'pc', 'ps4', 'xb1', 'swi' ]
19
- #
20
- # client = Waframe::REST::Client.new(platform: 'ps4')
21
- # client.platform # => 'ps4'
22
- # client.language # => 'en'
23
- #
24
- # == Accepted Languages
25
- #
26
- # default = 'en'
27
- # all_languages = [ 'de', 'es', 'en', 'fr', 'it', 'ko', 'pl', 'pt', 'ru', 'zh' ]
28
- #
29
- # client = Warframe::REST::Client.new(language: 'fr')
30
- # client.language # => 'fr'
31
- # client.platform # => 'pc'
32
- #
33
- # == Setting both Platform and Language
34
- #
35
- # client = Warframe::REST::Client.new(platform: 'ps4', language: 'de')
36
- # client.platform # => 'ps4'
37
- # client.language # => 'de'
38
- class Client < Warframe::ClientWrapper
39
- include Warframe::REST::API
40
- end
41
- end
42
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'warframe/client_wrapper'
4
+ require_relative './api'
5
+
6
+ module Warframe
7
+ module REST
8
+ # The main application Client for access live feed data.
9
+ #
10
+ # == Example Usage
11
+ #
12
+ # client = Warframe::REST::Client.new
13
+ # client.nightwave.tag # => 'Radio Legion Intermission'
14
+ #
15
+ # == Accepted Platforms
16
+ #
17
+ # default = 'pc'
18
+ # all_platorms = [ 'pc', 'ps4', 'xb1', 'swi' ]
19
+ #
20
+ # client = Waframe::REST::Client.new(platform: 'ps4')
21
+ # client.platform # => 'ps4'
22
+ # client.language # => 'en'
23
+ #
24
+ # == Accepted Languages
25
+ #
26
+ # default = 'en'
27
+ # all_languages = [ 'de', 'es', 'en', 'fr', 'it', 'ko', 'pl', 'pt', 'ru', 'zh' ]
28
+ #
29
+ # client = Warframe::REST::Client.new(language: 'fr')
30
+ # client.language # => 'fr'
31
+ # client.platform # => 'pc'
32
+ #
33
+ # == Setting both Platform and Language
34
+ #
35
+ # client = Warframe::REST::Client.new(platform: 'ps4', language: 'de')
36
+ # client.platform # => 'ps4'
37
+ # client.language # => 'de'
38
+ class Client < Warframe::ClientWrapper
39
+ include Warframe::REST::API
40
+ end
41
+ end
42
+ end
@@ -1,61 +1,61 @@
1
- # frozen_string_literal: true
2
-
3
- require 'net/http'
4
- require 'json'
5
-
6
- module Warframe
7
- module REST
8
- # A request to send to the Warframe Stat API.
9
- class Request
10
- # @return [Warframe::REST::Client]
11
- attr_reader :client
12
-
13
- # @return [String]
14
- attr_reader :path
15
-
16
- # Instantiate a Request
17
- #
18
- # @param client [Warframe::REST::Client]
19
- # @param path [String]
20
- # @param klass [Warframe::Models]
21
- # @return [Warframe:REST:Request]
22
- def initialize(client, path, klass)
23
- @client = client
24
- @route = path
25
- @path = client.base_url + path + "?language=#{@client.language}"
26
- @klass = klass
27
- end
28
-
29
- # Sends an HTTP request with the attached parameters and headers.
30
- # Will either return the Model, or collection of Models.
31
- # @return [Warframe::Models, Array<[Warframe::Models]>]
32
- def send
33
- uri = URI(path)
34
- req = Net::HTTP::Get.new(uri)
35
- resp = get_response uri, req
36
- return_parsed resp
37
- end
38
-
39
- private
40
-
41
- # Returns the parsed JSON response in the form of a [Warframe::Models] or an array of [Warframe::Models]
42
- # @param resp [Net::HTTP.get]
43
- # @return [Warframe::Models, Array<[Warframe::Models]>]
44
- def return_parsed(resp)
45
- parsed = JSON.parse(resp)
46
-
47
- # Return Empty array if no data found.
48
- return [] if parsed.is_a?(Array) && parsed.empty?
49
-
50
- @klass.new parsed
51
- end
52
-
53
- def get_response(uri, req)
54
- Net::HTTP.get(uri) do |http|
55
- http.use_ssl = true
56
- http.request req
57
- end
58
- end
59
- end
60
- end
61
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'json'
5
+
6
+ module Warframe
7
+ module REST
8
+ # A request to send to the Warframe Stat API.
9
+ class Request
10
+ # @return [Warframe::REST::Client]
11
+ attr_reader :client
12
+
13
+ # @return [String]
14
+ attr_reader :path
15
+
16
+ # Instantiate a Request
17
+ #
18
+ # @param client [Warframe::REST::Client]
19
+ # @param path [String]
20
+ # @param klass [Warframe::Models]
21
+ # @return [Warframe:REST:Request]
22
+ def initialize(client, path, klass)
23
+ @client = client
24
+ @route = path
25
+ @path = client.base_url + path + "?language=#{@client.language}"
26
+ @klass = klass
27
+ end
28
+
29
+ # Sends an HTTP request with the attached parameters and headers.
30
+ # Will either return the Model, or collection of Models.
31
+ # @return [Warframe::Models, Array<[Warframe::Models]>]
32
+ def send
33
+ uri = URI(path)
34
+ req = Net::HTTP::Get.new(uri)
35
+ resp = get_response uri, req
36
+ return_parsed resp
37
+ end
38
+
39
+ private
40
+
41
+ # Returns the parsed JSON response in the form of a [Warframe::Models] or an array of [Warframe::Models]
42
+ # @param resp [Net::HTTP.get]
43
+ # @return [Warframe::Models, Array<[Warframe::Models]>]
44
+ def return_parsed(resp)
45
+ parsed = JSON.parse(resp)
46
+
47
+ # Return Empty array if no data found.
48
+ return [] if parsed.is_a?(Array) && parsed.empty?
49
+
50
+ @klass.new parsed
51
+ end
52
+
53
+ def get_response(uri, req)
54
+ Net::HTTP.get(uri) do |http|
55
+ http.use_ssl = true
56
+ http.request req
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative './request'
4
-
5
- module Warframe
6
- module REST
7
- # Private REST Utilities
8
- module Utils
9
- private
10
-
11
- # Performs a get operation on the requested path, and returns a mapped response of the requested model.
12
- # @param path [String]
13
- # @param klass [Warframe::Models]
14
- def get(path, klass)
15
- inst = @client || self
16
- return inst.get_from_cache(path) if inst.find_in_cache(path)
17
-
18
- result = Warframe::REST::Request.new(inst, path, klass).send
19
- inst.add_to_cache(path, result)
20
- end
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './request'
4
+
5
+ module Warframe
6
+ module REST
7
+ # Private REST Utilities
8
+ module Utils
9
+ private
10
+
11
+ # Performs a get operation on the requested path, and returns a mapped response of the requested model.
12
+ # @param path [String]
13
+ # @param klass [Warframe::Models]
14
+ def get(path, klass)
15
+ inst = @client || self
16
+ return inst.get_from_cache(path) if inst.find_in_cache(path)
17
+
18
+ result = Warframe::REST::Request.new(inst, path, klass).send
19
+ inst.add_to_cache(path, result)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,6 +1,6 @@
1
- # frozen_string_literal: true
2
-
3
- module Warframe
4
- # The current version of this gem.
5
- VERSION = '0.3.0'
6
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Warframe
4
+ # The current version of this gem.
5
+ VERSION = '0.3.1'
6
+ end
data/lib/warframe.rb CHANGED
@@ -1,7 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
- require 'warframe/version'
4
- require 'warframe/rest/client'
5
-
6
- # Warframe Stat Ruby Client main module
7
- module Warframe; end
1
+ # frozen_string_literal: true
2
+
3
+ require 'warframe/version'
4
+ require 'warframe/rest/client'
5
+
6
+ # Warframe Stat Ruby Client main module
7
+ module Warframe; end