hyperscore 0.0.10 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,55 +3,55 @@ require 'hyperclient'
3
3
  require 'hyperscore/coercions'
4
4
 
5
5
  module Hyperscore
6
-
6
+
7
7
  class Client
8
8
  include Hyperclient
9
-
9
+
10
10
  def initialize(url='http://cs-api.heroku.com/api/')
11
11
  @client = Hyperclient::EntryPoint.new url, {
12
12
  headers: { 'Accept-Encoding' => 'gzip,deflate' }
13
13
  }
14
14
  end
15
-
15
+
16
16
  def news
17
- @client.links.news.resources.news.map do |news|
17
+ @client.links.news.embedded.news.map do |news|
18
18
  Hyperscore::Coercions::News.new( news.attributes.merge({
19
- :source => news.url,
20
- :site => news.links['alternate'].url
19
+ :source => news.links.self.url,
20
+ :site => news.links.alternate.url
21
21
  }) )
22
22
  end
23
23
  end
24
-
24
+
25
25
  def submissions
26
- @client.links.submissions.resources.submissions
26
+ @client.links.submissions.embedded.submissions
27
27
  end
28
-
28
+
29
29
  def games
30
- @client.links.games.resources.games
30
+ @client.links.games.embedded.games
31
31
  end
32
-
32
+
33
33
  def user(username)
34
34
  user = @client.links.users.links.search.expand({username: username}).get
35
-
35
+
36
36
  user.key?('error') ? nil : user
37
37
  end
38
-
38
+
39
39
  def profile(username)
40
40
  get_user(username).links.profile.url
41
41
  end
42
-
42
+
43
43
  def dashboard(username)
44
44
  get_user(username).links.dashboard.url
45
45
  end
46
-
46
+
47
47
  def motd
48
48
  @client.attributes['motd']
49
49
  end
50
-
50
+
51
51
  private
52
52
  def get_user(username)
53
53
  user = @client.links.users.links.search.expand({username: username})
54
54
  end
55
55
  end
56
-
56
+
57
57
  end
@@ -1,3 +1,3 @@
1
1
  module Hyperscore
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.12"
3
3
  end
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.10
4
+ version: 0.0.12
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-10-01 00:00:00.000000000 Z
12
+ date: 2012-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: virtus