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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c41bb2e150afd7f4885bf7c988a9f4b62b4a7867ec22bcb11b1b868fcd5ec68e
|
4
|
+
data.tar.gz: eb8aa4b8f9125a7b5fb3871f741569f0b7cd331ba007e3fa7dad39b0993c8a99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70dfc7b98ee37259ee69ad87ab3a5b8d08db227b1c999037a19e21f1d38c86bc49110f99d3a88695dd7bb27c82119bffe5c5a02a29f9916fe9a87fd20dce508e
|
7
|
+
data.tar.gz: f581f1e361862ae0760b73f1fadea8883a9d8f8a696db8e08a84aae7f9b3de9d51099cd40d9ab598d753a3a9b78410b4b1165b223977817e785b8dfb0b9ab540
|
data/CHANGELOG.md
CHANGED
@@ -1,26 +1,45 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
### [1.0.0](https://www.gitlab.com/aj-rom/warframe-ruby/compare/v0.4.0...v1.0.0) (2022-06-1)
|
4
4
|
|
5
|
+
#### Breaking Changes
|
5
6
|
|
6
|
-
|
7
|
+
- **dependencies** use require_all to load moudlar project ([72359701](https://gitlab.com/aj-rom/warframe-ruby/-/merge_requests/65/diffs?commit_id=72359701addd0f588757a4a9122e94b275c490f3))
|
8
|
+
- **repository:** Moved to https://gitlab.com/aj-rom/warframe-ruby which in turn broke some pre-existing lings on older versions.
|
9
|
+
- **refactor:**
|
10
|
+
- remove no longer used helper files ([f312f5f7](https://gitlab.com/aj-rom/warframe-ruby/-/merge_requests/65/diffs?commit_id=fef7852d7a255093fb6e2e7a1209614bd5dfa914))
|
11
|
+
- Remodularize 'Rest' into main module ([9d681b4b](https://gitlab.com/aj-rom/warframe-ruby/-/merge_requests/65/diffs?commit_id=9d681b4b91f53e0f06a1d0b62dd851aef56248b1))
|
12
|
+
- Remove unecessary client wrapper ([8956cfe6](https://gitlab.com/aj-rom/warframe-ruby/-/merge_requests/65/diffs?commit_id=8956cfe63465594a860d8df1c42fd5c899ab4a88))
|
7
13
|
|
8
|
-
|
14
|
+
#### Features
|
9
15
|
|
10
|
-
|
16
|
+
- **cache:** allow cache to be instantiated from hash ([fef7852](https://gitlab.com/aj-rom/warframe-ruby/commit/fef7852d7a255093fb6e2e7a1209614bd5dfa914))
|
17
|
+
- **dependencies:** Update runtime dependencies ([65086ca](https://gitlab.com/aj-rom/warframe-ruby/commit/65086ca6795d4d8352adc8926bda9938ffde152a))
|
18
|
+
- **refactor:** Remodularize 'Models' to include attributes ([e3eae5d](https://gitlab.com/aj-rom/warframe-ruby/commit/e3eae5de6cd4be7ec88643038d3d8d6a9ab49bf4))
|
11
19
|
|
20
|
+
#### Bug Fixes
|
12
21
|
|
13
|
-
|
22
|
+
- **Gem:** resolve ruby versions less than 2.5 being unable to install ([b53247c](https://gitlab.com/aj-rom/warframe-ruby/commit/b53247c23524c28a890114208a9ecd6ec22468d2))
|
23
|
+
- **README:** update README for v1.0.0 ([c623c2a](https://gitlab.com/aj-rom/warframe-ruby/commit/c623c2aa75e73ed1becdbad01a8ce7fa770a4a9e))
|
14
24
|
|
15
|
-
|
16
|
-
* **dependencies:** add support for no bundler ([741aff8](https://www.github.com/WFCD/warframe-ruby/commit/741aff8c9d271c80419d1c8046aab37889443514))
|
17
|
-
* **dependencies:** remove lock file ([86890fe](https://www.github.com/WFCD/warframe-ruby/commit/86890fec76e702db5d8ee397d875aae28299a262))
|
18
|
-
* **docs:** fix incorrect attribute module ([cad978b](https://www.github.com/WFCD/warframe-ruby/commit/cad978bc42679e6a7240b5f6045b70e0fc157f3c))
|
25
|
+
### [0.4.0](https://www.gitlab.com/aj-rom/warframe-ruby/compare/v0.3.2...v0.4.0) (2022-01-02)
|
19
26
|
|
20
|
-
|
27
|
+
#### Features
|
21
28
|
|
29
|
+
- **REST:** add `vallisCycle` route. ([#61](https://www.gitlab.com/aj-rom/warframe-ruby/issues/61)) ([f81577f](https://www.gitlab.com/aj-rom/warframe-ruby/commit/f81577fc6af0ec45948cfd57cc1d67de684ce03c))
|
22
30
|
|
23
|
-
###
|
31
|
+
### [0.3.2](https://www.gitlab.com/aj-rom/warframe-ruby/compare/v0.3.1...v0.3.2) (2021-12-29)
|
24
32
|
|
25
|
-
|
26
|
-
|
33
|
+
#### Bug Fixes
|
34
|
+
|
35
|
+
- **changelog:** added changelog to gemspec. [#54](https://www.gitlab.com/aj-rom/warframe-ruby/issues/54) ([0164546](https://www.gitlab.com/aj-rom/warframe-ruby/commit/01645466c75069800b2f69f1146625e5dc6f6775))
|
36
|
+
- **dependencies:** add support for no bundler ([741aff8](https://www.gitlab.com/aj-rom/warframe-ruby/commit/741aff8c9d271c80419d1c8046aab37889443514))
|
37
|
+
- **dependencies:** remove lock file ([86890fe](https://www.gitlab.com/aj-rom/warframe-ruby/commit/86890fec76e702db5d8ee397d875aae28299a262))
|
38
|
+
- **docs:** fix incorrect attribute module ([cad978b](https://www.gitlab.com/aj-rom/warframe-ruby/commit/cad978bc42679e6a7240b5f6045b70e0fc157f3c))
|
39
|
+
|
40
|
+
### [0.3.1](https://www.gitlab.com/aj-rom/warframe-ruby/compare/v0.3.0...v0.3.1) (2021-12-14)
|
41
|
+
|
42
|
+
#### Bug Fixes
|
43
|
+
|
44
|
+
- **dependencies:** generify runtime bundler dependency ([d0bd8ad](https://www.gitlab.com/aj-rom/warframe-ruby/commit/d0bd8ad2f4096dade9175461c0c4a1c8cc2114ca))
|
45
|
+
- **dependencies:** update thor to v1.1.0 ([2598318](https://www.gitlab.com/aj-rom/warframe-ruby/commit/2598318b351cfd07f7a691305cc1141681db598b))
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# warframe-ruby
|
2
|
+
|
2
3
|
[![Supported by Warframe Community Developers](https://warframestat.us/wfcd.png)](https://github.com/WFCD/banner/blob/main/PROJECTS.md "Supported by Warframe Community Developers")
|
3
4
|
[![Ruby Gem Version](https://badgen.net/rubygems/v/warframe)](https://rubygems.org/gems/warframe)
|
4
5
|
[![Downloads](https://badgen.net/rubygems/dt/warframe)](https://rubygems.org/gems/warframe)
|
5
6
|
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
|
6
7
|
[![Platform](https://badgen.net/rubygems/p/warframe)](https://www.ruby-lang.org/en/)
|
7
8
|
|
8
|
-
|
9
9
|
A Ruby client for [Warframe Stat](https://warframestat.us) bringing you live modeled data from their API.
|
10
10
|
|
11
11
|
## Installation
|
@@ -18,81 +18,86 @@ gem 'warframe'
|
|
18
18
|
|
19
19
|
And then execute:
|
20
20
|
|
21
|
-
|
21
|
+
```console
|
22
|
+
bundle install
|
23
|
+
```
|
22
24
|
|
23
25
|
Or install it yourself as:
|
24
26
|
|
25
|
-
|
27
|
+
```console
|
28
|
+
gem install warframe
|
29
|
+
```
|
26
30
|
|
27
31
|
## Usage
|
28
32
|
|
29
|
-
To get started accessing live data, you must instantiate a new `Warframe::
|
33
|
+
To get started accessing live data, you must instantiate a new `Warframe::Client`
|
34
|
+
|
30
35
|
```ruby
|
31
36
|
require 'warframe'
|
32
37
|
|
33
|
-
|
38
|
+
Warframe::Client.new # => <Warframe::Client platform='pc' language='en'>
|
39
|
+
|
40
|
+
Warframe::Client.new(platform: 'xb1', language: 'fr') # => <Warframe::Client platform='xb1' language='fr'>
|
34
41
|
|
35
42
|
# You can supply a hash to set your preferred platform or language.
|
36
43
|
my_custom_options = { platform: 'ps4', language: 'de' }
|
37
|
-
|
44
|
+
Warframe::Client.new my_custom_options # => <Warframe::Client platform='ps4' language='de'>
|
38
45
|
```
|
39
46
|
|
40
47
|
This gives us access to a plethora of methods, check out the [documentation](https://rubydoc.info/gems/warframe) for more info.
|
41
|
-
```ruby
|
42
48
|
|
43
|
-
|
49
|
+
```ruby
|
50
|
+
client = Warframe::Client.new
|
44
51
|
client.nightwave # => <Warframe::Models::Nightwave>
|
45
52
|
client.alerts # => [ <Warframe::Models::Alert>, <Warframe::Models::Alert> ]
|
46
53
|
```
|
47
54
|
|
48
55
|
## Documentation
|
49
56
|
|
50
|
-
Documentation is currently provided by [rubydoc.info](https://rubydoc.info), check out the current versions documentation at https://rubydoc.info/gems/warframe
|
57
|
+
Documentation is currently provided by [rubydoc.info](https://rubydoc.info), check out the current versions documentation at <https://rubydoc.info/gems/warframe>.
|
51
58
|
|
52
59
|
## Development
|
53
60
|
|
61
|
+
### Ruby Versions
|
62
|
+
|
63
|
+
We plan to support only support *stable* Ruby versions that have yet to reach [end of life](https://endoflife.date/ruby).
|
64
|
+
Although leave the required Ruby version to the lowest of our runtime dependencies in case anyone would like to use an older version.
|
65
|
+
|
66
|
+
| Version | Tested | Status |
|
67
|
+
| --- | --- | --- |
|
68
|
+
| `3.1` | :white_check_mark: | :white_check_mark: |
|
69
|
+
| `3.0` | :white_check_mark: | :white_check_mark: |
|
70
|
+
| `2.7` | :white_check_mark: | :white_check_mark: |
|
71
|
+
| `2.3+` | :no_entry_sign: | :white_check_mark: |
|
72
|
+
| `2.2-` | :no_entry_sign: | :no_entry_sign: |
|
73
|
+
|
54
74
|
### Dependency Management
|
55
|
-
After checking out the repo, run:
|
56
75
|
|
57
|
-
|
58
|
-
|
76
|
+
After checking out the repo, run:
|
77
|
+
|
78
|
+
- ```bundle install```
|
79
|
+
|
59
80
|
> This will install all required dependencies for this gem to run.
|
60
81
|
|
61
82
|
### Testing
|
83
|
+
|
62
84
|
To check if your changes are passing tests, run:
|
63
85
|
|
64
|
-
|
86
|
+
- ```bundle exec rspec```
|
65
87
|
|
66
88
|
> Testing framework provided by [RSpec](https://rspec.info/).
|
67
89
|
|
68
90
|
### Linting
|
69
|
-
To auto-correct styling offenses, run:
|
70
91
|
|
71
|
-
|
92
|
+
To auto-correct styling offenses, run:
|
72
93
|
|
73
|
-
|
94
|
+
- ```bundle exec rubocop -A```
|
74
95
|
|
75
|
-
|
76
|
-
Using Thor allows us to create new routes and models via the command line, making it very simple to add new elements.
|
77
|
-
|
78
|
-
For example if we wanted to add, [conclaveChallenges](https://docs.warframestat.us/#tag/Worldstate/paths/~1{platform}~1conclaveChallenges/get) we run:
|
79
|
-
|
80
|
-
$ thor generate conclaveChallenges
|
81
|
-
|
82
|
-
> create lib/warframe/models/conclave_challenge.rb
|
83
|
-
> create lib/warframe/rest/api/conclave_challenges.rb
|
84
|
-
> conflict lib/warframe/rest/api.rb
|
85
|
-
> Overwrite ~/warframe/lib/warframe/rest/api.rb? (enter "h" for help) [Ynaqdh]
|
86
|
-
|
87
|
-
$ Y
|
88
|
-
|
89
|
-
> force lib/warframe/rest/api.rb
|
90
|
-
|
91
|
-
This creates a blank [model](/lib/warframe/models) for the data and a [route](/lib/warframe/rest/api) with a name spaced method for it, and then adds this method to our [REST::API](/lib/warframe/rest/api). Add attributes to the corresponding model and then write associated tests.
|
96
|
+
> All linting is provided by [RuboCop](https://github.com/rubocop/rubocop).
|
92
97
|
|
93
98
|
## Contributing
|
94
99
|
|
95
|
-
Bug reports and pull requests are welcome on
|
100
|
+
Bug reports and pull requests are welcome on GitLab at <https://gitlab.com/aj-rom/warframe-ruby>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/aj-rom/warframe-ruby/blob/master/CODE_OF_CONDUCT.md).
|
96
101
|
|
97
102
|
## License
|
98
103
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Warframe::API
|
4
|
+
# API endpoint for getting information on current Alerts data.
|
5
|
+
#
|
6
|
+
# {https://api.warframestat.us/pc/alerts Example Response}
|
7
|
+
module Alerts
|
8
|
+
# Gets the current Alerts data.
|
9
|
+
# @return [Array<[Warframe::Models::Alert]>]
|
10
|
+
def alerts
|
11
|
+
get('/alerts', Warframe::Models::Alert)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/cambion_drift'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information on current Cambion Drift data.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/cambionDrift Example Response}
|
9
|
+
module CambionDrift
|
10
|
+
# Gets the current cambionDrift Data.
|
11
|
+
# @return Warframe::Models::CambionDrift
|
12
|
+
def cambion_drift
|
13
|
+
get('/cambionCycle', Warframe::Models::CambionDrift)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/cetus'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information on current Cetus data.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/cetusCycle Example Response}
|
9
|
+
module Cetus
|
10
|
+
# Gets the current cetusCycle Data.
|
11
|
+
# @return [Warframe::Models::Cetus]
|
12
|
+
def cetus
|
13
|
+
get('/cetusCycle', Warframe::Models::Cetus)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/conclave_challenge'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information on current Conclave Challenge data.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/conclaveChallenges Example Response}
|
9
|
+
module ConclaveChallenges
|
10
|
+
# Gets the current conclave challenges.
|
11
|
+
# @return [Array<Warframe::Models::ConclaveChallenge>]
|
12
|
+
def conclave_challenges
|
13
|
+
get('/conclaveChallenges', Warframe::Models::ConclaveChallenge)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/global_upgrade'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information on current Global Upgrades data.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/globalUpgrades Example Response}
|
9
|
+
module GlobalUpgrades
|
10
|
+
# Gets the current Global Upgrades data.
|
11
|
+
# @return [Array<[Warframe::Models::GlobalUpgrade]>]
|
12
|
+
def global_upgrades
|
13
|
+
get('/globalUpgrades', Warframe::Models::GlobalUpgrade)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/invasion'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information on current Invasions data.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/invasions Example Response}
|
9
|
+
module Invasions
|
10
|
+
# Gets the current Invasions data.
|
11
|
+
# @return [Array<[Warframe::Models::Invasion]>]
|
12
|
+
def invasions
|
13
|
+
get('/invasions', Warframe::Models::Invasion)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/news'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information from the News route.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/news Example Response}
|
9
|
+
module News
|
10
|
+
# Gets the current news data.
|
11
|
+
# @return [Array<Warframe::Models::News>]
|
12
|
+
def news
|
13
|
+
get('/news', Warframe::Models::News)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/nightwave'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information from the Nightwave route.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/nightwave Example Response}
|
9
|
+
module Nightwave
|
10
|
+
# Gets the current Nightwave Mission data.
|
11
|
+
# @return [Warframe::Models::Nightwave]
|
12
|
+
def nightwave
|
13
|
+
get('/nightwave', Warframe::Models::Nightwave)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/sortie'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information on current Sortie data.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/sortie Example Response}
|
9
|
+
module Sortie
|
10
|
+
# Gets the current sortie missions.
|
11
|
+
# @return [Array<Warframe::Models::Sortie>]
|
12
|
+
def sortie
|
13
|
+
get('/sortie', Warframe::Models::Sortie)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/steel_path'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information on current SteelPath data.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/steelPath Example Response}
|
9
|
+
module SteelPath
|
10
|
+
# Steel Path data
|
11
|
+
# @return [Warframe::Models::SteelPath]
|
12
|
+
def steel_path
|
13
|
+
get('/steelPath', Warframe::Models::SteelPath)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/syndicate_mission'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information on current SyndicateMission data.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/syndicateMissions Example Response}
|
9
|
+
module SyndicateMissions
|
10
|
+
# Gets the current syndicateMissions Data.
|
11
|
+
# @return [Array<Warframe::Models::SyndicateMission>]
|
12
|
+
def syndicate_missions
|
13
|
+
get('/syndicateMissions', Warframe::Models::SyndicateMission)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel '../models/vallis_cycle'
|
4
|
+
|
5
|
+
module Warframe::API
|
6
|
+
# API endpoint for getting information on current VallisCycle data.
|
7
|
+
#
|
8
|
+
# {https://api.warframestat.us/pc/vallisCycle Example Response}
|
9
|
+
module VallisCycle
|
10
|
+
# Gets the current vallisCycle Data.
|
11
|
+
# @return [Warframe::Models::VallisCycle]
|
12
|
+
def vallis_cycle
|
13
|
+
get('/vallisCycle', Warframe::Models::VallisCycle)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/warframe/api.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel 'api'
|
4
|
+
require_rel 'models'
|
5
|
+
|
6
|
+
# The API Router for getting live data.
|
7
|
+
#
|
8
|
+
# Attempting to have every accessible route from {https://docs.warframestat.us Warframe Stat}.
|
9
|
+
#
|
10
|
+
# Module names are 'routes' to this API. See {Warframe::API::Alerts Alerts} for example.
|
11
|
+
module Warframe::API
|
12
|
+
include Alerts
|
13
|
+
include CambionDrift
|
14
|
+
include Cetus
|
15
|
+
include ConclaveChallenges
|
16
|
+
include GlobalUpgrades
|
17
|
+
include Invasions
|
18
|
+
include News
|
19
|
+
include Nightwave
|
20
|
+
include Sortie
|
21
|
+
include SteelPath
|
22
|
+
include SyndicateMissions
|
23
|
+
include VallisCycle
|
24
|
+
end
|
data/lib/warframe/cache.rb
CHANGED
@@ -7,12 +7,12 @@ module Warframe
|
|
7
7
|
EXPIRATION_TIME = 5 * 60
|
8
8
|
attr_accessor :cache
|
9
9
|
|
10
|
-
def initialize
|
11
|
-
@cache =
|
10
|
+
def initialize(cache = {})
|
11
|
+
@cache = cache
|
12
12
|
end
|
13
13
|
|
14
14
|
def get_from_cache(key)
|
15
|
-
cache[key][:result]
|
15
|
+
cache[key][:result] if exist?(key)
|
16
16
|
end
|
17
17
|
|
18
18
|
def find_in_cache(key)
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_rel 'api'
|
4
|
+
require_rel 'cache'
|
5
|
+
|
6
|
+
module Warframe
|
7
|
+
# The main application Client for access live feed data.
|
8
|
+
#
|
9
|
+
# == Example Usage
|
10
|
+
#
|
11
|
+
# client = Warframe::Client.new
|
12
|
+
# client.nightwave.tag # => 'Radio Legion Intermission'
|
13
|
+
#
|
14
|
+
# == Accepted Platforms
|
15
|
+
#
|
16
|
+
# default = 'pc'
|
17
|
+
# all_platorms = [ 'pc', 'ps4', 'xb1', 'swi' ]
|
18
|
+
#
|
19
|
+
# client = Waframe::Client.new(platform: 'ps4')
|
20
|
+
# client.platform # => 'ps4'
|
21
|
+
# client.language # => 'en'
|
22
|
+
#
|
23
|
+
# == Accepted Languages
|
24
|
+
#
|
25
|
+
# default = 'en'
|
26
|
+
# all_languages = [ 'de', 'es', 'en', 'fr', 'it', 'ko', 'pl', 'pt', 'ru', 'zh' ]
|
27
|
+
#
|
28
|
+
# client = Warframe::Client.new(language: 'fr')
|
29
|
+
# client.language # => 'fr'
|
30
|
+
# client.platform # => 'pc'
|
31
|
+
#
|
32
|
+
# == Setting both Platform and Language
|
33
|
+
#
|
34
|
+
# client = Warframe::Client.new(platform: 'ps4', language: 'de')
|
35
|
+
# client.platform # => 'ps4'
|
36
|
+
# client.language # => 'de'
|
37
|
+
class Client < Cache
|
38
|
+
include API
|
39
|
+
|
40
|
+
# The base Warframe Stat API link
|
41
|
+
BASE_URL = 'https://api.warframestat.us/'
|
42
|
+
# Default attributes
|
43
|
+
DEFAULT_OPTIONS = { platform: 'pc', language: 'en' }.freeze
|
44
|
+
|
45
|
+
# The Client Cache
|
46
|
+
attr_accessor :platform, :language
|
47
|
+
|
48
|
+
# Initialize the client.
|
49
|
+
#
|
50
|
+
# @param platform: [String] 'pc', 'ps4', 'xb1', or 'swi'
|
51
|
+
# @param language: [String] 'de', 'es', 'en', 'fr', 'it', 'ko', 'pl', 'pt', 'ru', or 'zh'
|
52
|
+
#
|
53
|
+
# @return [Warframe::Client] The client instance.
|
54
|
+
def initialize(platform: 'pc', language: 'en')
|
55
|
+
super({})
|
56
|
+
@platform = platform
|
57
|
+
@language = language
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [String] the base url and platform combined.
|
61
|
+
def base_url
|
62
|
+
"#{BASE_URL}#{platform}"
|
63
|
+
end
|
64
|
+
|
65
|
+
# Performs a get operation on the requested path, and returns a mapped response of the requested model.
|
66
|
+
# @param path [String]
|
67
|
+
# @param klass [Warframe::Models]
|
68
|
+
def get(path, klass)
|
69
|
+
return get_from_cache(path) if find_in_cache(path)
|
70
|
+
|
71
|
+
result = get_request(path, klass)
|
72
|
+
add_to_cache(path, result)
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def get_request(path, klass)
|
78
|
+
url = "#{base_url}#{path}?language=#{language}"
|
79
|
+
begin
|
80
|
+
response = RestClient.get(url)
|
81
|
+
rescue StandardError => e
|
82
|
+
raise e
|
83
|
+
end
|
84
|
+
|
85
|
+
return_parsed(response.body, klass)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Returns the parsed JSON response in the form of a [Warframe::Models] or an array of [Warframe::Models]
|
89
|
+
# @param resp [Net::HTTP.get]
|
90
|
+
# @return [Warframe::Models, Array<[Warframe::Models]>]
|
91
|
+
def return_parsed(resp, klass)
|
92
|
+
parsed = JSON.parse(resp)
|
93
|
+
return klass.from_array(parsed) if parsed.is_a?(Array)
|
94
|
+
|
95
|
+
klass.new(parsed)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -1,30 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require_relative './attributes/expiry'
|
5
|
-
require_relative './attributes/active'
|
6
|
-
require_relative './attributes/eta'
|
7
|
-
require_relative './attributes/reward_types'
|
8
|
-
require_relative './attributes/start_string'
|
3
|
+
require_rel 'base'
|
9
4
|
|
10
|
-
module Warframe
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
include Warframe::Models::Attributes::StartString
|
5
|
+
module Warframe::Models
|
6
|
+
# Model for Alert data.
|
7
|
+
# {https://api.warframestat.hub/pc/alerts /:platform/alerts}
|
8
|
+
class Alert < Base
|
9
|
+
include Attributes::Expired
|
10
|
+
include Attributes::Active
|
11
|
+
include Attributes::ETA
|
12
|
+
include Attributes::RewardTypes
|
13
|
+
include Attributes::StartString
|
20
14
|
|
21
|
-
|
22
|
-
|
23
|
-
|
15
|
+
# The id of the Alert.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :id
|
24
18
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
19
|
+
# The mission data of this alert.
|
20
|
+
# @return [OpenStruct]
|
21
|
+
attr_reader :mission
|
29
22
|
end
|
30
23
|
end
|
@@ -1,21 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Warframe
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
attr_reader :desc
|
11
|
-
end
|
3
|
+
module Warframe::Models::Attributes
|
4
|
+
# Includes the desc attribute
|
5
|
+
module Desc
|
6
|
+
# The description of the data requested
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :desc
|
9
|
+
end
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
11
|
+
# Includes the description attribute.
|
12
|
+
module Description
|
13
|
+
# The description of the data requested.
|
14
|
+
# @return [String]
|
15
|
+
attr_reader :description
|
20
16
|
end
|
21
17
|
end
|
@@ -1,14 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Warframe
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# @return [String]
|
10
|
-
attr_reader :eta
|
11
|
-
end
|
12
|
-
end
|
3
|
+
module Warframe::Models::Attributes
|
4
|
+
# Adds the eta attribute.
|
5
|
+
module ETA
|
6
|
+
# The estimated time until arrival.
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :eta
|
13
9
|
end
|
14
10
|
end
|