rest-gw2 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/CHANGES.md +28 -0
- data/LICENSE +201 -0
- data/README.md +33 -6
- data/Rakefile +8 -2
- data/bin/rest-gw2 +4 -0
- data/config.ru +3 -0
- data/lib/rest-gw2/client.rb +133 -10
- data/lib/rest-gw2/server.rb +328 -32
- data/lib/rest-gw2/server/cache.rb +38 -0
- data/lib/rest-gw2/server/runner.rb +108 -0
- data/lib/rest-gw2/version.rb +4 -0
- data/lib/rest-gw2/view/error.erb +1 -0
- data/lib/rest-gw2/view/index.erb +16 -0
- data/lib/rest-gw2/view/info.erb +17 -0
- data/lib/rest-gw2/view/items.erb +18 -0
- data/lib/rest-gw2/view/layout.erb +57 -0
- data/lib/rest-gw2/view/menu.erb +15 -0
- data/lib/rest-gw2/view/pages.erb +7 -0
- data/lib/rest-gw2/view/transactions.erb +28 -0
- data/lib/rest-gw2/view/wallet.erb +16 -0
- data/lib/rest-gw2/view/wip.erb +1 -0
- data/rest-gw2.gemspec +39 -8
- metadata +92 -6
- data/lib/rest-gw2/view/bank.erb +0 -25
@@ -0,0 +1 @@
|
|
1
|
+
Error: <%= h @error %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h1>Enter your <a href="https://account.arena.net/applications">API Key</a> to browse your data</h1>
|
2
|
+
<h2>Features:</h2>
|
3
|
+
<ul>
|
4
|
+
<li>No data is stored at all. Your data is free.</li>
|
5
|
+
<li>However, there's a 10 minutes cache to improve user experience.</li>
|
6
|
+
<li>You could paste your URL for other people to browse your data.</li>
|
7
|
+
<li>Your API Key is encrypted with AES128-GCM in the URL. (namely, t=...)
|
8
|
+
Therefore your API Key is safe and hidden to 3rd party.</li>
|
9
|
+
<li>Give whatever permissions.
|
10
|
+
Data without permission would simply be hidden or ignored.</li>
|
11
|
+
<li>Feel free to share your data on the
|
12
|
+
<a href="https://github.com/godfat/rest-gw2/issues">issue tracker</a>,
|
13
|
+
or report issues, of course. This is
|
14
|
+
<a href="https://github.com/godfat/rest-gw2/issues/1">godfat.2604</a>.
|
15
|
+
</li>
|
16
|
+
</ul>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<table>
|
2
|
+
<% @info.each do |key, value| %>
|
3
|
+
<% if value.kind_of?(Array) %>
|
4
|
+
<% value.each.with_index do |v, i| %>
|
5
|
+
<tr>
|
6
|
+
<th><%= h key %> (<%= i %>)</th>
|
7
|
+
<td><%= h v %></td>
|
8
|
+
</tr>
|
9
|
+
<% end %>
|
10
|
+
<% else %>
|
11
|
+
<tr>
|
12
|
+
<th><%= h key %></th>
|
13
|
+
<td><%= h value %></td>
|
14
|
+
</tr>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
</table>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Total: <%= price(@buy) %> / <%= price(@sell) %>
|
2
|
+
<ul class="item">
|
3
|
+
<% @items.each do |item| %>
|
4
|
+
<li>
|
5
|
+
<% if item %>
|
6
|
+
<%= item_wiki(item) %>
|
7
|
+
<span class="description">
|
8
|
+
<%= h item['name'] || "?#{item['id']}?" %>
|
9
|
+
<%= h item_count(item) %>
|
10
|
+
<br/>
|
11
|
+
<%= item_price(item) %>
|
12
|
+
</span>
|
13
|
+
<% else %>
|
14
|
+
<%= blank_icon %>
|
15
|
+
<% end %>
|
16
|
+
</li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
|
4
|
+
<head profile="http://www.w3.org/2005/10/profile">
|
5
|
+
<meta http-equiv="Content-Type"
|
6
|
+
content="application/xhtml+xml; charset=utf-8"/>
|
7
|
+
<meta name="description"
|
8
|
+
content="GW2 Account Browser allows you to browse your data"/>
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
10
|
+
<link rel="icon" type="image/png" href="https://render.guildwars2.com/file/220061640ECA41C0577758030357221B4ECCE62C/502065.png"/>
|
11
|
+
<title>GW2 Account Browser</title>
|
12
|
+
<style type="text/css">
|
13
|
+
.menu li{ display: inline-block; }
|
14
|
+
.menu li:before{ content: '| '; }
|
15
|
+
.menu li:first-child:before{ content: none; }
|
16
|
+
.item li{ display: inline-block; border: 1px solid;
|
17
|
+
width: 40%; max-width: 400px;
|
18
|
+
padding: 5px; margin: 5px; }
|
19
|
+
.description{ display: inline-block; vertical-align: middle;
|
20
|
+
white-space: nowrap; max-width: 330px;
|
21
|
+
overflow: hidden; text-overflow: ellipsis; }
|
22
|
+
.description:hover{ overflow: visible; }
|
23
|
+
.icon { width: 64px; height: 64px; vertical-align: middle; }
|
24
|
+
.missing{ opacity: 0.4; }
|
25
|
+
.price{ vertical-align: -1.5px; padding-left: 1px; }
|
26
|
+
</style>
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<div id="menu">
|
30
|
+
<%= erb :menu %>
|
31
|
+
</div>
|
32
|
+
<div id="access_token">
|
33
|
+
<form method="post" enctype="application/x-www-form-urlencoded"
|
34
|
+
action="<%= path('/access_token') %>">
|
35
|
+
<input type="hidden" name="referrer"
|
36
|
+
value="<%= path(request.path) %>"/>
|
37
|
+
API Key:
|
38
|
+
<input type="text" id="access_token_input" name="access_token"
|
39
|
+
size="72" minlength="72" maxlength="72"
|
40
|
+
onclick="this.select()"/>
|
41
|
+
</form>
|
42
|
+
</div>
|
43
|
+
<div id="content">
|
44
|
+
<hr/>
|
45
|
+
<%= yield %>
|
46
|
+
</div>
|
47
|
+
<div id="footer">
|
48
|
+
<a href="https://www.godfat.org/gw2/">Site</a>
|
49
|
+
/
|
50
|
+
<a href="https://github.com/godfat/rest-gw2">Source</a>
|
51
|
+
/
|
52
|
+
<a href="https://github.com/godfat/rest-gw2/issues">Help</a>
|
53
|
+
©
|
54
|
+
2015 Lin Jen-Shin (godfat.2604)
|
55
|
+
</div>
|
56
|
+
</body>
|
57
|
+
</html>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<ul class="menu">
|
2
|
+
<li><%= menu('/', 'Home') %></li>
|
3
|
+
<li><%= menu('/account', 'Account') %></li>
|
4
|
+
<li><%= menu('/characters', 'Characters') %></li>
|
5
|
+
<li><%= menu('/dyes', 'Dyes') %></li>
|
6
|
+
<li><%= menu('/skins', 'Skins') %></li>
|
7
|
+
<li><%= menu('/minis', 'Minis') %></li>
|
8
|
+
<li><%= menu('/achievements', 'Achievements') %></li>
|
9
|
+
<li><%= menu('/bank', 'Bank') %></li>
|
10
|
+
<li><%= menu('/materials', 'Materials') %></li>
|
11
|
+
<li><%= menu('/wallet', 'Wallet') %></li>
|
12
|
+
<li><%= menu_trans('/buying', 'Transactions') %></li>
|
13
|
+
<li><%= menu('/tokeninfo', 'Info') %></li>
|
14
|
+
<li><a href="<%= refresh_path %>">Refresh</a></li>
|
15
|
+
</ul>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<ul class="menu">
|
2
|
+
<li><%= menu_trans('/buying', 'Buying') %></li>
|
3
|
+
<li><%= menu_trans('/selling', 'Selling') %></li>
|
4
|
+
<li><%= menu_trans('/bought', 'Bought') %></li>
|
5
|
+
<li><%= menu_trans('/sold', 'Sold') %></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<%= erb :pages %>
|
9
|
+
|
10
|
+
Total: <%= price(@total) %>
|
11
|
+
<ul class="item">
|
12
|
+
<% @trans.each do |trans| %>
|
13
|
+
<li>
|
14
|
+
<%= item_wiki(trans) %>
|
15
|
+
<span class="description">
|
16
|
+
<%= h trans['name'] || "?#{trans['id']}?" %>
|
17
|
+
<%= h item_count(trans) %>
|
18
|
+
<br/>
|
19
|
+
<%= price(trans['price']) %>
|
20
|
+
<%= abbr_time_ago(trans['purchased'] || trans['created']) %>
|
21
|
+
<br/>
|
22
|
+
<%= item_price(trans) %>
|
23
|
+
</span>
|
24
|
+
</li>
|
25
|
+
<% end %>
|
26
|
+
</ul>
|
27
|
+
|
28
|
+
<%= erb :pages %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<ul class="item">
|
2
|
+
<% @wallet.each do |currency| %>
|
3
|
+
<li>
|
4
|
+
<%= item_wiki(currency) %>
|
5
|
+
<span class="description">
|
6
|
+
<%= h currency['name'] %>
|
7
|
+
<br/>
|
8
|
+
<% if currency['name'] == 'Coin' %>
|
9
|
+
<%= price(currency['value']) %>
|
10
|
+
<% else %>
|
11
|
+
<%= h currency['value'].to_s.gsub(/(\d)(?=\d{3}+$)/, '\1,') %>
|
12
|
+
<% end %>
|
13
|
+
</span>
|
14
|
+
</li>
|
15
|
+
<% end %>
|
16
|
+
</ul>
|
@@ -0,0 +1 @@
|
|
1
|
+
Under construction...
|
data/rest-gw2.gemspec
CHANGED
@@ -1,43 +1,74 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: rest-gw2 0.
|
2
|
+
# stub: rest-gw2 0.2.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "rest-gw2"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.2.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Lin Jen-Shin (godfat)"]
|
11
|
-
s.date = "2015-
|
11
|
+
s.date = "2015-12-28"
|
12
12
|
s.description = "A very simple [Guild Wars 2 API](https://wiki.guildwars2.com/wiki/API:Main)\nclient built with [rest-core](https://github.com/godfat/rest-core).\n\nThere's also a bundled web application showing your items, serving as an\nexample using the client."
|
13
13
|
s.email = ["godfat (XD) godfat.org"]
|
14
|
+
s.executables = ["rest-gw2"]
|
14
15
|
s.files = [
|
15
16
|
".gitignore",
|
16
17
|
".gitmodules",
|
18
|
+
"CHANGES.md",
|
19
|
+
"LICENSE",
|
17
20
|
"README.md",
|
18
21
|
"Rakefile",
|
22
|
+
"bin/rest-gw2",
|
19
23
|
"config.ru",
|
20
24
|
"lib/rest-gw2.rb",
|
21
25
|
"lib/rest-gw2/client.rb",
|
22
26
|
"lib/rest-gw2/server.rb",
|
23
|
-
"lib/rest-gw2/
|
27
|
+
"lib/rest-gw2/server/cache.rb",
|
28
|
+
"lib/rest-gw2/server/runner.rb",
|
29
|
+
"lib/rest-gw2/version.rb",
|
30
|
+
"lib/rest-gw2/view/error.erb",
|
31
|
+
"lib/rest-gw2/view/index.erb",
|
32
|
+
"lib/rest-gw2/view/info.erb",
|
33
|
+
"lib/rest-gw2/view/items.erb",
|
34
|
+
"lib/rest-gw2/view/layout.erb",
|
35
|
+
"lib/rest-gw2/view/menu.erb",
|
36
|
+
"lib/rest-gw2/view/pages.erb",
|
37
|
+
"lib/rest-gw2/view/transactions.erb",
|
38
|
+
"lib/rest-gw2/view/wallet.erb",
|
39
|
+
"lib/rest-gw2/view/wip.erb",
|
24
40
|
"rest-gw2.gemspec",
|
25
41
|
"task/README.md",
|
26
42
|
"task/gemgem.rb"]
|
27
43
|
s.homepage = "https://github.com/godfat/rest-gw2"
|
28
44
|
s.licenses = ["Apache License 2.0"]
|
29
|
-
s.rubygems_version = "2.5.
|
45
|
+
s.rubygems_version = "2.5.1"
|
30
46
|
s.summary = "A very simple [Guild Wars 2 API](https://wiki.guildwars2.com/wiki/API:Main)"
|
31
47
|
|
32
48
|
if s.respond_to? :specification_version then
|
33
49
|
s.specification_version = 4
|
34
50
|
|
35
51
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
36
|
-
s.add_runtime_dependency(%q<rest-core>, [">=
|
52
|
+
s.add_runtime_dependency(%q<rest-core>, [">= 3.5.92"])
|
53
|
+
s.add_development_dependency(%q<jellyfish>, [">= 0"])
|
54
|
+
s.add_development_dependency(%q<rack>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<rack-handlers>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<dalli>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<lru_redux>, [">= 0"])
|
37
58
|
else
|
38
|
-
s.add_dependency(%q<rest-core>, [">=
|
59
|
+
s.add_dependency(%q<rest-core>, [">= 3.5.92"])
|
60
|
+
s.add_dependency(%q<jellyfish>, [">= 0"])
|
61
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
62
|
+
s.add_dependency(%q<rack-handlers>, [">= 0"])
|
63
|
+
s.add_dependency(%q<dalli>, [">= 0"])
|
64
|
+
s.add_dependency(%q<lru_redux>, [">= 0"])
|
39
65
|
end
|
40
66
|
else
|
41
|
-
s.add_dependency(%q<rest-core>, [">=
|
67
|
+
s.add_dependency(%q<rest-core>, [">= 3.5.92"])
|
68
|
+
s.add_dependency(%q<jellyfish>, [">= 0"])
|
69
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
70
|
+
s.add_dependency(%q<rack-handlers>, [">= 0"])
|
71
|
+
s.add_dependency(%q<dalli>, [">= 0"])
|
72
|
+
s.add_dependency(%q<lru_redux>, [">= 0"])
|
42
73
|
end
|
43
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-gw2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Jen-Shin (godfat)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-core
|
@@ -16,9 +16,79 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.5.92
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.5.92
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jellyfish
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rack
|
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: rack-handlers
|
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: dalli
|
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: lru_redux
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
22
92
|
version_requirements: !ruby/object:Gem::Requirement
|
23
93
|
requirements:
|
24
94
|
- - ">="
|
@@ -32,19 +102,35 @@ description: |-
|
|
32
102
|
example using the client.
|
33
103
|
email:
|
34
104
|
- godfat (XD) godfat.org
|
35
|
-
executables:
|
105
|
+
executables:
|
106
|
+
- rest-gw2
|
36
107
|
extensions: []
|
37
108
|
extra_rdoc_files: []
|
38
109
|
files:
|
39
110
|
- ".gitignore"
|
40
111
|
- ".gitmodules"
|
112
|
+
- CHANGES.md
|
113
|
+
- LICENSE
|
41
114
|
- README.md
|
42
115
|
- Rakefile
|
116
|
+
- bin/rest-gw2
|
43
117
|
- config.ru
|
44
118
|
- lib/rest-gw2.rb
|
45
119
|
- lib/rest-gw2/client.rb
|
46
120
|
- lib/rest-gw2/server.rb
|
47
|
-
- lib/rest-gw2/
|
121
|
+
- lib/rest-gw2/server/cache.rb
|
122
|
+
- lib/rest-gw2/server/runner.rb
|
123
|
+
- lib/rest-gw2/version.rb
|
124
|
+
- lib/rest-gw2/view/error.erb
|
125
|
+
- lib/rest-gw2/view/index.erb
|
126
|
+
- lib/rest-gw2/view/info.erb
|
127
|
+
- lib/rest-gw2/view/items.erb
|
128
|
+
- lib/rest-gw2/view/layout.erb
|
129
|
+
- lib/rest-gw2/view/menu.erb
|
130
|
+
- lib/rest-gw2/view/pages.erb
|
131
|
+
- lib/rest-gw2/view/transactions.erb
|
132
|
+
- lib/rest-gw2/view/wallet.erb
|
133
|
+
- lib/rest-gw2/view/wip.erb
|
48
134
|
- rest-gw2.gemspec
|
49
135
|
- task/README.md
|
50
136
|
- task/gemgem.rb
|
@@ -68,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
154
|
version: '0'
|
69
155
|
requirements: []
|
70
156
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.5.
|
157
|
+
rubygems_version: 2.5.1
|
72
158
|
signing_key:
|
73
159
|
specification_version: 4
|
74
160
|
summary: A very simple [Guild Wars 2 API](https://wiki.guildwars2.com/wiki/API:Main)
|
data/lib/rest-gw2/view/bank.erb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-TW">
|
4
|
-
<head profile="http://www.w3.org/2005/10/profile">
|
5
|
-
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
|
6
|
-
<meta name="description" content="godfat.org"/>
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
8
|
-
<title>GW2 Bank</title>
|
9
|
-
</head>
|
10
|
-
<body>
|
11
|
-
<ul>
|
12
|
-
<% @items.each do |item| %>
|
13
|
-
<li>
|
14
|
-
<% if item %>
|
15
|
-
<img src="<%= item['icon'] %>" style="width:64px; height:64px"
|
16
|
-
title="<%= item_title(item) %>"/>
|
17
|
-
(<%= item['count'] %>) <%= item['name'] %>
|
18
|
-
<% else %>
|
19
|
-
N/A
|
20
|
-
<% end %>
|
21
|
-
</li>
|
22
|
-
<% end %>
|
23
|
-
</ul>
|
24
|
-
</body>
|
25
|
-
</html>
|