warframe 0.3.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -0
  3. data/README.md +39 -34
  4. data/lib/warframe/api/alerts.rb +14 -0
  5. data/lib/warframe/api/cambion_drift.rb +16 -0
  6. data/lib/warframe/api/cetus.rb +16 -0
  7. data/lib/warframe/api/conclave_challenges.rb +16 -0
  8. data/lib/warframe/api/global_upgrades.rb +16 -0
  9. data/lib/warframe/api/invasions.rb +16 -0
  10. data/lib/warframe/api/news.rb +16 -0
  11. data/lib/warframe/api/nightwave.rb +16 -0
  12. data/lib/warframe/api/sortie.rb +16 -0
  13. data/lib/warframe/api/steel_path.rb +16 -0
  14. data/lib/warframe/api/syndicate_missions.rb +16 -0
  15. data/lib/warframe/api/vallis_cycle.rb +16 -0
  16. data/lib/warframe/api.rb +24 -0
  17. data/lib/warframe/cache.rb +3 -3
  18. data/lib/warframe/client.rb +98 -0
  19. data/lib/warframe/models/alert.rb +16 -23
  20. data/lib/warframe/models/attributes/active.rb +2 -2
  21. data/lib/warframe/models/attributes/description.rb +12 -16
  22. data/lib/warframe/models/attributes/eta.rb +6 -10
  23. data/lib/warframe/models/attributes/expiry.rb +20 -24
  24. data/lib/warframe/models/attributes/id.rb +6 -10
  25. data/lib/warframe/models/attributes/reward_types.rb +6 -10
  26. data/lib/warframe/models/attributes/start_string.rb +6 -10
  27. data/lib/warframe/models/attributes/translations.rb +9 -13
  28. data/lib/warframe/models/base.rb +5 -30
  29. data/lib/warframe/models/cambion_drift.rb +14 -19
  30. data/lib/warframe/models/cetus.rb +25 -30
  31. data/lib/warframe/models/conclave_challenge.rb +43 -50
  32. data/lib/warframe/models/global_upgrade.rb +33 -37
  33. data/lib/warframe/models/invasion.rb +58 -67
  34. data/lib/warframe/models/news.rb +45 -50
  35. data/lib/warframe/models/nightwave.rb +24 -30
  36. data/lib/warframe/models/objectified_hash.rb +74 -0
  37. data/lib/warframe/models/sortie.rb +21 -27
  38. data/lib/warframe/models/steel_path.rb +22 -24
  39. data/lib/warframe/models/syndicate_mission.rb +18 -24
  40. data/lib/warframe/models/vallis_cycle.rb +30 -0
  41. data/lib/warframe/models.rb +6 -0
  42. data/lib/warframe/version.rb +1 -1
  43. data/lib/warframe.rb +4 -2
  44. data/warframe.gemspec +41 -0
  45. metadata +42 -106
  46. data/lib/warframe/client_wrapper.rb +0 -39
  47. data/lib/warframe/rest/api/alerts.rb +0 -23
  48. data/lib/warframe/rest/api/cambion_drift.rb +0 -23
  49. data/lib/warframe/rest/api/cetus.rb +0 -23
  50. data/lib/warframe/rest/api/conclave_challenges.rb +0 -23
  51. data/lib/warframe/rest/api/global_upgrades.rb +0 -23
  52. data/lib/warframe/rest/api/invasions.rb +0 -23
  53. data/lib/warframe/rest/api/news.rb +0 -23
  54. data/lib/warframe/rest/api/nightwave.rb +0 -23
  55. data/lib/warframe/rest/api/sortie.rb +0 -23
  56. data/lib/warframe/rest/api/steel_path.rb +0 -23
  57. data/lib/warframe/rest/api/syndicate_missions.rb +0 -23
  58. data/lib/warframe/rest/api.rb +0 -37
  59. data/lib/warframe/rest/client.rb +0 -42
  60. data/lib/warframe/rest/request.rb +0 -61
  61. data/lib/warframe/rest/utils.rb +0 -23
