lib/libgss/action_request.rb in libgss-0.4.1 vs lib/libgss/action_request.rb in libgss-0.5.0

- old
+ new

@@ -19,17 +19,18 @@ STATUS_ERROR = 5 STATUS_TIMEOUT = 6 # 読み込みのみ、書き込み不可 - attr_reader :action_url + attr_reader :action_url, :req_headers attr_reader :status, :outputs # コンストラクタ - def initialize(httpclient, action_url) + def initialize(httpclient, action_url, req_headers) @httpclient = httpclient @action_url = action_url + @req_headers = req_headers @status = STATUS_PREPARING @actions = [] @action_id = 0; end @@ -49,11 +50,11 @@ action end # アクション群を実行するために実際にHTTPリクエストを送信します。 def send_request(&callback) - res = @httpclient.post(action_url, {"inputs" => @actions.map(&:to_hash)}.to_json) + res = @httpclient.post(action_url, {"inputs" => @actions.map(&:to_hash)}.to_json, req_headers) case res.code.to_i when 200..299 then # OK else raise Error, "failed to send action request: [#{res.code}] #{res.body}" end @@ -307,9 +308,18 @@ # @param [String] name 対象となるコレクション名 # @param [Hash] target 対象となるフレンドのID # @return def unblock(name, target) args = {action: "unblock", name: name, target: target} + add_action(args) + end + + + # マスタの差分を取得します + # @param [Hash] downloaded_versions キーが対象となるコレクション名、値がそのバージョンを示すHash + # @return 差分コレクション毎の差分を示すHashの配列 + def master_diffs(downloaded_versions) + args = {action: "master_diffs", downloaded_versions: downloaded_versions} add_action(args) end end