warframe 0.1.3 → 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 -75
  4. data/lib/warframe/cache.rb +37 -0
  5. data/lib/warframe/client_wrapper.rb +39 -37
  6. data/lib/warframe/models/alert.rb +30 -29
  7. data/lib/warframe/models/attributes/active.rb +31 -31
  8. data/lib/warframe/models/attributes/description.rb +21 -14
  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 -0
  17. data/lib/warframe/models/cetus.rb +40 -0
  18. data/lib/warframe/models/conclave_challenge.rb +54 -0
  19. data/lib/warframe/models/global_upgrade.rb +41 -40
  20. data/lib/warframe/models/invasion.rb +71 -70
  21. data/lib/warframe/models/news.rb +54 -53
  22. data/lib/warframe/models/nightwave.rb +40 -39
  23. data/lib/warframe/models/sortie.rb +36 -0
  24. data/lib/warframe/models/steel_path.rb +34 -0
  25. data/lib/warframe/models/syndicate_mission.rb +32 -0
  26. data/lib/warframe/rest/api/alerts.rb +23 -23
  27. data/lib/warframe/rest/api/cambion_drift.rb +23 -0
  28. data/lib/warframe/rest/api/cetus.rb +23 -0
  29. data/lib/warframe/rest/api/conclave_challenges.rb +23 -0
  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 -0
  35. data/lib/warframe/rest/api/steel_path.rb +23 -0
  36. data/lib/warframe/rest/api/syndicate_missions.rb +23 -0
  37. data/lib/warframe/rest/api.rb +37 -25
  38. data/lib/warframe/rest/client.rb +42 -42
  39. data/lib/warframe/rest/request.rb +61 -55
  40. data/lib/warframe/rest/utils.rb +23 -19
  41. data/lib/warframe/version.rb +6 -6
  42. data/lib/warframe.rb +7 -7
  43. metadata +27 -63