@@ -1,30 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Warframe
4
- module Models
5
- # Common Attributes between models.
6
- module Attributes
7
- # Includes the expiry attribute.
8
- module Expiry
9
- # When the event will expire.
10
- # @return [String]
11
- attr_reader :expiry
12
- end
3
+ # Common Attributes between models.
4
+ module Warframe::Models::Attributes
5
+ # Includes the expiry attribute.
6
+ module Expiry
7
+ # When the event will expire.
8
+ # @return [String]
9
+ attr_reader :expiry
10
+ end
13
11
 
14
- # Adds a boolean attribute expired? to see whether or not the even has expired.
15
- module Expired
16
- # Whether or not the event has expired.
17
- # @return [Boolean]
18
- attr_reader :expired
19
- alias expired? expired
20
- end
12
+ # Adds a boolean attribute expired? to see whether or not the even has expired.
13
+ module Expired
14
+ # Whether or not the event has expired.
15
+ # @return [Boolean]
16
+ attr_reader :expired
17
+ alias expired? expired
18
+ end
21
19
 
22
- # Adds the {Warframe::Models::Attributes::Expiry Attributes::Expiry} &
23
- # {Warframe::Models::Attributes::Expired Attributes::Expired} attributes.
24
- module Expiration
25
- include Expiry
26
- include Expired
27
- end
28
- end
20
+ # Adds the {Warframe::Models::Attributes::Expiry Attributes::Expiry} &
21
+ # {Warframe::Models::Attributes::Expired Attributes::Expired} attributes.
22
+ module Expiration
23
+ include Expiry
24
+ include Expired
29
25
  end
30
26
  end
@@ -1,14 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Warframe
4
- module Models
5
- module Attributes
6
- # Unique data response ID.
7
- module ID
8
- # The unique ID of the event.
9
- # @return [String]
10
- attr_reader :id
11
- end
12
- end
3
+ # Unique data response ID.
4
+ module Warframe::Models::Attributes
5
+ module ID
6
+ # The unique ID of the event.
7
+ # @return [String]
8
+ attr_reader :id
13
9
  end
14
10
  end
@@ -1,14 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Warframe
4
- module Models
5
- module Attributes
6
- # The types of rewards you can get from this event.
7
- module RewardTypes
8
- # The types of rewards you can get from this event.
9
- # @return [Array<String>]
10
- attr_reader :reward_types
11
- end
12
- end
3
+ # The types of rewards you can get from this event.
4
+ module Warframe::Models::Attributes
5
+ module RewardTypes
6
+ # The types of rewards you can get from this event.
7
+ # @return [Array<String>]
8
+ attr_reader :reward_types
13
9
  end
14
10
  end
@@ -1,14 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Warframe
4
- module Models
5
- module Attributes
6
- # Adds the start_string attribute, for when an event will begin.
7
- module StartString
8
- # When this event goes into effect.
9
- # @return [String]
10
- attr_reader :start_string
11
- end
12
- end
3
+ # Adds the start_string attribute, for when an event will begin.
4
+ module Warframe::Models::Attributes
5
+ module StartString
6
+ # When this event goes into effect.
7
+ # @return [String]
8
+ attr_reader :start_string
13
9
  end
14
10
  end
@@ -1,18 +1,14 @@
1
1
  # frozen_string_literal: true
2
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
3
+ # Includes the translations attribute.
4
+ module Warframe::Models::Attributes
5
+ module Translations
6
+ # The message that can be translated.
7
+ # @return [String]
8
+ attr_reader :message
11
9
 
12
- # Available translations for the requested data.
13
- # @return [OpenStruct]
14
- attr_reader :translations
15
- end
16
- end
10
+ # Available translations for the requested data.
11
+ # @return [OpenStruct]
12
+ attr_reader :translations
17
13
  end
18
14
  end
