eve_crest 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +59 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/eve_crest.gemspec +25 -0
- data/lib/base_response.rb +24 -0
- data/lib/bloodline.rb +11 -0
- data/lib/eve_crest/version.rb +3 -0
- data/lib/eve_crest.rb +84 -0
- data/lib/https_request.rb +39 -0
- data/lib/incursion.rb +24 -0
- data/lib/requests/bloodlines.rb +9 -0
- data/lib/requests/constellation.rb +12 -0
- data/lib/requests/constellations.rb +9 -0
- data/lib/requests/incursions.rb +9 -0
- data/lib/requests/moon.rb +12 -0
- data/lib/requests/opportunities/group.rb +14 -0
- data/lib/requests/opportunities/groups.rb +11 -0
- data/lib/requests/opportunities/task.rb +14 -0
- data/lib/requests/opportunities/tasks.rb +11 -0
- data/lib/requests/planet.rb +12 -0
- data/lib/requests/region.rb +12 -0
- data/lib/requests/regions.rb +9 -0
- data/lib/requests/server.rb +9 -0
- data/lib/requests/solar_system.rb +12 -0
- data/lib/requests/solar_systems.rb +9 -0
- data/lib/requests/stargate.rb +12 -0
- data/lib/requests/time.rb +9 -0
- data/lib/requests/war.rb +12 -0
- data/lib/requests/wars.rb +9 -0
- data/lib/responses/bloodlines.rb +16 -0
- data/lib/responses/constellation.rb +23 -0
- data/lib/responses/constellations.rb +25 -0
- data/lib/responses/incursions.rb +16 -0
- data/lib/responses/moon.rb +18 -0
- data/lib/responses/opportunities/group.rb +24 -0
- data/lib/responses/opportunities/groups.rb +25 -0
- data/lib/responses/opportunities/task.rb +14 -0
- data/lib/responses/opportunities/tasks.rb +25 -0
- data/lib/responses/planet.rb +18 -0
- data/lib/responses/region.rb +36 -0
- data/lib/responses/regions.rb +25 -0
- data/lib/responses/server.rb +18 -0
- data/lib/responses/solar_system.rb +44 -0
- data/lib/responses/solar_systems.rb +25 -0
- data/lib/responses/stargate.rb +24 -0
- data/lib/responses/time.rb +9 -0
- data/lib/responses/war.rb +59 -0
- data/lib/responses/wars.rb +9 -0
- metadata +140 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: e1be2d406b6e8bb1a037328aac66d2ac420bc60e
|
|
4
|
+
data.tar.gz: 4e600d1b6d0ceac69c365ba533d1a5bf1a8c1031
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 28b54bda51e714dea4ea5138e6872d9030c8c54b89fc7fc8b6a111b7e45ac19d3c02c7d8788c5bed596714084e5fb1949d62c53355e9538ca49d99bd3e6db398
|
|
7
|
+
data.tar.gz: 859689e3ec9b553cb7ceeb11caef137250ce90f0ec097c56da96fdd0e5781e25a1162d41e21ed78c9d11bbbd8844dce5e0583683f28de7c6094f173b46d55bd6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Nick Hird
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# EveCrest
|
|
2
|
+
|
|
3
|
+
Welcome, eve_crest is a library designed to abstract the crest api system provided by CCP for EVE Online.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'eve_crest'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install eve_crest
|
|
20
|
+
## Dependencies
|
|
21
|
+
```
|
|
22
|
+
gem 'json', '~> 2.0.2'
|
|
23
|
+
gem 'redis'
|
|
24
|
+
gem 'httparty'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Example: to get a specific region
|
|
30
|
+
```
|
|
31
|
+
request = EveCrest::Request::Region.new(10000001)
|
|
32
|
+
response = request.get
|
|
33
|
+
region_name = response.name
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## What is implemented?
|
|
37
|
+
|
|
38
|
+
- Bloodlines
|
|
39
|
+
- Constellations
|
|
40
|
+
- Incursions
|
|
41
|
+
- Moons
|
|
42
|
+
- Planets
|
|
43
|
+
- Regions
|
|
44
|
+
- server information (version, time, etc...)
|
|
45
|
+
- Solar Systems
|
|
46
|
+
- Stargates
|
|
47
|
+
- Wars
|
|
48
|
+
|
|
49
|
+
The rest is a work in progress.
|
|
50
|
+
for a full list of endpoints available on the crest system go to [The third party read the docs page](https://eveonline-third-party-documentation.readthedocs.io/en/latest/).
|
|
51
|
+
## Contributing
|
|
52
|
+
|
|
53
|
+
Bug reports and pull requests are welcome on GitLab at https://git.capnick.co.uk/capnick/eve_crest.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
59
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "eve_crest"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/eve_crest.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'eve_crest/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "eve_crest"
|
|
8
|
+
spec.version = EveCrest::VERSION
|
|
9
|
+
spec.authors = ["Nick Hird"]
|
|
10
|
+
spec.email = ["nickdh94@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "A libary to make using EVE's 'Crest' api system esaier to use"
|
|
13
|
+
spec.description = "A libary to make using EVE's 'Crest' api system esaier to use"
|
|
14
|
+
spec.homepage = "https://git.capnick.co.uk/capnick/eve_crest"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
18
|
+
spec.bindir = "exe"
|
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
|
+
spec.require_paths = ["lib"]
|
|
21
|
+
|
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
25
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
class BaseResponse
|
|
3
|
+
attr_accessor :data
|
|
4
|
+
def initialize(json)
|
|
5
|
+
@data = json
|
|
6
|
+
end
|
|
7
|
+
def success?
|
|
8
|
+
!data.has_key?('exceptionType')
|
|
9
|
+
end
|
|
10
|
+
def raw
|
|
11
|
+
data
|
|
12
|
+
end
|
|
13
|
+
def error_message
|
|
14
|
+
if success?
|
|
15
|
+
nil
|
|
16
|
+
else
|
|
17
|
+
data['exceptionType']
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
def cached_until
|
|
21
|
+
DateTime.strptime(data['cachedUntil'], '%Y-%m-%d %H:%M:%S')
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/bloodline.rb
ADDED
data/lib/eve_crest.rb
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require 'eve_crest/version'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'httparty'
|
|
4
|
+
require 'awesome_print'
|
|
5
|
+
require 'redis'
|
|
6
|
+
|
|
7
|
+
#Base
|
|
8
|
+
require_relative 'https_request'
|
|
9
|
+
require_relative 'base_response'
|
|
10
|
+
#Extra Classes
|
|
11
|
+
require_relative 'bloodline'
|
|
12
|
+
require_relative 'incursion'
|
|
13
|
+
|
|
14
|
+
#Requests
|
|
15
|
+
##Constellation
|
|
16
|
+
require_relative 'requests/constellation'
|
|
17
|
+
require_relative 'requests/constellations'
|
|
18
|
+
##Region
|
|
19
|
+
require_relative 'requests/region'
|
|
20
|
+
require_relative 'requests/regions'
|
|
21
|
+
##SolarSystem
|
|
22
|
+
require_relative 'requests/solar_system'
|
|
23
|
+
require_relative 'requests/solar_systems'
|
|
24
|
+
##Planet
|
|
25
|
+
require_relative 'requests/planet'
|
|
26
|
+
##Moon
|
|
27
|
+
require_relative 'requests/moon'
|
|
28
|
+
##Stargate
|
|
29
|
+
require_relative 'requests/stargate'
|
|
30
|
+
##Opportunities
|
|
31
|
+
require_relative 'requests/opportunities/group'
|
|
32
|
+
require_relative 'requests/opportunities/groups'
|
|
33
|
+
require_relative 'requests/opportunities/task'
|
|
34
|
+
require_relative 'requests/opportunities/tasks'
|
|
35
|
+
##Server
|
|
36
|
+
require_relative 'requests/server'
|
|
37
|
+
require_relative 'requests/time'
|
|
38
|
+
##Incursions
|
|
39
|
+
require_relative 'requests/incursions'
|
|
40
|
+
##Wars
|
|
41
|
+
require_relative 'requests/wars'
|
|
42
|
+
require_relative 'requests/war'
|
|
43
|
+
##Bloodlines
|
|
44
|
+
require_relative 'requests/bloodlines'
|
|
45
|
+
|
|
46
|
+
#Responses
|
|
47
|
+
##Constellation
|
|
48
|
+
require_relative 'responses/constellation'
|
|
49
|
+
require_relative 'responses/constellations'
|
|
50
|
+
##Region
|
|
51
|
+
require_relative 'responses/region'
|
|
52
|
+
require_relative 'responses/regions'
|
|
53
|
+
##SolarSystem
|
|
54
|
+
require_relative 'responses/solar_system'
|
|
55
|
+
require_relative 'responses/solar_systems'
|
|
56
|
+
##Planet
|
|
57
|
+
require_relative 'responses/planet'
|
|
58
|
+
##Moon
|
|
59
|
+
require_relative 'responses/moon'
|
|
60
|
+
##Stargate
|
|
61
|
+
require_relative 'responses/stargate'
|
|
62
|
+
##Opportunities
|
|
63
|
+
require_relative 'responses/opportunities/group'
|
|
64
|
+
require_relative 'responses/opportunities/groups'
|
|
65
|
+
require_relative 'responses/opportunities/task'
|
|
66
|
+
require_relative 'responses/opportunities/tasks'
|
|
67
|
+
##Server
|
|
68
|
+
require_relative 'responses/server'
|
|
69
|
+
require_relative 'responses/time'
|
|
70
|
+
##Incursions
|
|
71
|
+
require_relative 'responses/incursions'
|
|
72
|
+
##Wars
|
|
73
|
+
require_relative 'responses/wars'
|
|
74
|
+
require_relative 'responses/war'
|
|
75
|
+
##Bloodlines
|
|
76
|
+
require_relative 'responses/bloodlines'
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
#Extra Information
|
|
82
|
+
DEFAULT_CACHE_TIME = 86400000
|
|
83
|
+
CREST_URL = 'https://crest-tq.eveonline.com'
|
|
84
|
+
REDIS = Redis.new
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
class HTTPSRequest
|
|
3
|
+
def self.get(_uri)
|
|
4
|
+
# Need to make get have two params so the time to be cached can be respected
|
|
5
|
+
uri = URI("#{CREST_URL}#{_uri}")
|
|
6
|
+
|
|
7
|
+
cache = REDIS.get(uri)
|
|
8
|
+
|
|
9
|
+
if cache.nil?
|
|
10
|
+
response = do_request(uri)
|
|
11
|
+
response[:cachedUntil] = Time.now.to_s
|
|
12
|
+
REDIS.set(uri, response.to_json)
|
|
13
|
+
else
|
|
14
|
+
cache_json = JSON.parse(cache, :quirks_mode => true)
|
|
15
|
+
|
|
16
|
+
expires = DateTime.strptime(cache_json['cachedUntil'], '%Y-%m-%d %H:%M:%S')
|
|
17
|
+
time_expires = Time.parse(expires.to_s)
|
|
18
|
+
|
|
19
|
+
if time_expires < Time.now
|
|
20
|
+
response = do_request(uri)
|
|
21
|
+
response[:cachedUntil] = Time.now.to_s
|
|
22
|
+
REDIS.set(uri, response.to_json)
|
|
23
|
+
else
|
|
24
|
+
response = cache_json
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
return response
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def self.do_request(uri)
|
|
34
|
+
response = HTTParty.get(uri)
|
|
35
|
+
json = JSON.parse(response)
|
|
36
|
+
return json
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/incursion.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
class Incursion
|
|
3
|
+
attr_reader :aggressor_id, :staging_system_id, :influence, :type, :state, :has_boss, :infested_systems, :constellation_id
|
|
4
|
+
def initialize(json)
|
|
5
|
+
@aggressor_id = json['aggressorFactionID']['id']
|
|
6
|
+
@staging_system_id = json['stagingSolarSystem']['id']
|
|
7
|
+
@influence = json['influence']
|
|
8
|
+
@type = json['incursionType']
|
|
9
|
+
@state = json['state']
|
|
10
|
+
@has_boss = json['hasBoss']
|
|
11
|
+
@infested_systems = get_system_ids(json['infestedSolarSystems'])
|
|
12
|
+
@constellation_id = json['constellation']['id']
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
def get_system_ids(systems_raw)
|
|
17
|
+
systems = Array.new
|
|
18
|
+
systems_raw.each do |sys|
|
|
19
|
+
systems.push(sys['id'])
|
|
20
|
+
end
|
|
21
|
+
systems
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Request
|
|
3
|
+
module Opportunities
|
|
4
|
+
class Group
|
|
5
|
+
def initialize(param)
|
|
6
|
+
@id = param
|
|
7
|
+
end
|
|
8
|
+
def get
|
|
9
|
+
EveCrest::Response::Opportunities::Group.new(EveCrest::HTTPSRequest.get("/opportunities/groups/#{@id}/"))
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Request
|
|
3
|
+
module Opportunities
|
|
4
|
+
class Task
|
|
5
|
+
def initialize(param)
|
|
6
|
+
@id = param
|
|
7
|
+
end
|
|
8
|
+
def get
|
|
9
|
+
EveCrest::Response::Opportunities::Task.new(EveCrest::HTTPSRequest.get("/opportunities/tasks/#{@id}/"))
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/requests/war.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Bloodlines < BaseResponse
|
|
4
|
+
def all
|
|
5
|
+
bloodlines = Array.new
|
|
6
|
+
data['items'].each do |bloodline_data|
|
|
7
|
+
bloodlines.push(EveCrest::Bloodline.new(bloodline_data))
|
|
8
|
+
end
|
|
9
|
+
bloodlines
|
|
10
|
+
end
|
|
11
|
+
def count
|
|
12
|
+
data['totalCount']
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Constellation < BaseResponse
|
|
4
|
+
def region
|
|
5
|
+
data['region'].to_s.split('/')[4].to_i
|
|
6
|
+
end
|
|
7
|
+
def position
|
|
8
|
+
data['position']
|
|
9
|
+
end
|
|
10
|
+
def systems
|
|
11
|
+
#only returns an array constellation ids
|
|
12
|
+
_systems = Array.new
|
|
13
|
+
data['systems'].each do |s|
|
|
14
|
+
_systems.push(s['id'])
|
|
15
|
+
end
|
|
16
|
+
_systems
|
|
17
|
+
end
|
|
18
|
+
def name
|
|
19
|
+
data['name']
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Constellations < BaseResponse
|
|
4
|
+
def constellation_ids
|
|
5
|
+
#only returns an array constellation ids
|
|
6
|
+
_constellations = Array.new
|
|
7
|
+
data['items'].each do |s|
|
|
8
|
+
_constellations.push(s['id'])
|
|
9
|
+
end
|
|
10
|
+
_constellations
|
|
11
|
+
end
|
|
12
|
+
def constellation_names
|
|
13
|
+
#only returns an array constellation ids
|
|
14
|
+
_constellations = Array.new
|
|
15
|
+
data['items'].each do |s|
|
|
16
|
+
_constellations.push(s['name'])
|
|
17
|
+
end
|
|
18
|
+
_constellations
|
|
19
|
+
end
|
|
20
|
+
def total_count
|
|
21
|
+
data['totalCount']
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Incursions < BaseResponse
|
|
4
|
+
def all
|
|
5
|
+
incursions = Array.new
|
|
6
|
+
data['items'].each do |incursion_data|
|
|
7
|
+
incursions.push(EveCrest::Incursion.new(incursion_data))
|
|
8
|
+
end
|
|
9
|
+
incursions
|
|
10
|
+
end
|
|
11
|
+
def count
|
|
12
|
+
data['totalCount']
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Moon < BaseResponse
|
|
4
|
+
def position
|
|
5
|
+
data['position']
|
|
6
|
+
end
|
|
7
|
+
def name
|
|
8
|
+
data['name']
|
|
9
|
+
end
|
|
10
|
+
def type
|
|
11
|
+
data['type']['id']
|
|
12
|
+
end
|
|
13
|
+
def solar_system
|
|
14
|
+
data['solarSystem']['id']
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
module Opportunities
|
|
4
|
+
class Group < BaseResponse
|
|
5
|
+
def name
|
|
6
|
+
data['name']
|
|
7
|
+
end
|
|
8
|
+
def description
|
|
9
|
+
data['description']
|
|
10
|
+
end
|
|
11
|
+
def tasks
|
|
12
|
+
_tasks = Array.new
|
|
13
|
+
data['achievementTasks'].each do |t|
|
|
14
|
+
_tasks.push(t['id'])
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
# group connections only have one item ever in them ?????
|
|
18
|
+
def group_connection
|
|
19
|
+
data['groupConnections'].first['id']
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
module Opportunities
|
|
4
|
+
class Groups < BaseResponse
|
|
5
|
+
def ids
|
|
6
|
+
_ids = Array.new
|
|
7
|
+
data['items'].each do |i|
|
|
8
|
+
_ids.push(i['id'])
|
|
9
|
+
end
|
|
10
|
+
_ids
|
|
11
|
+
end
|
|
12
|
+
def names
|
|
13
|
+
_names = Array.new
|
|
14
|
+
data['items'].each do |i|
|
|
15
|
+
_names.push(i['name'])
|
|
16
|
+
end
|
|
17
|
+
_names
|
|
18
|
+
end
|
|
19
|
+
def count
|
|
20
|
+
data['totalCount']
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
module Opportunities
|
|
4
|
+
class Tasks < BaseResponse
|
|
5
|
+
def ids
|
|
6
|
+
_ids = Array.new
|
|
7
|
+
data['items'].each do |i|
|
|
8
|
+
_ids.push(i['id'])
|
|
9
|
+
end
|
|
10
|
+
_ids
|
|
11
|
+
end
|
|
12
|
+
def names
|
|
13
|
+
_names = Array.new
|
|
14
|
+
data['items'].each do |i|
|
|
15
|
+
_names.push(i['name'])
|
|
16
|
+
end
|
|
17
|
+
_names
|
|
18
|
+
end
|
|
19
|
+
def count
|
|
20
|
+
data['totalCount']
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Planet < BaseResponse
|
|
4
|
+
def name
|
|
5
|
+
data['name']
|
|
6
|
+
end
|
|
7
|
+
def position
|
|
8
|
+
data['position']
|
|
9
|
+
end
|
|
10
|
+
def solar_system
|
|
11
|
+
data['solarSystem']['id']
|
|
12
|
+
end
|
|
13
|
+
def type
|
|
14
|
+
data['type']['id']
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Region < BaseResponse
|
|
4
|
+
def name
|
|
5
|
+
data['name']
|
|
6
|
+
end
|
|
7
|
+
def description
|
|
8
|
+
data['description']
|
|
9
|
+
end
|
|
10
|
+
def constellations
|
|
11
|
+
#only returns an array constellation ids
|
|
12
|
+
_constellations = Array.new
|
|
13
|
+
data['constellations'].each do |s|
|
|
14
|
+
_constellations.push(s['id'])
|
|
15
|
+
end
|
|
16
|
+
_constellations
|
|
17
|
+
end
|
|
18
|
+
#market shit leave for now :)
|
|
19
|
+
def market_buy_orders
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
def market_history
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
def market_orders
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
def market_orders_all
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
def market_sell_orders
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Regions < BaseResponse
|
|
4
|
+
def region_ids
|
|
5
|
+
#only returns an array constellation ids
|
|
6
|
+
_regions = Array.new
|
|
7
|
+
data['items'].each do |s|
|
|
8
|
+
_regions.push(s['id'])
|
|
9
|
+
end
|
|
10
|
+
_regions
|
|
11
|
+
end
|
|
12
|
+
def region_names
|
|
13
|
+
#only returns an array constellation ids
|
|
14
|
+
_regions = Array.new
|
|
15
|
+
data['items'].each do |s|
|
|
16
|
+
_regions.push(s['name'])
|
|
17
|
+
end
|
|
18
|
+
_regions
|
|
19
|
+
end
|
|
20
|
+
def total_count
|
|
21
|
+
data['totalCount']
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Server < BaseResponse
|
|
4
|
+
def version
|
|
5
|
+
data['serverVersion']
|
|
6
|
+
end
|
|
7
|
+
def server_name
|
|
8
|
+
data['serverName']
|
|
9
|
+
end
|
|
10
|
+
def status
|
|
11
|
+
data['serviceStatus']
|
|
12
|
+
end
|
|
13
|
+
def user_count
|
|
14
|
+
data['userCount']
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class SolarSystem < BaseResponse
|
|
4
|
+
def name
|
|
5
|
+
data['name']
|
|
6
|
+
end
|
|
7
|
+
def position
|
|
8
|
+
data['position']
|
|
9
|
+
end
|
|
10
|
+
def planets
|
|
11
|
+
#only returns an array planets ids
|
|
12
|
+
_planets = Array.new
|
|
13
|
+
data['planets'].each do |p|
|
|
14
|
+
_planets.push(p['href'].to_s.split('/')[4].to_i)
|
|
15
|
+
end
|
|
16
|
+
_planets
|
|
17
|
+
end
|
|
18
|
+
def moons
|
|
19
|
+
_moons = Array.new
|
|
20
|
+
data['planets'].each do |p|
|
|
21
|
+
_moons.push(p['moons'].to_s.split('/')[4].to_i)
|
|
22
|
+
end
|
|
23
|
+
_moons
|
|
24
|
+
end
|
|
25
|
+
def stargates
|
|
26
|
+
_stargates = Array.new
|
|
27
|
+
data['stargates'].each do |s|
|
|
28
|
+
_stargates.push(s['id'])
|
|
29
|
+
end
|
|
30
|
+
_stargates
|
|
31
|
+
end
|
|
32
|
+
def security_level
|
|
33
|
+
data['securityStatus']
|
|
34
|
+
end
|
|
35
|
+
def sovereignty
|
|
36
|
+
data['sovereignty']['id']
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def constellation
|
|
40
|
+
data['constellation']['id']
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class SolarSystems < BaseResponse
|
|
4
|
+
def solar_system_ids
|
|
5
|
+
#only returns an array solarsystem ids
|
|
6
|
+
_solar_system = Array.new
|
|
7
|
+
data['items'].each do |s|
|
|
8
|
+
_solar_system.push(s['id'])
|
|
9
|
+
end
|
|
10
|
+
_solar_system
|
|
11
|
+
end
|
|
12
|
+
def solar_system_names
|
|
13
|
+
#only returns an array solarsystem ids
|
|
14
|
+
_solar_system = Array.new
|
|
15
|
+
data['items'].each do |s|
|
|
16
|
+
_solar_system.push(s['name'])
|
|
17
|
+
end
|
|
18
|
+
_solar_system
|
|
19
|
+
end
|
|
20
|
+
def total_count
|
|
21
|
+
data['totalCount']
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class Stargate < BaseResponse
|
|
4
|
+
def position
|
|
5
|
+
data['position']
|
|
6
|
+
end
|
|
7
|
+
def name
|
|
8
|
+
data['name']
|
|
9
|
+
end
|
|
10
|
+
def destination
|
|
11
|
+
data['destination']['system']['id']
|
|
12
|
+
end
|
|
13
|
+
def paired_gate
|
|
14
|
+
data['destination']['stargate']['id']
|
|
15
|
+
end
|
|
16
|
+
def system_id
|
|
17
|
+
data['system']['id']
|
|
18
|
+
end
|
|
19
|
+
def type
|
|
20
|
+
data['type']['id']
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module EveCrest
|
|
2
|
+
module Response
|
|
3
|
+
class War < BaseResponse
|
|
4
|
+
def started
|
|
5
|
+
DateTime.parse(data['timeStarted'])
|
|
6
|
+
end
|
|
7
|
+
def declared
|
|
8
|
+
DateTime.parse(data['timeDeclared'])
|
|
9
|
+
end
|
|
10
|
+
def finished
|
|
11
|
+
DateTime.parse(data['timeFinished'])
|
|
12
|
+
end
|
|
13
|
+
def aggressor_id
|
|
14
|
+
data['aggressor']['id']
|
|
15
|
+
end
|
|
16
|
+
def aggressor_name
|
|
17
|
+
data['aggressor']['name']
|
|
18
|
+
end
|
|
19
|
+
def aggressor_kills
|
|
20
|
+
data['aggressor']['shipsKilled']
|
|
21
|
+
end
|
|
22
|
+
def aggressor_kills_isk
|
|
23
|
+
data['aggressor']['iskKilled']
|
|
24
|
+
end
|
|
25
|
+
def defender_id
|
|
26
|
+
data['defender']['id']
|
|
27
|
+
end
|
|
28
|
+
def defender_name
|
|
29
|
+
data['defender']['name']
|
|
30
|
+
end
|
|
31
|
+
def defender_kills
|
|
32
|
+
data['defender']['shipsKilled']
|
|
33
|
+
end
|
|
34
|
+
def defender_kills_isk
|
|
35
|
+
data['defender']['iskKilled']
|
|
36
|
+
end
|
|
37
|
+
def open_for_allies?
|
|
38
|
+
data['openForAllies']
|
|
39
|
+
end
|
|
40
|
+
def ally_count
|
|
41
|
+
data['allyCount']
|
|
42
|
+
end
|
|
43
|
+
def allies
|
|
44
|
+
_allies = Array.new
|
|
45
|
+
if data['allies'].nil?
|
|
46
|
+
_allies
|
|
47
|
+
else
|
|
48
|
+
data['allies'].each do |a|
|
|
49
|
+
_allies.push(a['id'])
|
|
50
|
+
end
|
|
51
|
+
_allies
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
def is_mutual?
|
|
55
|
+
data['mutual']
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: eve_crest
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nick Hird
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.12'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.12'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
description: A libary to make using EVE's 'Crest' api system esaier to use
|
|
56
|
+
email:
|
|
57
|
+
- nickdh94@gmail.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- ".gitignore"
|
|
63
|
+
- ".rspec"
|
|
64
|
+
- ".travis.yml"
|
|
65
|
+
- Gemfile
|
|
66
|
+
- LICENSE.txt
|
|
67
|
+
- README.md
|
|
68
|
+
- Rakefile
|
|
69
|
+
- bin/console
|
|
70
|
+
- bin/setup
|
|
71
|
+
- eve_crest.gemspec
|
|
72
|
+
- lib/base_response.rb
|
|
73
|
+
- lib/bloodline.rb
|
|
74
|
+
- lib/eve_crest.rb
|
|
75
|
+
- lib/eve_crest/version.rb
|
|
76
|
+
- lib/https_request.rb
|
|
77
|
+
- lib/incursion.rb
|
|
78
|
+
- lib/requests/bloodlines.rb
|
|
79
|
+
- lib/requests/constellation.rb
|
|
80
|
+
- lib/requests/constellations.rb
|
|
81
|
+
- lib/requests/incursions.rb
|
|
82
|
+
- lib/requests/moon.rb
|
|
83
|
+
- lib/requests/opportunities/group.rb
|
|
84
|
+
- lib/requests/opportunities/groups.rb
|
|
85
|
+
- lib/requests/opportunities/task.rb
|
|
86
|
+
- lib/requests/opportunities/tasks.rb
|
|
87
|
+
- lib/requests/planet.rb
|
|
88
|
+
- lib/requests/region.rb
|
|
89
|
+
- lib/requests/regions.rb
|
|
90
|
+
- lib/requests/server.rb
|
|
91
|
+
- lib/requests/solar_system.rb
|
|
92
|
+
- lib/requests/solar_systems.rb
|
|
93
|
+
- lib/requests/stargate.rb
|
|
94
|
+
- lib/requests/time.rb
|
|
95
|
+
- lib/requests/war.rb
|
|
96
|
+
- lib/requests/wars.rb
|
|
97
|
+
- lib/responses/bloodlines.rb
|
|
98
|
+
- lib/responses/constellation.rb
|
|
99
|
+
- lib/responses/constellations.rb
|
|
100
|
+
- lib/responses/incursions.rb
|
|
101
|
+
- lib/responses/moon.rb
|
|
102
|
+
- lib/responses/opportunities/group.rb
|
|
103
|
+
- lib/responses/opportunities/groups.rb
|
|
104
|
+
- lib/responses/opportunities/task.rb
|
|
105
|
+
- lib/responses/opportunities/tasks.rb
|
|
106
|
+
- lib/responses/planet.rb
|
|
107
|
+
- lib/responses/region.rb
|
|
108
|
+
- lib/responses/regions.rb
|
|
109
|
+
- lib/responses/server.rb
|
|
110
|
+
- lib/responses/solar_system.rb
|
|
111
|
+
- lib/responses/solar_systems.rb
|
|
112
|
+
- lib/responses/stargate.rb
|
|
113
|
+
- lib/responses/time.rb
|
|
114
|
+
- lib/responses/war.rb
|
|
115
|
+
- lib/responses/wars.rb
|
|
116
|
+
homepage: https://git.capnick.co.uk/capnick/eve_crest
|
|
117
|
+
licenses:
|
|
118
|
+
- MIT
|
|
119
|
+
metadata: {}
|
|
120
|
+
post_install_message:
|
|
121
|
+
rdoc_options: []
|
|
122
|
+
require_paths:
|
|
123
|
+
- lib
|
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
|
+
requirements:
|
|
126
|
+
- - ">="
|
|
127
|
+
- !ruby/object:Gem::Version
|
|
128
|
+
version: '0'
|
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - ">="
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '0'
|
|
134
|
+
requirements: []
|
|
135
|
+
rubyforge_project:
|
|
136
|
+
rubygems_version: 2.5.1
|
|
137
|
+
signing_key:
|
|
138
|
+
specification_version: 4
|
|
139
|
+
summary: A libary to make using EVE's 'Crest' api system esaier to use
|
|
140
|
+
test_files: []
|