eve_online 0.2.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/.codeclimate.yml +11 -0
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.rubocop.yml +11 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/eve_online.gemspec +27 -0
- data/lib/eve_online.rb +9 -0
- data/lib/eve_online/account_balance.rb +53 -0
- data/lib/eve_online/account_status.rb +47 -0
- data/lib/eve_online/api_key_info.rb +89 -0
- data/lib/eve_online/base.rb +23 -0
- data/lib/eve_online/server_status.rb +42 -0
- data/lib/eve_online/version.rb +3 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d121f03da2c06b0a64adb322326bdf11c59503e9
|
4
|
+
data.tar.gz: 821144d4bef4b9731f4fda3636e5a90194acd2ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1c4d35c4a0d7a425b9d80b8f7ef720d127524ca146e057bb1cf31d9d0d9d4b92438e8f036bc7fe6aad34ec0d2d0ea04b95c578706f9e83a570c6c20fd2c65c53
|
7
|
+
data.tar.gz: e875425cc51014b9da72ce01f4b41e89a5fba0b57748c09e66a1d7f9c08afaaaa50de0f0c4ac128cc6b9bbeea9a51acbdcf20b90f0071cb9c8eb34bc7c6fca55
|
data/.codeclimate.yml
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rubocop.yml
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) 2015 Igor Zubkov
|
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,47 @@
|
|
1
|
+
# EveOnline API (XML and CREST)
|
2
|
+
|
3
|
+
[](https://codeclimate.com/github/biow0lf/eve_online)
|
4
|
+
[](https://codeclimate.com/github/biow0lf/eve_online/coverage)
|
5
|
+
|
6
|
+
This gem implement Ruby API for EveOnline MMORPG. Both, XML and CREST API.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'eve_online'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install eve_online
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
TODO: Write usage instructions here
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
|
+
|
32
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Issue reports and pull requests are welcome on GitHub at https://github.com/biow0lf/eve_online.
|
37
|
+
|
38
|
+
## Changelog
|
39
|
+
|
40
|
+
v0.2.0: AccountBalance XML API, APIKeyInfo XML API, AccountStatus XML API.
|
41
|
+
|
42
|
+
v0.1.0: ServerStatus XML API.
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
47
|
+
|
data/Rakefile
ADDED
data/eve_online.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'eve_online/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'eve_online'
|
8
|
+
spec.version = EveOnline::VERSION
|
9
|
+
spec.authors = ['Igor Zubkov']
|
10
|
+
spec.email = ['igor.zubkov@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'EveOnline API. XML and CREST.'
|
13
|
+
spec.description = 'EveOnline API. XML and CREST.'
|
14
|
+
spec.homepage = 'https://github.com/biow0lf/eve_online'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
21
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
22
|
+
spec.add_development_dependency 'rspec'
|
23
|
+
spec.add_development_dependency 'rspec-its'
|
24
|
+
spec.add_development_dependency 'webmock'
|
25
|
+
|
26
|
+
spec.add_runtime_dependency 'nori', '~> 2.6'
|
27
|
+
end
|
data/lib/eve_online.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module EveOnline
|
4
|
+
# http://wiki.eve-id.net/APIv2_Char_AccountBalance_XML
|
5
|
+
class AccountBalance < Base
|
6
|
+
API_ENDPOINT = 'https://api.eveonline.com/char/AccountBalance.xml.aspx'
|
7
|
+
|
8
|
+
def current_time
|
9
|
+
# TODO: time in "(GMT) Monrovia, Reykjavik".
|
10
|
+
eveapi.fetch('currentTime')
|
11
|
+
end
|
12
|
+
|
13
|
+
def account_id
|
14
|
+
row.fetch('@accountID').to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
def account_key
|
18
|
+
row.fetch('@accountKey')
|
19
|
+
end
|
20
|
+
|
21
|
+
def balance
|
22
|
+
row.fetch('@balance')
|
23
|
+
end
|
24
|
+
|
25
|
+
def row
|
26
|
+
rowset.fetch('row')
|
27
|
+
end
|
28
|
+
|
29
|
+
def rowset
|
30
|
+
result.fetch('rowset')
|
31
|
+
end
|
32
|
+
|
33
|
+
def cached_until
|
34
|
+
eveapi.fetch('cachedUntil')
|
35
|
+
end
|
36
|
+
|
37
|
+
def version
|
38
|
+
eveapi.fetch('@version').to_i
|
39
|
+
end
|
40
|
+
|
41
|
+
def result
|
42
|
+
eveapi.fetch('result')
|
43
|
+
end
|
44
|
+
|
45
|
+
def eveapi
|
46
|
+
response.fetch('eveapi')
|
47
|
+
end
|
48
|
+
|
49
|
+
def url
|
50
|
+
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module EveOnline
|
4
|
+
class AccountStatus < Base
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/account/AccountStatus.xml.aspx'
|
6
|
+
|
7
|
+
def current_time
|
8
|
+
eveapi.fetch('currentTime')
|
9
|
+
end
|
10
|
+
|
11
|
+
def paid_until
|
12
|
+
result.fetch('paidUntil')
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_date
|
16
|
+
result.fetch('createDate')
|
17
|
+
end
|
18
|
+
|
19
|
+
def logon_count
|
20
|
+
result.fetch('logonCount').to_i
|
21
|
+
end
|
22
|
+
|
23
|
+
def logon_minutes
|
24
|
+
result.fetch('logonMinutes').to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
def cached_until
|
28
|
+
eveapi.fetch('cachedUntil')
|
29
|
+
end
|
30
|
+
|
31
|
+
def version
|
32
|
+
eveapi.fetch('@version').to_i
|
33
|
+
end
|
34
|
+
|
35
|
+
def result
|
36
|
+
eveapi.fetch('result')
|
37
|
+
end
|
38
|
+
|
39
|
+
def eveapi
|
40
|
+
response.fetch('eveapi')
|
41
|
+
end
|
42
|
+
|
43
|
+
def url
|
44
|
+
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module EveOnline
|
4
|
+
# http://wiki.eve-id.net/APIv2_Account_APIKeyInfo_XML
|
5
|
+
class ApiKeyInfo < Base
|
6
|
+
API_ENDPOINT = 'https://api.eveonline.com/account/APIKeyInfo.xml.aspx'
|
7
|
+
|
8
|
+
def character_id
|
9
|
+
row.fetch('@characterID').to_i
|
10
|
+
end
|
11
|
+
|
12
|
+
def character_name
|
13
|
+
row.fetch('@characterName')
|
14
|
+
end
|
15
|
+
|
16
|
+
def corporation_id
|
17
|
+
row.fetch('@corporationID').to_i
|
18
|
+
end
|
19
|
+
|
20
|
+
def corporation_name
|
21
|
+
row.fetch('@corporationName')
|
22
|
+
end
|
23
|
+
|
24
|
+
def alliance_id
|
25
|
+
row.fetch('@allianceID').to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
def alliance_name
|
29
|
+
row.fetch('@allianceName')
|
30
|
+
end
|
31
|
+
|
32
|
+
def faction_id
|
33
|
+
row.fetch('@factionID').to_i
|
34
|
+
end
|
35
|
+
|
36
|
+
def faction_name
|
37
|
+
row.fetch('@factionName')
|
38
|
+
end
|
39
|
+
|
40
|
+
def row
|
41
|
+
rowset.fetch('row')
|
42
|
+
end
|
43
|
+
|
44
|
+
def rowset
|
45
|
+
key.fetch('rowset')
|
46
|
+
end
|
47
|
+
|
48
|
+
def expires
|
49
|
+
key.fetch('@expires')
|
50
|
+
end
|
51
|
+
|
52
|
+
def type
|
53
|
+
key.fetch('@type')
|
54
|
+
end
|
55
|
+
|
56
|
+
def access_mask
|
57
|
+
key.fetch('@accessMask')
|
58
|
+
end
|
59
|
+
|
60
|
+
def key
|
61
|
+
result.fetch('key')
|
62
|
+
end
|
63
|
+
|
64
|
+
def current_time
|
65
|
+
# TODO: time in "(GMT) Monrovia, Reykjavik".
|
66
|
+
eveapi.fetch('currentTime')
|
67
|
+
end
|
68
|
+
|
69
|
+
def cached_until
|
70
|
+
eveapi.fetch('cachedUntil')
|
71
|
+
end
|
72
|
+
|
73
|
+
def version
|
74
|
+
eveapi.fetch('@version').to_i
|
75
|
+
end
|
76
|
+
|
77
|
+
def result
|
78
|
+
eveapi.fetch('result')
|
79
|
+
end
|
80
|
+
|
81
|
+
def eveapi
|
82
|
+
response.fetch('eveapi')
|
83
|
+
end
|
84
|
+
|
85
|
+
def url
|
86
|
+
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module EveOnline
|
2
|
+
class Base
|
3
|
+
attr_reader :key_id, :v_code, :parser
|
4
|
+
|
5
|
+
def initialize(key_id = nil, v_code = nil, parser = Nori.new)
|
6
|
+
@key_id = key_id
|
7
|
+
@v_code = v_code
|
8
|
+
@parser = parser
|
9
|
+
end
|
10
|
+
|
11
|
+
def url
|
12
|
+
raise NotImplementedError
|
13
|
+
end
|
14
|
+
|
15
|
+
def content
|
16
|
+
open(url, open_timeout: 60, read_timeout: 60).read
|
17
|
+
end
|
18
|
+
|
19
|
+
def response
|
20
|
+
@response ||= parser.parse(content)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module EveOnline
|
4
|
+
# http://wiki.eve-id.net/APIv2_Server_ServerStatus_XML
|
5
|
+
class ServerStatus < Base
|
6
|
+
API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'
|
7
|
+
|
8
|
+
def current_time
|
9
|
+
# TODO: time in "(GMT) Monrovia, Reykjavik".
|
10
|
+
eveapi.fetch('currentTime')
|
11
|
+
end
|
12
|
+
|
13
|
+
def server_open?
|
14
|
+
result.fetch('serverOpen') == 'True'
|
15
|
+
end
|
16
|
+
|
17
|
+
def online_players
|
18
|
+
result.fetch('onlinePlayers').to_i
|
19
|
+
end
|
20
|
+
|
21
|
+
def cached_until
|
22
|
+
# TODO: time in "(GMT) Monrovia, Reykjavik".
|
23
|
+
eveapi.fetch('cachedUntil')
|
24
|
+
end
|
25
|
+
|
26
|
+
def version
|
27
|
+
eveapi.fetch('@version').to_i
|
28
|
+
end
|
29
|
+
|
30
|
+
def result
|
31
|
+
eveapi.fetch('result')
|
32
|
+
end
|
33
|
+
|
34
|
+
def eveapi
|
35
|
+
response.fetch('eveapi')
|
36
|
+
end
|
37
|
+
|
38
|
+
def url
|
39
|
+
API_ENDPOINT
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eve_online
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Igor Zubkov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-20 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.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
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: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-its
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: nori
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.6'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.6'
|
97
|
+
description: EveOnline API. XML and CREST.
|
98
|
+
email:
|
99
|
+
- igor.zubkov@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".codeclimate.yml"
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".rubocop.yml"
|
108
|
+
- ".travis.yml"
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- eve_online.gemspec
|
114
|
+
- lib/eve_online.rb
|
115
|
+
- lib/eve_online/account_balance.rb
|
116
|
+
- lib/eve_online/account_status.rb
|
117
|
+
- lib/eve_online/api_key_info.rb
|
118
|
+
- lib/eve_online/base.rb
|
119
|
+
- lib/eve_online/server_status.rb
|
120
|
+
- lib/eve_online/version.rb
|
121
|
+
homepage: https://github.com/biow0lf/eve_online
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.4.8
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: EveOnline API. XML and CREST.
|
145
|
+
test_files: []
|