hyperscore 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/hyperscore.gemspec +1 -1
- data/lib/hyperscore/client.rb +28 -10
- data/lib/hyperscore/version.rb +1 -1
- metadata +4 -4
data/Gemfile
CHANGED
data/hyperscore.gemspec
CHANGED
data/lib/hyperscore/client.rb
CHANGED
@@ -7,15 +7,14 @@ module Hyperscore
|
|
7
7
|
class Client
|
8
8
|
include Hyperclient
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
url and self.class.entry_point url
|
10
|
+
def initialize(url='http://cs-api.heroku.com/api/')
|
11
|
+
@client = Hyperclient::EntryPoint.new url, {
|
12
|
+
headers: { 'Accept-Encoding' => 'gzip,deflate' }
|
13
|
+
}
|
15
14
|
end
|
16
15
|
|
17
16
|
def news
|
18
|
-
links.news.resources.news.map do |news|
|
17
|
+
@client.links.news.resources.news.map do |news|
|
19
18
|
Hyperscore::Coercions::News.new( news.attributes.merge({
|
20
19
|
:source => news.url,
|
21
20
|
:site => news.links['alternate'].url
|
@@ -24,16 +23,35 @@ module Hyperscore
|
|
24
23
|
end
|
25
24
|
|
26
25
|
def submissions
|
27
|
-
links.submissions.resources.submissions
|
26
|
+
@client.links.submissions.resources.submissions
|
28
27
|
end
|
29
28
|
|
30
29
|
def games
|
31
|
-
links.games.resources.games
|
30
|
+
@client.links.games.resources.games
|
31
|
+
end
|
32
|
+
|
33
|
+
def user(username)
|
34
|
+
user = @client.links.users.links.search.expand({username: username}).get
|
35
|
+
|
36
|
+
user.key?('error') ? nil : user
|
37
|
+
end
|
38
|
+
|
39
|
+
def profile(username)
|
40
|
+
get_user(username).links.profile.url
|
41
|
+
end
|
42
|
+
|
43
|
+
def dashboard(username)
|
44
|
+
get_user(username).links.dashboard.url
|
32
45
|
end
|
33
46
|
|
34
47
|
def motd
|
35
|
-
attributes['motd']
|
48
|
+
@client.attributes['motd']
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def get_user(username)
|
53
|
+
user = @client.links.users.links.search.expand({username: username})
|
36
54
|
end
|
37
55
|
end
|
38
56
|
|
39
|
-
end
|
57
|
+
end
|
data/lib/hyperscore/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyperscore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: virtus
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 0.1.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 0.1.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: pry
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|