@@ -1,18 +1,18 @@
1
- # frozen_string_literal: true
2
-
3
- module Warframe
4
- module Models
5
- module Attributes
6
- # Includes the translations attribute.
7
- module Translations
8
- # The message that can be translated.
9
- # @return [String]
10
- attr_reader :message
11
-
12
- # Available translations for the requested data.
13
- # @return [OpenStruct]
14
- attr_reader :translations
15
- end
16
- end
17
- end
18
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Warframe
4
+ module Models
5
+ module Attributes
6
+ # Includes the translations attribute.
7
+ module Translations
8
+ # The message that can be translated.
9
+ # @return [String]
10
+ attr_reader :message
11
+
12
+ # Available translations for the requested data.
13
+ # @return [OpenStruct]
14
+ attr_reader :translations
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,36 +1,36 @@
1
- # frozen_string_literal: true
2
-
3
- require 'fast_underscore'
4
-
5
- module Warframe
6
- # Models of HTTP responses.
7
- module Models
8
- # Warframe Base Model.
9
- class Base
10
- attr_reader :error, :code
11
-
12
- # Creates a new [Warframe::Models::Base] instance.
13
- # @param options [Hash, Array] a parsed JSON object, or collection of JSON objects.
14
- def initialize(options = {})
15
- if options.is_a? Array
16
- from_array options
17
- else
18
- options.each do |k, v|
19
- renamed = k.to_s.underscore
20
- v = v.map { |obj| OpenStruct.new obj } if v.is_a?(Array) && v[0].is_a?(Hash)
21
- v = OpenStruct.new v if v.is_a? Hash
22
- instance_variable_set "@#{renamed}", v
23
- end
24
- end
25
- end
26
-
27
- private
28
-
29
- # Constructs an Array of new [Warframe::Models::Base]'s'.
30
- # @return [Array]
31
- def from_array(arr)
32
- arr.map { |obj| initialize obj }
33
- end
34
- end
35
- end
36
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'fast_underscore'
4
+
5
+ module Warframe
6
+ # Models of HTTP responses.
7
+ module Models
8
+ # Warframe Base Model.
9
+ class Base
10
+ attr_reader :error, :code
11
+
12
+ # Creates a new [Warframe::Models::Base] instance.
13
+ # @param options [Hash, Array] a parsed JSON object, or collection of JSON objects.
14
+ def initialize(options = {})
15
+ if options.is_a? Array
16
+ from_array options
17
+ else
18
+ options.each do |k, v|
19
+ renamed = k.to_s.underscore
20
+ v = v.map { |obj| OpenStruct.new obj } if v.is_a?(Array) && v[0].is_a?(Hash)
21
+ v = OpenStruct.new v if v.is_a? Hash
22
+ instance_variable_set "@#{renamed}", v
23
+ end
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ # Constructs an Array of new [Warframe::Models::Base]'s'.
30
+ # @return [Array]
31
+ def from_array(arr)
32
+ arr.map { |obj| initialize obj }
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './base'
4
+ require_relative 'attributes/id'
5
+ require_relative 'attributes/expiry'
6
+ require_relative 'attributes/active'
7
+
8
+ module Warframe
9
+ module Models
10
+ # Cambion Drift data model.
11
+ # {https://api.warframestat.us/pc/cambionCycle /:platform/cambionCycle}
12
+ class CambionDrift < Warframe::Models::Base
13
+ include Warframe::Models::Attributes::ID
14
+ include Warframe::Models::Attributes::Activation
15
+ include Warframe::Models::Attributes::Expiry
16
+
17
+ # Current active state of the world, either 'vome' or 'fass'.
18
+ # @return [String]
19
+ attr_reader :active
20
+
21
+ # The time remaining until world state switches.
22
+ # @return [String]
23
+ attr_reader :time_left
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './base'
4
+ require_relative 'attributes/id'
5
+ require_relative 'attributes/active'
6
+ require_relative 'attributes/expiry'
7
+
8
+ module Warframe
9
+ module Models
10
+ # Cetus data model.
11
+ # {https://api.warframestat.us/pc/cetusCycle /:platform/cetusCycle}
12
+ class Cetus < Warframe::Models::Base
13
+ include Warframe::Models::Attributes::ID
14
+ include Warframe::Models::Attributes::Activation
15
+ include Warframe::Models::Attributes::Expiry
16
+
17
+ # Whether or not it is currently day.
18
+ # @return [Boolean]
19
+ attr_reader :is_day
20
+ alias day? is_day
21
+
22
+ # Current world state of Cetus.
23
+ # @return [String]
24
+ attr_reader :state
25
+
26
+ # Whether or not this is Cetus.
27
+ # @return [Boolean]
28
+ attr_reader :is_cetus
29
+ alias cetus? is_cetus
30
+
31
+ # Time left until state change.
32
+ # @return [String]
33
+ attr_reader :time_left
34
+
35
+ # A short string of the time left until state change.
36
+ # @return [String]
37
+ attr_reader :short_string
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './base'
4
+ require_relative 'attributes/expiry'
5
+ require_relative 'attributes/eta'
6
+ require_relative 'attributes/description'
7
+ require_relative 'attributes/id'
8
+ require_relative 'attributes/active'
9
+
10
+ module Warframe
11
+ module Models
12
+ # Conclave Challenges data model.
13
+ # {https://api.warframestat.us/pc/conclaveChallenges /:platform/conclaveChallenges}
14
+ class ConclaveChallenge < Warframe::Models::Base
15
+ include Warframe::Models::Attributes::Expiration
16
+ include Warframe::Models::Attributes::ETA
17
+ include Warframe::Models::Attributes::Description
18
+ include Warframe::Models::Attributes::ID
19
+ include Warframe::Models::Attributes::Activation
20
+
21
+ # The mode of the conclave.
22
+ # @return [String]
23
+ attr_reader :mode
24
+
25
+ # The amount of challenges that must be completed.
26
+ # @return [Integer]
27
+ attr_reader :amount
28
+
29
+ # The amount of standing you will gain upon completion.
30
+ # @return [Integer]
31
+ attr_reader :standing
32
+
33
+ # The title of the challenge.
34
+ # @return [String]
35
+ attr_reader :title
36
+
37
+ # The category of mission, usually 'weekly' / 'daily'.
38
+ # @return [String]
39
+ attr_reader :category
40
+
41
+ # Whether or not this is a daily mission.
42
+ # @return [Boolean]
43
+ attr_reader :daily
44
+
45
+ # The challenge information in a one line string.
46
+ # @return [String]
47
+ attr_reader :as_string
48
+
49
+ # Whether or not this is a root challenge.
50
+ # @return [Boolean]
51
+ attr_reader :root_challenge
52
+ end
53
+ end
54
+ end
@@ -1,40 +1,41 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative './attributes/expiry'
4
- require_relative './attributes/description'
5
- require_relative './attributes/eta'
6
-
7
- module Warframe
8
- module Models
9
- # Global Upgrades data model.
10
- class GlobalUpgrade < Warframe::Models::Base
11
- include Warframe::Models::Attributes::Expired
12
- include Warframe::Models::Attributes::Description
13
- include Warframe::Models::Attributes::ETA
14
-
15
- # The start of the global upgrade.
16
- # @return [String]
17
- attr_reader :start
18
-
19
- # The end of the global upgrade.
20
- # @return [String]
21
- attr_reader :end
22
-
23
- # The upgrade to be received.
24
- # @return [String]
25
- attr_reader :upgrade
26
-
27
- # The operation of the global upgrade.
28
- # @return [String]
29
- attr_reader :operation
30
-
31
- # The symbol of the operation.
32
- # @return [String]
33
- attr_reader :operation_symbol
34
-
35
- # The upgrade operation value.
36
- # @return [Integer]
37
- attr_reader :upgrade_operation_value
38
- end
39
- end
40
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './attributes/expiry'
4
+ require_relative './attributes/description'
5
+ require_relative './attributes/eta'
6
+
7
+ module Warframe
8
+ module Models
9
+ # Global Upgrades data model.
10
+ # {https://api.warframestat.us/pc/globalUpgrades /:platform/globalUpgrades}
11
+ class GlobalUpgrade < Warframe::Models::Base
12
+ include Warframe::Models::Attributes::Expired
13
+ include Warframe::Models::Attributes::Desc
14
+ include Warframe::Models::Attributes::ETA
15
+
16
+ # The start of the global upgrade.
17
+ # @return [String]
18
+ attr_reader :start
19
+
20
+ # The end of the global upgrade.
21
+ # @return [String]
22
+ attr_reader :end
23
+
24
+ # The upgrade to be received.
25
+ # @return [String]
26
+ attr_reader :upgrade
27
+
28
+ # The operation of the global upgrade.
29
+ # @return [String]
30
+ attr_reader :operation
31
+
32
+ # The symbol of the operation.
33
+ # @return [String]
34
+ attr_reader :operation_symbol
35
+
36
+ # The upgrade operation value.
37
+ # @return [Integer]
38
+ attr_reader :upgrade_operation_value
39
+ end
40
+ end
41
+ end
@@ -1,70 +1,71 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative './base'
4
- require_relative './attributes/id'
5
- require_relative './attributes/expiry'
6
- require_relative './attributes/active'
7
- require_relative './attributes/eta'
8
- require_relative './attributes/description'
9
- require_relative './attributes/reward_types'
10
- require_relative './attributes/start_string'
11
-
12
- module Warframe
13
- module Models
14
- # Invasion data model.
15
- class Invasion < Warframe::Models::Base
16
- include Warframe::Models::Attributes::ID
17
- include Warframe::Models::Attributes::Activation
18
- include Warframe::Models::Attributes::Expiry
19
- include Warframe::Models::Attributes::ETA
20
- include Warframe::Models::Attributes::Description
21
- include Warframe::Models::Attributes::RewardTypes
22
- include Warframe::Models::Attributes::StartString
23
-
24
- # Attacking faction data.
25
- # @return [OpenStruct]
26
- attr_reader :attacker
27
-
28
- # The rewards for helping the attacking faction.
29
- # @return [OpenStruct]
30
- attr_reader :attacker_reward
31
-
32
- # Attacking Faction Name
33
- # @return [String]
34
- attr_reader :attacking_faction
35
-
36
- # Whether or not the invasion has been completed.
37
- # @return [Boolean]
38
- attr_reader :completed
39
- alias completed? completed
40
-
41
- # The status of completion of the invasion.
42
- # @return [Array<Float>]
43
- attr_reader :completion
44
-
45
- # Defending faction data.
46
- # @return [OpenStruct]
47
- attr_reader :defender
48
-
49
- # The rewards for helping the defending faction.
50
- # @return [OpenStruct]
51
- attr_reader :defender_reward
52
-
53
- # The name of the defending faction.
54
- # @return [String]
55
- attr_reader :defending_faction
56
-
57
- # The name of the node of the invasion.
58
- # @return [String]
59
- attr_reader :node
60
-
61
- # The key of the node.
62
- # @return [String]
63
- attr_reader :node_key
64
-
65
- # The amount of runs required for completion.
66
- # @return [Integer]
67
- attr_reader :required_runs
68
- end
69
- end
70
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './base'
4
+ require_relative './attributes/id'
5
+ require_relative './attributes/expiry'
6
+ require_relative './attributes/active'
7
+ require_relative './attributes/eta'
8
+ require_relative './attributes/description'
9
+ require_relative './attributes/reward_types'
10
+ require_relative './attributes/start_string'
11
+
12
+ module Warframe
13
+ module Models
14
+ # Invasion data model.
15
+ # {https://api.warframestat.us/pc/invasions /:platform/invasions}
16
+ class Invasion < Warframe::Models::Base
17
+ include Warframe::Models::Attributes::ID
18
+ include Warframe::Models::Attributes::Activation
19
+ include Warframe::Models::Attributes::Expiry
20
+ include Warframe::Models::Attributes::ETA
21
+ include Warframe::Models::Attributes::Description
22
+ include Warframe::Models::Attributes::RewardTypes
23
+ include Warframe::Models::Attributes::StartString
24
+
25
+ # Attacking faction data.
26
+ # @return [OpenStruct]
27
+ attr_reader :attacker
28
+
29
+ # The rewards for helping the attacking faction.
30
+ # @return [OpenStruct]
31
+ attr_reader :attacker_reward
32
+
33
+ # Attacking Faction Name
34
+ # @return [String]
35
+ attr_reader :attacking_faction
36
+
37
+ # Whether or not the invasion has been completed.
38
+ # @return [Boolean]
39
+ attr_reader :completed
40
+ alias completed? completed
41
+
42
+ # The status of completion of the invasion.
43
+ # @return [Array<Float>]
44
+ attr_reader :completion
45
+
46
+ # Defending faction data.
47
+ # @return [OpenStruct]
48
+ attr_reader :defender
49
+
50
+ # The rewards for helping the defending faction.
51
+ # @return [OpenStruct]
52
+ attr_reader :defender_reward
53
+
54
+ # The name of the defending faction.
55
+ # @return [String]
56
+ attr_reader :defending_faction
57
+
58
+ # The name of the node of the invasion.
59
+ # @return [String]
60
+ attr_reader :node
61
+
62
+ # The key of the node.
63
+ # @return [String]
64
+ attr_reader :node_key
65
+
66
+ # The amount of runs required for completion.
67
+ # @return [Integer]
68
+ attr_reader :required_runs
69
+ end
70
+ end
71
+ end
@@ -1,53 +1,54 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative './base'
4
- require_relative './attributes/translations'
5
- require_relative './attributes/eta'
6
- require_relative './attributes/id'
7
-
8
- module Warframe
9
- module Models
10
- # Model for the response of {https://api.warframestat.us/pc/news /:platform/news}
11
- class News < Warframe::Models::Base
12
- include Warframe::Models::Attributes::Translations
13
- include Warframe::Models::Attributes::ETA
14
- include Warframe::Models::Attributes::ID
15
-
16
- # The date the news was released.
17
- # @return [String]
18
- attr_reader :date
19
-
20
- # The image link from the news page.
21
- # @return [String]
22
- attr_reader :image_link
23
-
24
- # Link for more information on this news.
25
- # @return [String]
26
- attr_reader :link
27
-
28
- # Whether or not the news has to do with Prime Access.
29
- # @return [Boolean]
30
- attr_reader :prime_access
31
- alias prime_access? prime_access
32
-
33
- # Whether or not a DEV stream is available.
34
- # @return [Boolean]
35
- attr_reader :stream
36
- alias stream? stream
37
-
38
- # Whether or not this news is regarding an update.
39
- # @return [Boolean]
40
- attr_reader :update
41
- alias update? update
42
-
43
- # Whether or not this news is of priority.
44
- # @return [Boolean]
45
- attr_reader :priority
46
- alias priority? priority
47
-
48
- # The entire response as a long string.
49
- # @return [String]
50
- attr_reader :as_string
51
- end
52
- end
53
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './base'
4
+ require_relative './attributes/translations'
5
+ require_relative './attributes/eta'
6
+ require_relative './attributes/id'
7
+
8
+ module Warframe
9
+ module Models
10
+ # News data model.
11
+ # {https://api.warframestat.us/pc/news /:platform/news}
12
+ class News < Warframe::Models::Base
13
+ include Warframe::Models::Attributes::Translations
14
+ include Warframe::Models::Attributes::ETA
15
+ include Warframe::Models::Attributes::ID
16
+
17
+ # The date the news was released.
18
+ # @return [String]
19
+ attr_reader :date
20
+
21
+ # The image link from the news page.
22
+ # @return [String]
23
+ attr_reader :image_link
24
+
25
+ # Link for more information on this news.
26
+ # @return [String]
27
+ attr_reader :link
28
+
29
+ # Whether or not the news has to do with Prime Access.
30
+ # @return [Boolean]
31
+ attr_reader :prime_access
32
+ alias prime_access? prime_access
33
+
34
+ # Whether or not a DEV stream is available.
35
+ # @return [Boolean]
36
+ attr_reader :stream
37
+ alias stream? stream
38
+
39
+ # Whether or not this news is regarding an update.
40
+ # @return [Boolean]
41
+ attr_reader :update
42
+ alias update? update
43
+
44
+ # Whether or not this news is of priority.
45
+ # @return [Boolean]
46
+ attr_reader :priority
47
+ alias priority? priority
48
+
49
+ # The entire response as a long string.
50
+ # @return [String]
51
+ attr_reader :as_string
52
+ end
53
+ end
54
+ end
@@ -1,39 +1,40 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative './base'
4
- require_relative './attributes/active'
5
- require_relative './attributes/id'
6
- require_relative './attributes/expiry'
7
- require_relative './attributes/reward_types'
8
-
9
- module Warframe
10
- module Models
11
- # Model for the response of {https://api.warframestat.us/pc/nightwave /:platform/nightwave}
12
- class Nightwave < Warframe::Models::Base
13
- include Warframe::Models::Attributes::Activation
14
- include Warframe::Models::Attributes::ID
15
- include Warframe::Models::Attributes::Expiry
16
- include Warframe::Models::Attributes::RewardTypes
17
-
18
- # The current phase of this event.
19
- # @return [Integer]
20
- attr_reader :phase
21
-
22
- # The current Nightwave Tag
23
- # @return [String]
24
- attr_reader :tag
25
-
26
- # The current Nightwave Season
27
- # @return [Integer]
28
- attr_reader :season
29
-
30
- # List of all possible challenges.
31
- # @return [Array<OpenStruct>]
32
- attr_reader :possible_challenges
33
-
34
- # Active Challenges for this event.
35
- # @return [Array<OpenStruct>]
36
- attr_reader :active_challenges
37
- end
38
- end
39
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './base'
4
+ require_relative './attributes/active'
5
+ require_relative './attributes/id'
6
+ require_relative './attributes/expiry'
7
+ require_relative './attributes/reward_types'
8
+
9
+ module Warframe
10
+ module Models
11
+ # Nightwave data model.
12
+ # {https://api.warframestat.us/pc/nightwave /:platform/nightwave}
13
+ class Nightwave < Warframe::Models::Base
14
+ include Warframe::Models::Attributes::Activation
15
+ include Warframe::Models::Attributes::ID
16
+ include Warframe::Models::Attributes::Expiry
17
+ include Warframe::Models::Attributes::RewardTypes
18
+
19
+ # The current phase of this event.
20
+ # @return [Integer]
21
+ attr_reader :phase
22
+
23
+ # The current Nightwave Tag
24
+ # @return [String]
25
+ attr_reader :tag
26
+
27
+ # The current Nightwave Season
28
+ # @return [Integer]
29
+ attr_reader :season
30
+
31
+ # List of all possible challenges.
32
+ # @return [Array<OpenStruct>]
33
+ attr_reader :possible_challenges
34
+
35
+ # Active Challenges for this event.
36
+ # @return [Array<OpenStruct>]
37
+ attr_reader :active_challenges
38
+ end
39
+ end
40
+ end