warframe 0.4.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -13
- data/README.md +39 -34
- data/lib/warframe/api/alerts.rb +14 -0
- data/lib/warframe/api/cambion_drift.rb +16 -0
- data/lib/warframe/api/cetus.rb +16 -0
- data/lib/warframe/api/conclave_challenges.rb +16 -0
- data/lib/warframe/api/global_upgrades.rb +16 -0
- data/lib/warframe/api/invasions.rb +16 -0
- data/lib/warframe/api/news.rb +16 -0
- data/lib/warframe/api/nightwave.rb +16 -0
- data/lib/warframe/api/sortie.rb +16 -0
- data/lib/warframe/api/steel_path.rb +16 -0
- data/lib/warframe/api/syndicate_missions.rb +16 -0
- data/lib/warframe/api/vallis_cycle.rb +16 -0
- data/lib/warframe/api.rb +24 -0
- data/lib/warframe/cache.rb +3 -3
- data/lib/warframe/client.rb +98 -0
- data/lib/warframe/models/alert.rb +16 -23
- data/lib/warframe/models/attributes/description.rb +12 -16
- data/lib/warframe/models/attributes/eta.rb +6 -10
- data/lib/warframe/models/attributes/expiry.rb +20 -24
- data/lib/warframe/models/attributes/id.rb +6 -10
- data/lib/warframe/models/attributes/reward_types.rb +6 -10
- data/lib/warframe/models/attributes/start_string.rb +6 -10
- data/lib/warframe/models/attributes/translations.rb +9 -13
- data/lib/warframe/models/base.rb +5 -30
- data/lib/warframe/models/cambion_drift.rb +14 -19
- data/lib/warframe/models/cetus.rb +25 -30
- data/lib/warframe/models/conclave_challenge.rb +43 -50
- data/lib/warframe/models/global_upgrade.rb +33 -37
- data/lib/warframe/models/invasion.rb +58 -67
- data/lib/warframe/models/news.rb +45 -50
- data/lib/warframe/models/nightwave.rb +24 -30
- data/lib/warframe/models/objectified_hash.rb +74 -0
- data/lib/warframe/models/sortie.rb +21 -27
- data/lib/warframe/models/steel_path.rb +22 -24
- data/lib/warframe/models/syndicate_mission.rb +18 -24
- data/lib/warframe/models/vallis_cycle.rb +21 -26
- data/lib/warframe/models.rb +6 -0
- data/lib/warframe/version.rb +1 -1
- data/lib/warframe.rb +4 -2
- data/warframe.gemspec +9 -13
- metadata +37 -94
- data/lib/warframe/client_wrapper.rb +0 -39
- data/lib/warframe/rest/api/alerts.rb +0 -23
- data/lib/warframe/rest/api/cambion_drift.rb +0 -23
- data/lib/warframe/rest/api/cetus.rb +0 -23
- data/lib/warframe/rest/api/conclave_challenges.rb +0 -23
- data/lib/warframe/rest/api/global_upgrades.rb +0 -23
- data/lib/warframe/rest/api/invasions.rb +0 -23
- data/lib/warframe/rest/api/news.rb +0 -23
- data/lib/warframe/rest/api/nightwave.rb +0 -23
- data/lib/warframe/rest/api/sortie.rb +0 -23
- data/lib/warframe/rest/api/steel_path.rb +0 -23
- data/lib/warframe/rest/api/syndicate_missions.rb +0 -23
- data/lib/warframe/rest/api/vallis_cycle.rb +0 -23
- data/lib/warframe/rest/api.rb +0 -39
- data/lib/warframe/rest/client.rb +0 -42
- data/lib/warframe/rest/request.rb +0 -61
- data/lib/warframe/rest/utils.rb +0 -23
data/lib/warframe/models/news.rb
CHANGED
@@ -1,54 +1,49 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
# The entire response as a long string.
|
50
|
-
# @return [String]
|
51
|
-
attr_reader :as_string
|
52
|
-
end
|
3
|
+
require_rel 'base'
|
4
|
+
|
5
|
+
module Warframe::Models
|
6
|
+
# News data model.
|
7
|
+
# {https://api.warframestat.us/pc/news /:platform/news}
|
8
|
+
class News < Base
|
9
|
+
include Attributes::Translations
|
10
|
+
include Attributes::ETA
|
11
|
+
include Attributes::ID
|
12
|
+
|
13
|
+
# The date the news was released.
|
14
|
+
# @return [String]
|
15
|
+
attr_reader :date
|
16
|
+
|
17
|
+
# The image link from the news page.
|
18
|
+
# @return [String]
|
19
|
+
attr_reader :image_link
|
20
|
+
|
21
|
+
# Link for more information on this news.
|
22
|
+
# @return [String]
|
23
|
+
attr_reader :link
|
24
|
+
|
25
|
+
# Whether or not the news has to do with Prime Access.
|
26
|
+
# @return [Boolean]
|
27
|
+
attr_reader :prime_access
|
28
|
+
alias prime_access? prime_access
|
29
|
+
|
30
|
+
# Whether or not a DEV stream is available.
|
31
|
+
# @return [Boolean]
|
32
|
+
attr_reader :stream
|
33
|
+
alias stream? stream
|
34
|
+
|
35
|
+
# Whether or not this news is regarding an update.
|
36
|
+
# @return [Boolean]
|
37
|
+
attr_reader :update
|
38
|
+
alias update? update
|
39
|
+
|
40
|
+
# Whether or not this news is of priority.
|
41
|
+
# @return [Boolean]
|
42
|
+
attr_reader :priority
|
43
|
+
alias priority? priority
|
44
|
+
|
45
|
+
# The entire response as a long string.
|
46
|
+
# @return [String]
|
47
|
+
attr_reader :as_string
|
53
48
|
end
|
54
49
|
end
|
@@ -1,40 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require_relative './attributes/active'
|
5
|
-
require_relative './attributes/id'
|
6
|
-
require_relative './attributes/expiry'
|
7
|
-
require_relative './attributes/reward_types'
|
3
|
+
require_rel 'base'
|
8
4
|
|
9
|
-
module Warframe
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
include Warframe::Models::Attributes::RewardTypes
|
5
|
+
module Warframe::Models
|
6
|
+
# Nightwave data model.
|
7
|
+
# {https://api.warframestat.us/pc/nightwave /:platform/nightwave}
|
8
|
+
class Nightwave < Base
|
9
|
+
include Attributes::Activation
|
10
|
+
include Attributes::ID
|
11
|
+
include Attributes::Expiry
|
12
|
+
include Attributes::RewardTypes
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
# The current phase of this event.
|
15
|
+
# @return [Integer]
|
16
|
+
attr_reader :phase
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
# The current Nightwave Tag
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :tag
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
# The current Nightwave Season
|
23
|
+
# @return [Integer]
|
24
|
+
attr_reader :season
|
30
25
|
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
# List of all possible challenges.
|
27
|
+
# @return [Array<OpenStruct>]
|
28
|
+
attr_reader :possible_challenges
|
34
29
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
30
|
+
# Active Challenges for this event.
|
31
|
+
# @return [Array<OpenStruct>]
|
32
|
+
attr_reader :active_challenges
|
39
33
|
end
|
40
34
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Warframe::Models
|
4
|
+
# An objectified hash response. Used for turning raw JSON objects into a ruby friendly object.
|
5
|
+
# This can be accessed in multiple formats, ie: JSON `obj['String']` access, Ruby hash `obj[:symbol]`,
|
6
|
+
# Ruby object `obj.method`.
|
7
|
+
# This also handles serialization of nested hashes or arrays of hashes, which in turn will become
|
8
|
+
# a Waframe::Models::ObjectifiedHash.
|
9
|
+
class ObjectifiedHash
|
10
|
+
def initialize(data)
|
11
|
+
@data = transform_to_hash(data)
|
12
|
+
populate_object
|
13
|
+
end
|
14
|
+
|
15
|
+
def [](key)
|
16
|
+
@data[key] || @data[string_to_symbol(key)]
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_hash # rubocop:todo Metrics/CyclomaticComplexity
|
20
|
+
@to_hash ||= @data.each_with_object({}) do |(k, v), hash|
|
21
|
+
v = v.to_h if v.is_a?(Warframe::Models::ObjectifiedHash) && !v.empty?
|
22
|
+
v = v.map(&:to_h) if v.is_a?(Array) && v.first.is_a?(Warframe::Models::ObjectifiedHash)
|
23
|
+
hash[k] = v
|
24
|
+
end
|
25
|
+
end
|
26
|
+
alias to_h to_hash
|
27
|
+
alias hash to_hash
|
28
|
+
|
29
|
+
def to_s
|
30
|
+
@to_s ||= hash.to_s
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.from_array(arr)
|
34
|
+
arr.map { |data| new(data) if data.is_a?(Hash) }.compact
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [String] Formatted string with the class name, object id and original hash.
|
38
|
+
def inspect
|
39
|
+
"#<#{self.class}:#{object_id} { data: #{data.inspect} }".gsub('\"', '')
|
40
|
+
end
|
41
|
+
|
42
|
+
def size
|
43
|
+
@data.size
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
attr_reader :data
|
49
|
+
|
50
|
+
def populate_object # rubocop:todo Metrics/AbcSize
|
51
|
+
data.each do |k, v|
|
52
|
+
if v.is_a?(Hash) && v.size.positive?
|
53
|
+
v = ObjectifiedHash.new(v)
|
54
|
+
elsif v.is_a?(Array) && v.first.is_a?(Hash) && v.first.size.positive?
|
55
|
+
v = ObjectifiedHash.from_array(v)
|
56
|
+
end
|
57
|
+
|
58
|
+
self.class.send(:attr_reader, k)
|
59
|
+
instance_variable_set("@#{k}", v)
|
60
|
+
@data[k] = v
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def transform_to_hash(hash)
|
65
|
+
hash.transform_keys { |data| string_to_symbol(data) }
|
66
|
+
rescue NoMethodError
|
67
|
+
pp "Error decoding: #{hash}"
|
68
|
+
end
|
69
|
+
|
70
|
+
def string_to_symbol(string)
|
71
|
+
string.split(/(?=[A-Z])/).map(&:downcase).join('_').to_sym
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -1,36 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require_relative 'attributes/id'
|
5
|
-
require_relative 'attributes/expiry'
|
6
|
-
require_relative 'attributes/active'
|
7
|
-
require_relative 'attributes/eta'
|
3
|
+
require_rel 'base'
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
include Warframe::Models::Attributes::ETA
|
5
|
+
# Sortie data model.
|
6
|
+
# {https://api.warframestat.us/pc/sortie /:platform/sortie}
|
7
|
+
module Warframe::Models
|
8
|
+
class Sortie < Base
|
9
|
+
include Attributes::ID
|
10
|
+
include Attributes::ActiveBoth
|
11
|
+
include Attributes::Expiration
|
12
|
+
include Attributes::ETA
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
# The boss for this part of the sortie.
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :boss
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
# The faction fighting you in this mission.
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :faction
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
# Modifiers active for this challenge.
|
23
|
+
# @return [Array<OpenStruct>]
|
24
|
+
attr_reader :variants
|
30
25
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
26
|
+
# The reward pool which this is pulling from.
|
27
|
+
# @return [String]
|
28
|
+
attr_reader :reward_pool
|
35
29
|
end
|
36
30
|
end
|
@@ -1,34 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_rel 'base'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
include Warframe::Models::Attributes::Expiry
|
5
|
+
# SteelPath data model.
|
6
|
+
# {https://api.warframestat.us/pc/steelPath /:platform/steelPath}
|
7
|
+
module Warframe::Models
|
8
|
+
class SteelPath < Base
|
9
|
+
include Attributes::Active
|
10
|
+
include Attributes::Expiry
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
# The currently available item from Teshin.
|
13
|
+
# @return [OpenStruct]
|
14
|
+
attr_reader :current_reward
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# The time remaining of the current reward.
|
17
|
+
# @return [String]
|
18
|
+
attr_reader :remaining
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
# Current rotation of items the Arbiters have to offer.
|
21
|
+
# @return [Array<OpenStruct>]
|
22
|
+
attr_reader :rotation
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
# Current rotation of items Teshin has to offer.
|
25
|
+
# @return [Array<OpenStruct>]
|
26
|
+
attr_reader :evergreens
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
28
|
+
# Current incursion data
|
29
|
+
# @return [OpenStruct]
|
30
|
+
attr_reader :incursions
|
33
31
|
end
|
34
32
|
end
|
@@ -1,32 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require_relative 'attributes/eta'
|
5
|
-
require_relative 'attributes/id'
|
6
|
-
require_relative 'attributes/active'
|
7
|
-
require_relative 'attributes/start_string'
|
3
|
+
require_rel 'base'
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
include Warframe::Models::Attributes::StartString
|
5
|
+
# SyndicateMission data model.
|
6
|
+
# {https://api.warframestat.us/pc/syndicateMissions /:platform/syndicateMissions}
|
7
|
+
module Warframe::Models
|
8
|
+
class SyndicateMission < Base
|
9
|
+
include Attributes::ETA
|
10
|
+
include Attributes::ID
|
11
|
+
include Attributes::ActiveBoth
|
12
|
+
include Attributes::StartString
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
# 'Jobs' or challenges currently available.
|
15
|
+
# @return [Array<OpenStruct>]
|
16
|
+
attr_reader :jobs
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
# The syndicate you will be fighting.
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :syndicate
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
22
|
+
# The nodes that this mission is available on.
|
23
|
+
# @return [Array]
|
24
|
+
attr_reader :nodes
|
31
25
|
end
|
32
26
|
end
|
@@ -1,35 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
include Warframe::Models::Attributes::Activation
|
5
|
+
module Warframe::Models
|
6
|
+
# Model for VallisCycle data.
|
7
|
+
# {https://api.warframestat.us/pc/vallisCycle /:platform/vallisCycle}
|
8
|
+
class VallisCycle < Base
|
9
|
+
include Attributes::ID
|
10
|
+
include Attributes::Expiry
|
11
|
+
include Attributes::Activation
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
# @!attribute time_left
|
14
|
+
# @return [String] time left until next cycle.
|
15
|
+
attr_reader :time_left
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
# @!attribute is_warm?
|
18
|
+
# @return [Boolean] whether or not it currently is warm.
|
19
|
+
attr_reader :is_warm
|
20
|
+
alias is_warm? is_warm
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
# @!attribute state
|
23
|
+
# @return [String] the current world state (Cold or Warm)
|
24
|
+
attr_reader :state
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
26
|
+
# @!attribute short_string
|
27
|
+
# @return [String] the time remaining until state change. Ex: `5m to Warm`.
|
28
|
+
attr_reader :short_string
|
34
29
|
end
|
35
30
|
end
|
data/lib/warframe/version.rb
CHANGED
data/lib/warframe.rb
CHANGED
data/warframe.gemspec
CHANGED
@@ -12,13 +12,13 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = 'A Ruby interface to the WarframeStat API.'
|
13
13
|
spec.description = spec.summary
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.homepage = 'https://
|
15
|
+
spec.homepage = 'https://gitlab.com/aj-rom/warframe-ruby'
|
16
16
|
|
17
17
|
# MetaData
|
18
|
-
spec.metadata['source_code_uri'] = spec.homepage
|
19
|
-
spec.metadata['changelog_uri'] = "#{spec.homepage}/
|
20
|
-
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}
|
21
|
-
spec.metadata['documentation_uri'] = "https://rubydoc.info/gems/#{spec.name}"
|
18
|
+
spec.metadata['source_code_uri'] = "#{spec.homepage}/-/tree/v#{spec.version}"
|
19
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/-/tree/v#{spec.version}/CHANGELOG.md"
|
20
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/-/issues"
|
21
|
+
spec.metadata['documentation_uri'] = "https://rubydoc.info/gems/#{spec.name}/#{spec.version}"
|
22
22
|
|
23
23
|
# Executables / Files
|
24
24
|
spec.bindir = 'exe'
|
@@ -31,15 +31,11 @@ Gem::Specification.new do |spec|
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# Dependencies
|
34
|
-
spec.required_ruby_version = '>= 2.
|
34
|
+
spec.required_ruby_version = '>= 2.3' # rubocop:disable Gemspec/RequiredRubyVersion
|
35
35
|
spec.add_dependency 'fast_underscore', '~> 0.3'
|
36
|
-
spec.add_dependency '
|
37
|
-
spec.add_dependency '
|
36
|
+
spec.add_dependency 'require_all', '~> 3.0'
|
37
|
+
spec.add_dependency 'rest-client', '~> 2.1'
|
38
38
|
|
39
39
|
# Development Dependencies
|
40
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
41
|
-
spec.add_development_dependency 'rspec', '~> 3.9'
|
42
|
-
spec.add_development_dependency 'rubocop', '~> 1.24'
|
43
|
-
spec.add_development_dependency 'thor', '~> 1.1'
|
44
|
-
spec.add_development_dependency 'yard', '~> 0.9'
|
40
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
45
41
|
end
|