impas-client 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -101,5 +101,23 @@ module Impas
101
101
  desc = JSON.parse(res.body)
102
102
  desc["description"]["ranking"]
103
103
  end
104
+
105
+ def recommend(grp_key, visitor, limit=10)
106
+ entry_point = "/api/recommend/#{grp_key}/#{visitor}/#{limit}"
107
+ res = @@conn.get entry_point
108
+
109
+ if res.status == 200
110
+ desc = JSON.parse(res.body)
111
+
112
+ if desc["result"] != "ok"
113
+ raise StandardError.new("Process error. message:#{desc['explain']}")
114
+ end
115
+ else
116
+ raise StandardError.new("HTTP status:#{res.status}")
117
+ end
118
+
119
+ desc = JSON.parse(res.body)
120
+ desc["description"]["recommends"]
121
+ end
104
122
  end
105
123
  end
@@ -1,6 +1,6 @@
1
1
  module Impas
2
2
  class Client
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  API_URL = "http://impas-hideack.sqale.jp/"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: impas-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
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: 2013-03-23 00:00:00.000000000 Z
12
+ date: 2013-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec