rakuten 0.1.0 → 0.1.1
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.
- data/README.md +2 -2
- data/lib/rakuten.rb +3 -3
- data/lib/rakuten/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
|
@@ -29,8 +29,8 @@ APIのバージョンやパラメーターについては、楽天WEB SERVICEの
|
|
|
29
29
|
|
|
30
30
|
結果は、レスポンスJSONからハッシュの形で取得します.
|
|
31
31
|
|
|
32
|
-
cnt = result['count']
|
|
33
|
-
items = result['Items']['Item']
|
|
32
|
+
cnt = result['count'] # アイテム件数
|
|
33
|
+
items = result['Items']['Item'] # アイテム配列
|
|
34
34
|
|
|
35
35
|
形式は呼び出したAPIによって様々です. 楽天WEB SERVICEの [ドキュメント](http://webservice.rakuten.co.jp/) の、各APIの解説にある出力パラメーターの欄を参照してください.
|
|
36
36
|
|
data/lib/rakuten.rb
CHANGED
|
@@ -12,15 +12,15 @@ module Rakuten
|
|
|
12
12
|
class Client
|
|
13
13
|
attr_reader :raw_response
|
|
14
14
|
|
|
15
|
-
def initialize(developer_id, affiliate_id = nil)
|
|
16
|
-
@developer_id, @affiliate_id = developer_id, affiliate_id
|
|
15
|
+
def initialize(developer_id, affiliate_id = nil, http_opts = {})
|
|
16
|
+
@developer_id, @affiliate_id, @http_opts = developer_id, affiliate_id, http_opts
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
# リクエストを実行して結果を返す.
|
|
20
20
|
# 結果はJSONをパーズしたHash.
|
|
21
21
|
# リクエストに失敗したら例外をスローする.
|
|
22
22
|
def request(operation, version = nil, params = {})
|
|
23
|
-
response = open(request_url(operation, version, params)) do |f|
|
|
23
|
+
response = open(request_url(operation, version, params), @http_opts) do |f|
|
|
24
24
|
@raw_response = f.read
|
|
25
25
|
JSON.parse(@raw_response)
|
|
26
26
|
end
|
data/lib/rakuten/version.rb
CHANGED