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.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +13 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +59 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/eve_crest.gemspec +25 -0
  12. data/lib/base_response.rb +24 -0
  13. data/lib/bloodline.rb +11 -0
  14. data/lib/eve_crest/version.rb +3 -0
  15. data/lib/eve_crest.rb +84 -0
  16. data/lib/https_request.rb +39 -0
  17. data/lib/incursion.rb +24 -0
  18. data/lib/requests/bloodlines.rb +9 -0
  19. data/lib/requests/constellation.rb +12 -0
  20. data/lib/requests/constellations.rb +9 -0
  21. data/lib/requests/incursions.rb +9 -0
  22. data/lib/requests/moon.rb +12 -0
  23. data/lib/requests/opportunities/group.rb +14 -0
  24. data/lib/requests/opportunities/groups.rb +11 -0
  25. data/lib/requests/opportunities/task.rb +14 -0
  26. data/lib/requests/opportunities/tasks.rb +11 -0
  27. data/lib/requests/planet.rb +12 -0
  28. data/lib/requests/region.rb +12 -0
  29. data/lib/requests/regions.rb +9 -0
  30. data/lib/requests/server.rb +9 -0
  31. data/lib/requests/solar_system.rb +12 -0
  32. data/lib/requests/solar_systems.rb +9 -0
  33. data/lib/requests/stargate.rb +12 -0
  34. data/lib/requests/time.rb +9 -0
  35. data/lib/requests/war.rb +12 -0
  36. data/lib/requests/wars.rb +9 -0
  37. data/lib/responses/bloodlines.rb +16 -0
  38. data/lib/responses/constellation.rb +23 -0
  39. data/lib/responses/constellations.rb +25 -0
  40. data/lib/responses/incursions.rb +16 -0
  41. data/lib/responses/moon.rb +18 -0
  42. data/lib/responses/opportunities/group.rb +24 -0
  43. data/lib/responses/opportunities/groups.rb +25 -0
  44. data/lib/responses/opportunities/task.rb +14 -0
  45. data/lib/responses/opportunities/tasks.rb +25 -0
  46. data/lib/responses/planet.rb +18 -0
  47. data/lib/responses/region.rb +36 -0
  48. data/lib/responses/regions.rb +25 -0
  49. data/lib/responses/server.rb +18 -0
  50. data/lib/responses/solar_system.rb +44 -0
  51. data/lib/responses/solar_systems.rb +25 -0
  52. data/lib/responses/stargate.rb +24 -0
  53. data/lib/responses/time.rb +9 -0
  54. data/lib/responses/war.rb +59 -0
  55. data/lib/responses/wars.rb +9 -0
  56. 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
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea/
11
+ test/
12
+ projectFilesBackup/
13
+ dump.rdb
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'rspec', '~> 3.0.0'
5
+ #gem 'guard-rspec', '~> 4.2.10'
6
+ gem 'awesome_print'
7
+ gem 'simplecov'
8
+ gem 'rake'
9
+ end
10
+
11
+ gem 'json', '~> 2.0.2'
12
+ gem 'redis'
13
+ gem 'httparty'
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
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
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
@@ -0,0 +1,11 @@
1
+ module EveCrest
2
+ class Bloodline
3
+ attr_reader :description, :name, :id, :icon
4
+ def initialize(json)
5
+ @description = json['description']
6
+ @name = json['name']
7
+ @id = json['id']
8
+ @icon = json['icon']['href']
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module EveCrest
2
+ VERSION = "0.1.0"
3
+ end
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,9 @@
1
+ module EveCrest
2
+ module Request
3
+ class Bloodlines
4
+ def get
5
+ EveCrest::Response::Bloodlines.new(EveCrest::HTTPSRequest.get('/bloodlines/'))
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module EveCrest
2
+ module Request
3
+ class Constellation
4
+ def initialize(param)
5
+ @id = param
6
+ end
7
+ def get
8
+ EveCrest::Response::Constellation.new(EveCrest::HTTPSRequest.get("/constellations/#{@id}/"))
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ module EveCrest
2
+ module Request
3
+ class Constellations
4
+ def get
5
+ EveCrest::Response::Constellations.new(EveCrest::HTTPSRequest.get('/constellations/'))
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module EveCrest
2
+ module Request
3
+ class Incursions
4
+ def get
5
+ EveCrest::Response::Incursions.new(EveCrest::HTTPSRequest.get('/incursions/'))
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module EveCrest
2
+ module Request
3
+ class Moon
4
+ def initialize(param)
5
+ @id = param
6
+ end
7
+ def get
8
+ EveCrest::Response::Moon.new(EveCrest::HTTPSRequest.get("/moons/#{@id}/"))
9
+ end
10
+ end
11
+ end
12
+ 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,11 @@
1
+ module EveCrest
2
+ module Request
3
+ module Opportunities
4
+ class Groups
5
+ def get
6
+ EveCrest::Response::Opportunities::Groups.new(EveCrest::HTTPSRequest.get('/opportunities/groups/'))
7
+ end
8
+ end
9
+ end
10
+ end
11
+ 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
@@ -0,0 +1,11 @@
1
+ module EveCrest
2
+ module Request
3
+ module Opportunities
4
+ class Tasks
5
+ def get
6
+ EveCrest::Response::Opportunities::Tasks.new(EveCrest::HTTPSRequest.get('/opportunities/tasks/'))
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module EveCrest
2
+ module Request
3
+ class Planet
4
+ def initialize(param)
5
+ @id = param
6
+ end
7
+ def get
8
+ EveCrest::Response::Planet.new(EveCrest::HTTPSRequest.get("/planets/#{@id}/"))
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module EveCrest
2
+ module Request
3
+ class Region
4
+ def initialize(param)
5
+ @id = param
6
+ end
7
+ def get
8
+ EveCrest::Response::Region.new(EveCrest::HTTPSRequest.get("/regions/#{@id}/"))
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ module EveCrest
2
+ module Request
3
+ class Regions
4
+ def get
5
+ EveCrest::Response::Regions.new(EveCrest::HTTPSRequest.get('/regions/'))
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module EveCrest
2
+ module Request
3
+ class Server
4
+ def get
5
+ EveCrest::Response::Server.new(EveCrest::HTTPSRequest.get('/'))
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module EveCrest
2
+ module Request
3
+ class SolarSystem
4
+ def initialize(param)
5
+ @id = param
6
+ end
7
+ def get
8
+ EveCrest::Response::SolarSystem.new(EveCrest::HTTPSRequest.get("/solarsystems/#{@id}/"))
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ module EveCrest
2
+ module Request
3
+ class SolarSystems
4
+ def get
5
+ EveCrest::Response::SolarSystems.new(EveCrest::HTTPSRequest.get('/solarsystems/'))
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module EveCrest
2
+ module Request
3
+ class Stargate
4
+ def initialize(param)
5
+ @id = param
6
+ end
7
+ def get
8
+ EveCrest::Response::Stargate.new(EveCrest::HTTPSRequest.get("/stargates/#{@id}/"))
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ module EveCrest
2
+ module Request
3
+ class Time
4
+ def get
5
+ EveCrest::Response::Time.new(EveCrest::HTTPSRequest.get('/time/'))
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module EveCrest
2
+ module Request
3
+ class War
4
+ def initialize(param)
5
+ @id = param
6
+ end
7
+ def get
8
+ EveCrest::Response::War.new(EveCrest::HTTPSRequest.get("/wars/#{@id}/"))
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ module EveCrest
2
+ module Request
3
+ class Wars
4
+ def get
5
+ EveCrest::Response::Wars.new(EveCrest::HTTPSRequest.get('/wars/'))
6
+ end
7
+ end
8
+ end
9
+ end
@@ -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,14 @@
1
+ module EveCrest
2
+ module Response
3
+ module Opportunities
4
+ class Task < BaseResponse
5
+ def name
6
+ data['name']
7
+ end
8
+ def description
9
+ data['description']
10
+ end
11
+ end
12
+ end
13
+ end
14
+ 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,9 @@
1
+ module EveCrest
2
+ module Response
3
+ class Time < BaseResponse
4
+ def get
5
+ DateTime.parse(data['time'])
6
+ end
7
+ end
8
+ end
9
+ 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
@@ -0,0 +1,9 @@
1
+ module EveCrest
2
+ module Response
3
+ class Wars < BaseResponse
4
+ def count
5
+ data['totalCount']
6
+ end
7
+ end
8
+ end
9
+ 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: []