@@ -1,36 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'fast_underscore'
4
+ require_rel 'attributes'
5
+ require_rel 'objectified_hash'
4
6
 
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
7
+ module Warframe::Models
8
+ # Warframe Base Model.
9
+ class Base < ObjectifiedHash
35
10
  end
36
11
  end
@@ -1,26 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './base'
4
- require_relative 'attributes/id'
5
- require_relative 'attributes/expiry'
6
- require_relative 'attributes/active'
3
+ require_rel 'base'
7
4
 
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
5
+ module Warframe::Models
6
+ # Cambion Drift data model.
7
+ # {https://api.warframestat.us/pc/cambionCycle /:platform/cambionCycle}
8
+ class CambionDrift < Base
9
+ include Attributes::ID
10
+ include Attributes::Activation
11
+ include Attributes::Expiry
16
12
 
17
- # Current active state of the world, either 'vome' or 'fass'.
18
- # @return [String]
19
- attr_reader :active
13
+ # Current active state of the world, either 'vome' or 'fass'.
14
+ # @return [String]
15
+ attr_reader :active
20
16
 
21
- # The time remaining until world state switches.
22
- # @return [String]
23
- attr_reader :time_left
24
- end
17
+ # The time remaining until world state switches.
18
+ # @return [String]
19
+ attr_reader :time_left
25
20
  end
26
21
  end
@@ -1,40 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './base'
4
- require_relative 'attributes/id'
5
- require_relative 'attributes/active'
6
- require_relative 'attributes/expiry'
3
+ require_rel 'base'
7
4
 
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
5
+ module Warframe::Models
6
+ # Cetus data model.
7
+ # {https://api.warframestat.us/pc/cetusCycle /:platform/cetusCycle}
8
+ class Cetus < Base
9
+ include Attributes::ID
10
+ include Attributes::Activation
11
+ include Attributes::Expiry
16
12
 
17
- # Whether or not it is currently day.
18
- # @return [Boolean]
19
- attr_reader :is_day
20
- alias day? is_day
13
+ # Whether or not it is currently day.
14
+ # @return [Boolean]
15
+ attr_reader :is_day
16
+ alias day? is_day
21
17
 
22
- # Current world state of Cetus.
23
- # @return [String]
24
- attr_reader :state
18
+ # Current world state of Cetus.
19
+ # @return [String]
20
+ attr_reader :state
25
21
 
26
- # Whether or not this is Cetus.
27
- # @return [Boolean]
28
- attr_reader :is_cetus
29
- alias cetus? is_cetus
22
+ # Whether or not this is Cetus.
23
+ # @return [Boolean]
24
+ attr_reader :is_cetus
25
+ alias cetus? is_cetus
30
26
 
31
- # Time left until state change.
32
- # @return [String]
33
- attr_reader :time_left
27
+ # Time left until state change.
28
+ # @return [String]
29
+ attr_reader :time_left
34
30
 
35
- # A short string of the time left until state change.
36
- # @return [String]
37
- attr_reader :short_string
38
- end
31
+ # A short string of the time left until state change.
32
+ # @return [String]
33
+ attr_reader :short_string
39
34
  end
40
35
  end
@@ -1,54 +1,47 @@
1
1
  # frozen_string_literal: true
2
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
3
+ require_rel 'base'
4
+
5
+ module Warframe::Models
6
+ # Conclave Challenges data model.
7
+ # {https://api.warframestat.us/pc/conclaveChallenges /:platform/conclaveChallenges}
8
+ class ConclaveChallenge < Base
9
+ include Attributes::Expiration
10
+ include Attributes::ETA
11
+ include Attributes::Description
12
+ include Attributes::ID
13
+ include Attributes::Activation
14
+
15
+ # The mode of the conclave.
16
+ # @return [String]
17
+ attr_reader :mode
18
+
19
+ # The amount of challenges that must be completed.
20
+ # @return [Integer]
21
+ attr_reader :amount
22
+
23
+ # The amount of standing you will gain upon completion.
24
+ # @return [Integer]
25
+ attr_reader :standing
26
+
27
+ # The title of the challenge.
28
+ # @return [String]
29
+ attr_reader :title
30
+
31
+ # The category of mission, usually 'weekly' / 'daily'.
32
+ # @return [String]
33
+ attr_reader :category
34
+
35
+ # Whether or not this is a daily mission.
36
+ # @return [Boolean]
37
+ attr_reader :daily
38
+
39
+ # The challenge information in a one line string.
40
+ # @return [String]
41
+ attr_reader :as_string
42
+
43
+ # Whether or not this is a root challenge.
44
+ # @return [Boolean]
45
+ attr_reader :root_challenge
53
46
  end
54
47
  end
@@ -1,41 +1,37 @@
1
1
  # frozen_string_literal: true
2
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
3
+ require_rel 'base'
4
+
5
+ module Warframe::Models
6
+ # Global Upgrades data model.
7
+ # {https://api.warframestat.us/pc/globalUpgrades /:platform/globalUpgrades}
8
+ class GlobalUpgrade < Base
9
+ include Attributes::Expired
10
+ include Attributes::Desc
11
+ include Attributes::ETA
12
+
13
+ # The start of the global upgrade.
14
+ # @return [String]
15
+ attr_reader :start
16
+
17
+ # The end of the global upgrade.
18
+ # @return [String]
19
+ attr_reader :end
20
+
21
+ # The upgrade to be received.
22
+ # @return [String]
23
+ attr_reader :upgrade
24
+
25
+ # The operation of the global upgrade.
26
+ # @return [String]
27
+ attr_reader :operation
28
+
29
+ # The symbol of the operation.
30
+ # @return [String]
31
+ attr_reader :operation_symbol
32
+
33
+ # The upgrade operation value.
34
+ # @return [Integer]
35
+ attr_reader :upgrade_operation_value
40
36
  end
41
37
  end
@@ -1,71 +1,62 @@
1
1
  # frozen_string_literal: true
2
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
3
+ require_rel 'base'
4
+
5
+ module Warframe::Models
6
+ # Invasion data model.
7
+ # {https://api.warframestat.us/pc/invasions /:platform/invasions}
8
+ class Invasion < Base
9
+ include Attributes::ID
10
+ include Attributes::Activation
11
+ include Attributes::Expiry
12
+ include Attributes::ETA
13
+ include Attributes::Description
14
+ include Attributes::RewardTypes
15
+ include Attributes::StartString
16
+
17
+ # Attacking faction data.
18
+ # @return [OpenStruct]
19
+ attr_reader :attacker
20
+
21
+ # The rewards for helping the attacking faction.
22
+ # @return [OpenStruct]
23
+ attr_reader :attacker_reward
24
+
25
+ # Attacking Faction Name
26
+ # @return [String]
27
+ attr_reader :attacking_faction
28
+
29
+ # Whether or not the invasion has been completed.
30
+ # @return [Boolean]
31
+ attr_reader :completed
32
+ alias completed? completed
33
+
34
+ # The status of completion of the invasion.
35
+ # @return [Array<Float>]
36
+ attr_reader :completion
37
+
38
+ # Defending faction data.
39
+ # @return [OpenStruct]
40
+ attr_reader :defender
41
+
42
+ # The rewards for helping the defending faction.
43
+ # @return [OpenStruct]
44
+ attr_reader :defender_reward
45
+
46
+ # The name of the defending faction.
47
+ # @return [String]
48
+ attr_reader :defending_faction
49
+
50
+ # The name of the node of the invasion.
51
+ # @return [String]
52
+ attr_reader :node
53
+
54
+ # The key of the node.
55
+ # @return [String]
56
+ attr_reader :node_key
57
+
58
+ # The amount of runs required for completion.
59
+ # @return [Integer]
60
+ attr_reader :required_runs
70
61
  end
71
62
  end