mushikago-sdk 0.3.6 → 0.3.7
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 +3 -1
- data/lib/mushikago/configuration.rb +1 -0
- data/lib/mushikago/http.rb +7 -1
- data/lib/mushikago/http/client.rb +5 -1
- data/lib/mushikago/http/{multipart_request.rb → multipart.rb} +0 -2
- data/lib/mushikago/http/request.rb +6 -7
- data/lib/mushikago/http/request/delete.rb +17 -0
- data/lib/mushikago/http/request/get.rb +16 -0
- data/lib/mushikago/http/request/multipart_post.rb +18 -0
- data/lib/mushikago/http/request/multipart_put.rb +19 -0
- data/lib/mushikago/http/request/post.rb +17 -0
- data/lib/mushikago/http/request/put.rb +18 -0
- data/lib/mushikago/mitsubachi.rb +0 -2
- data/lib/mushikago/mitsubachi/http_fetch_request.rb +2 -6
- data/lib/mushikago/mitsubachi/http_push_request.rb +2 -6
- data/lib/mushikago/mitsubachi/project_create_request.rb +2 -6
- data/lib/mushikago/mitsubachi/project_delete_request.rb +2 -6
- data/lib/mushikago/mitsubachi/project_discontinue_request.rb +2 -6
- data/lib/mushikago/mitsubachi/project_info_request.rb +2 -2
- data/lib/mushikago/mitsubachi/project_list_request.rb +2 -2
- data/lib/mushikago/mitsubachi/project_queues_request.rb +2 -2
- data/lib/mushikago/mitsubachi/project_update_request.rb +2 -6
- data/lib/mushikago/mitsubachi/resource_delete_request.rb +2 -6
- data/lib/mushikago/mitsubachi/resource_get_request.rb +2 -2
- data/lib/mushikago/mitsubachi/resource_list_request.rb +2 -2
- data/lib/mushikago/mitsubachi/resource_store_request.rb +2 -6
- data/lib/mushikago/mitsubachi/script_delete_request.rb +2 -6
- data/lib/mushikago/mitsubachi/script_deploy_request.rb +2 -6
- data/lib/mushikago/mitsubachi/script_get_request.rb +2 -2
- data/lib/mushikago/mitsubachi/script_list_request.rb +2 -2
- data/lib/mushikago/tombo.rb +0 -1
- data/lib/mushikago/tombo/capture_request.rb +8 -13
- data/lib/mushikago/tombo/captures_request.rb +7 -7
- data/lib/mushikago/tombo/delete_request.rb +3 -8
- data/lib/mushikago/tombo/info_request.rb +2 -2
- data/lib/mushikago/version.rb +1 -1
- metadata +25 -22
- data/lib/mushikago/mitsubachi/multipart_request.rb +0 -33
- data/lib/mushikago/mitsubachi/request.rb +0 -32
- data/lib/mushikago/tombo/request.rb +0 -32
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Mushikago SDK for Ruby.
|
|
5
5
|
- **Author**: Toru Matsuoka
|
6
6
|
- **Copyright**: 2011
|
7
7
|
- **License**: Apache License, Version 2.0
|
8
|
-
- **Latest Version**: 0.3.
|
8
|
+
- **Latest Version**: 0.3.7
|
9
9
|
- **Release Date**: January 27th 2012
|
10
10
|
|
11
11
|
|
@@ -151,6 +151,8 @@ $ export MUSHIKAGO_SECRET_KEY=<シークレットキー>
|
|
151
151
|
変更履歴
|
152
152
|
--------
|
153
153
|
|
154
|
+
- **Feb.14.12**: 0.3.7 release
|
155
|
+
- Multipartでアップロードするファイルの最後に改行が付与される件修正
|
154
156
|
- **Jan.27.12**: 0.3.6 release
|
155
157
|
- resource_get,script_getに:with_bodyオプション追加
|
156
158
|
- **Jan.27.12**: 0.3.4 release
|
@@ -40,6 +40,7 @@ module Mushikago
|
|
40
40
|
add_option :api_key, ENV['MUSHIKAGO_API_KEY'] || ENV['MUSHIKAGO_API_KEY_ID']
|
41
41
|
add_option :secret_key, ENV['MUSHIKAGO_SECRET_KEY'] || ENV['MUSHIKAGO_SECRET_ACCESS_KEY']
|
42
42
|
add_option :endpoint, 'api.mushikago.org'
|
43
|
+
add_option :use_ssl, true
|
43
44
|
|
44
45
|
# @private
|
45
46
|
private
|
data/lib/mushikago/http.rb
CHANGED
@@ -4,8 +4,14 @@ module Mushikago
|
|
4
4
|
module Http
|
5
5
|
autoload :Client, 'mushikago/http/client'
|
6
6
|
autoload :Request, 'mushikago/http/request'
|
7
|
-
autoload :MultipartRequest, 'mushikago/http/
|
7
|
+
autoload :MultipartRequest, 'mushikago/http/multipart'
|
8
8
|
autoload :Response, 'mushikago/http/response'
|
9
|
+
autoload :GetRequest, 'mushikago/http/request/get'
|
10
|
+
autoload :PostRequest, 'mushikago/http/request/post'
|
11
|
+
autoload :PutRequest, 'mushikago/http/request/put'
|
12
|
+
autoload :DeleteRequest, 'mushikago/http/request/delete'
|
13
|
+
autoload :MultipartPostRequest, 'mushikago/http/request/multipart_post'
|
14
|
+
autoload :MultipartPutRequest, 'mushikago/http/request/multipart_put'
|
9
15
|
end
|
10
16
|
end
|
11
17
|
|
@@ -11,12 +11,16 @@ module Mushikago
|
|
11
11
|
# @return [Signer] signer
|
12
12
|
attr_reader :signer
|
13
13
|
|
14
|
+
# @return [Boolean] use_ssl
|
15
|
+
attr_reader :use_ssl
|
16
|
+
|
14
17
|
# @param [Hash] options
|
15
18
|
# @option options [String] :api_key(Configured value) APIキー
|
16
19
|
# @option options [String] :secret_key(Configured value) 秘密鍵
|
17
20
|
def initialize options={}
|
18
21
|
@api_key = (options[:api_key] || Mushikago.config.api_key).to_s
|
19
22
|
@signer = Mushikago::Auth::Signer.new((options[:secret_key] || Mushikago.config.secret_key).to_s)
|
23
|
+
@use_ssl = options.has_key?(:use_ssl) ? options[:use_ssl] : Mushikago.config.use_ssl
|
20
24
|
end
|
21
25
|
|
22
26
|
# @param [Mushikago::Http::Request] request
|
@@ -28,7 +32,7 @@ module Mushikago
|
|
28
32
|
request.add_signature!(signer)
|
29
33
|
|
30
34
|
# send request
|
31
|
-
Net::HTTP.start(request.host, request.port) do |http|
|
35
|
+
Net::HTTP.start(request.host, request.port, :use_ssl => use_ssl) do |http|
|
32
36
|
http_request = request.to_http_request
|
33
37
|
http_response = http.request(http_request)
|
34
38
|
return Mushikago::Http::Response.new(JSON.parse(http_response.body))
|
@@ -7,8 +7,6 @@ module Mushikago
|
|
7
7
|
class Request
|
8
8
|
# @return [Hash] headers
|
9
9
|
attr_reader :headers
|
10
|
-
# @return [String] http_method
|
11
|
-
attr_accessor :http_method
|
12
10
|
# @return [String] host
|
13
11
|
attr_accessor :host
|
14
12
|
# @return [Integer] port
|
@@ -18,13 +16,14 @@ module Mushikago
|
|
18
16
|
# @return [String] params
|
19
17
|
attr_reader :params
|
20
18
|
|
21
|
-
def initialize
|
19
|
+
def initialize options={}
|
22
20
|
@headers = {}
|
23
|
-
|
24
|
-
|
21
|
+
endpoint = options[:endpoint] || Mushikago.config.endpoint
|
22
|
+
host, port = endpoint.split(':')
|
23
|
+
@host = host
|
24
|
+
@port = port
|
25
25
|
@path = '/'
|
26
|
-
@params = {}
|
27
|
-
@http_method = new_http_request.method
|
26
|
+
@params = {}
|
28
27
|
end
|
29
28
|
|
30
29
|
# @param [String] key パラメータのキー
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
module Mushikago
|
3
|
+
module Http
|
4
|
+
# MushikagoのDELETEリクエストを表す抽象クラス
|
5
|
+
class DeleteRequest < Mushikago::Http::Request
|
6
|
+
def http_method; 'DELETE' end
|
7
|
+
include Mushikago::Auth::Signature
|
8
|
+
|
9
|
+
protected
|
10
|
+
def new_http_request
|
11
|
+
new_http_delete_request("#{path}?#{url_encoded_params}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
module Mushikago
|
3
|
+
module Http
|
4
|
+
# MushikagoのGETリクエストを表す抽象クラス
|
5
|
+
class GetRequest < Mushikago::Http::Request
|
6
|
+
def http_method; 'GET' end
|
7
|
+
include Mushikago::Auth::Signature
|
8
|
+
|
9
|
+
protected
|
10
|
+
def new_http_request
|
11
|
+
new_http_get_request("#{path}?#{url_encoded_params}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
module Mushikago
|
3
|
+
module Http
|
4
|
+
# MushikagoのPOSTリクエストを表す抽象クラス
|
5
|
+
class MultipartPostRequest < Mushikago::Http::MultipartRequest
|
6
|
+
def http_method; 'POST' end
|
7
|
+
include Mushikago::Auth::Signature
|
8
|
+
|
9
|
+
protected
|
10
|
+
def new_http_request
|
11
|
+
new_http_post_request(path)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
module Mushikago
|
3
|
+
module Http
|
4
|
+
# MushikagoのPUTリクエストを表す抽象クラス
|
5
|
+
class MultipartPutRequest < Mushikago::Http::MultipartRequest
|
6
|
+
def http_method; 'PUT' end
|
7
|
+
include Mushikago::Auth::Signature
|
8
|
+
|
9
|
+
protected
|
10
|
+
def new_http_request
|
11
|
+
new_http_put_request(path)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
module Mushikago
|
3
|
+
module Http
|
4
|
+
# MushikagoのPOSTリクエストを表す抽象クラス
|
5
|
+
class PostRequest < Mushikago::Http::Request
|
6
|
+
def http_method; 'POST' end
|
7
|
+
include Mushikago::Auth::Signature
|
8
|
+
|
9
|
+
protected
|
10
|
+
def new_http_request
|
11
|
+
new_http_post_request(path)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
module Mushikago
|
3
|
+
module Http
|
4
|
+
# MushikagoのPUTリクエストを表す抽象クラス
|
5
|
+
class PutRequest < Mushikago::Http::Request
|
6
|
+
def http_method; 'PUT' end
|
7
|
+
include Mushikago::Auth::Signature
|
8
|
+
|
9
|
+
protected
|
10
|
+
def new_http_request
|
11
|
+
new_http_put_request(path)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
data/lib/mushikago/mitsubachi.rb
CHANGED
@@ -3,8 +3,6 @@ module Mushikago
|
|
3
3
|
# mitsubachiにアクセスするためのモジュール
|
4
4
|
module Mitsubachi
|
5
5
|
autoload :Client, 'mushikago/mitsubachi/client'
|
6
|
-
autoload :Request, 'mushikago/mitsubachi/request'
|
7
|
-
autoload :MultipartRequest, 'mushikago/mitsubachi/multipart_request'
|
8
6
|
|
9
7
|
# project
|
10
8
|
autoload :ProjectCreateRequest, 'mushikago/mitsubachi/project_create_request'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class HttpFetchRequest <
|
5
|
-
def
|
4
|
+
class HttpFetchRequest < Mushikago::Http::PostRequest
|
5
|
+
def path; '/1/mitsubachi/http/fetch.json' end
|
6
6
|
request_parameter :url
|
7
7
|
request_parameter :project_name
|
8
8
|
request_parameter :script_name
|
@@ -23,10 +23,6 @@ module Mushikago
|
|
23
23
|
self.parameters = options[:parameters] if options.has_key?(:parameters)
|
24
24
|
self.header_overwrite = options[:header_overwrite] if options.has_key?(:header_overwrite)
|
25
25
|
end
|
26
|
-
|
27
|
-
def new_http_request
|
28
|
-
new_http_post_request(path)
|
29
|
-
end
|
30
26
|
end
|
31
27
|
end
|
32
28
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class HttpPushRequest <
|
5
|
-
def
|
4
|
+
class HttpPushRequest < Mushikago::Http::PostRequest
|
5
|
+
def path; '/1/mitsubachi/http/fetch.json' end
|
6
6
|
request_parameter :url
|
7
7
|
request_parameter :project_name
|
8
8
|
request_parameter :script_name
|
@@ -25,10 +25,6 @@ module Mushikago
|
|
25
25
|
self.header_overwrite = options[:header_overwrite] if options.has_key?(:header_overwrite)
|
26
26
|
self.mime_type = options[:mime_type] if options.has_key?(:mime_type)
|
27
27
|
end
|
28
|
-
|
29
|
-
def new_http_request
|
30
|
-
new_http_post_request(path)
|
31
|
-
end
|
32
28
|
end
|
33
29
|
end
|
34
30
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ProjectCreateRequest <
|
5
|
-
def
|
4
|
+
class ProjectCreateRequest < Mushikago::Http::PostRequest
|
5
|
+
def path; '/1/mitsubachi/project/create' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :dedicated, :default=>false do |v| (v ? 1 : 0).to_s end
|
8
8
|
request_parameter :max_lead_time do |v| v.to_i.to_s end
|
@@ -21,10 +21,6 @@ module Mushikago
|
|
21
21
|
self.system_log = options[:system_log]
|
22
22
|
self.log_prefix = options[:log_prefix] if options.has_key?(:log_prefix)
|
23
23
|
end
|
24
|
-
|
25
|
-
def new_http_request
|
26
|
-
new_http_post_request(path)
|
27
|
-
end
|
28
24
|
end
|
29
25
|
end
|
30
26
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ProjectDeleteRequest <
|
5
|
-
def
|
4
|
+
class ProjectDeleteRequest < Mushikago::Http::DeleteRequest
|
5
|
+
def path; '/1/mitsubachi/project/delete' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :forcedelete, :default=>true do |v| (v ? 1 : 0).to_s end
|
8
8
|
|
@@ -11,10 +11,6 @@ module Mushikago
|
|
11
11
|
self.project_name = project_name
|
12
12
|
self.forcedelete = options[:forcedelete]
|
13
13
|
end
|
14
|
-
|
15
|
-
def new_http_request
|
16
|
-
new_http_delete_request("#{path}?#{url_encoded_params}")
|
17
|
-
end
|
18
14
|
end
|
19
15
|
end
|
20
16
|
end
|
@@ -1,18 +1,14 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ProjectDiscontinueRequest <
|
5
|
-
def
|
4
|
+
class ProjectDiscontinueRequest < Mushikago::Http::PostRequest
|
5
|
+
def path; '/1/mitsubachi/project/discontinue' end
|
6
6
|
request_parameter :project_name
|
7
7
|
|
8
8
|
def initialize project_name, options={}
|
9
9
|
super(options)
|
10
10
|
self.project_name = project_name
|
11
11
|
end
|
12
|
-
|
13
|
-
def new_http_request
|
14
|
-
new_http_post_request(path)
|
15
|
-
end
|
16
12
|
end
|
17
13
|
end
|
18
14
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ProjectInfoRequest <
|
5
|
-
def
|
4
|
+
class ProjectInfoRequest < Mushikago::Http::GetRequest
|
5
|
+
def path; '/1/mitsubachi/project/info' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :time do |v| v.to_i.to_s end
|
8
8
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ProjectListRequest <
|
5
|
-
def
|
4
|
+
class ProjectListRequest < Mushikago::Http::GetRequest
|
5
|
+
def path; '/1/mitsubachi/project/list' end
|
6
6
|
request_parameter :limit do |v| v.to_i.to_s end
|
7
7
|
request_parameter :offset do |v| v.to_i.to_s end
|
8
8
|
request_parameter :filter
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ProjectQueuesRequest <
|
5
|
-
def
|
4
|
+
class ProjectQueuesRequest < Mushikago::Http::GetRequest
|
5
|
+
def path; '/1/mitsubachi/project/queues' end
|
6
6
|
request_parameter :project_name
|
7
7
|
|
8
8
|
def initialize project_name, options={}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ProjectUpdateRequest <
|
5
|
-
def
|
4
|
+
class ProjectUpdateRequest < Mushikago::Http::PostRequest
|
5
|
+
def path; '/1/mitsubachi/project/update' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :max_lead_time do |v| v.to_i.to_s end
|
8
8
|
request_parameter :stdout do |v| (v ? 1 : 0).to_s end
|
@@ -19,10 +19,6 @@ module Mushikago
|
|
19
19
|
self.system_log = options[:system_log] if options.has_key?(:system_log)
|
20
20
|
self.log_prefix = options[:log_prefix] if options.has_key?(:log_prefix)
|
21
21
|
end
|
22
|
-
|
23
|
-
def new_http_request
|
24
|
-
new_http_post_request(path)
|
25
|
-
end
|
26
22
|
end
|
27
23
|
end
|
28
24
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ResourceDeleteRequest <
|
5
|
-
def
|
4
|
+
class ResourceDeleteRequest < Mushikago::Http::DeleteRequest
|
5
|
+
def path; '/1/mitsubachi/resource/delete' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :file_name
|
8
8
|
|
@@ -11,10 +11,6 @@ module Mushikago
|
|
11
11
|
self.project_name = project_name
|
12
12
|
self.file_name = file_name
|
13
13
|
end
|
14
|
-
|
15
|
-
def new_http_request
|
16
|
-
new_http_delete_request("#{path}?#{url_encoded_params}")
|
17
|
-
end
|
18
14
|
end
|
19
15
|
end
|
20
16
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ResourceGetRequest <
|
5
|
-
def
|
4
|
+
class ResourceGetRequest < Mushikago::Http::GetRequest
|
5
|
+
def path; '/1/mitsubachi/resource/get' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :file_name
|
8
8
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ResourceListRequest <
|
5
|
-
def
|
4
|
+
class ResourceListRequest < Mushikago::Http::GetRequest
|
5
|
+
def path; '/1/mitsubachi/resource/list' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :limit do |v| v.to_i.to_s end
|
8
8
|
request_parameter :offset do |v| v.to_i.to_s end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ResourceStoreRequest <
|
5
|
-
def
|
4
|
+
class ResourceStoreRequest < Mushikago::Http::MultipartPostRequest
|
5
|
+
def path; '/1/mitsubachi/resource/store' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :file
|
8
8
|
request_parameter :file_name
|
@@ -21,10 +21,6 @@ module Mushikago
|
|
21
21
|
self.content_type = options[:content_type] || MIME::Types.of(file.path).first.to_s
|
22
22
|
self.public = options[:public]
|
23
23
|
end
|
24
|
-
|
25
|
-
def new_http_request
|
26
|
-
new_http_post_request(path)
|
27
|
-
end
|
28
24
|
end
|
29
25
|
end
|
30
26
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ScriptDeleteRequest <
|
5
|
-
def
|
4
|
+
class ScriptDeleteRequest < Mushikago::Http::DeleteRequest
|
5
|
+
def path; '/1/mitsubachi/script/delete' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :script_name
|
8
8
|
|
@@ -11,10 +11,6 @@ module Mushikago
|
|
11
11
|
self.project_name = project_name
|
12
12
|
self.script_name = script_name
|
13
13
|
end
|
14
|
-
|
15
|
-
def new_http_request
|
16
|
-
new_http_delete_request("#{path}?#{url_encoded_params}")
|
17
|
-
end
|
18
14
|
end
|
19
15
|
end
|
20
16
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ScriptDeployRequest <
|
5
|
-
def
|
4
|
+
class ScriptDeployRequest < Mushikago::Http::MultipartPostRequest
|
5
|
+
def path; '/1/mitsubachi/script/deploy' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :file
|
8
8
|
request_parameter :script_name
|
@@ -17,10 +17,6 @@ module Mushikago
|
|
17
17
|
end
|
18
18
|
self.script_name = options[:script_name] || file.path
|
19
19
|
end
|
20
|
-
|
21
|
-
def new_http_request
|
22
|
-
new_http_post_request(path)
|
23
|
-
end
|
24
20
|
end
|
25
21
|
end
|
26
22
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ScriptGetRequest <
|
5
|
-
def
|
4
|
+
class ScriptGetRequest < Mushikago::Http::GetRequest
|
5
|
+
def path; '/1/mitsubachi/script/get' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :script_name
|
8
8
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module Mushikago
|
3
3
|
module Mitsubachi
|
4
|
-
class ScriptListRequest <
|
5
|
-
def
|
4
|
+
class ScriptListRequest < Mushikago::Http::GetRequest
|
5
|
+
def path; '/1/mitsubachi/script/list' end
|
6
6
|
request_parameter :project_name
|
7
7
|
request_parameter :limit do |v| v.to_i.to_s end
|
8
8
|
request_parameter :offset do |v| v.to_i.to_s end
|
data/lib/mushikago/tombo.rb
CHANGED
@@ -3,7 +3,6 @@ module Mushikago
|
|
3
3
|
# Tomboへのアクセスを行うモジュール
|
4
4
|
module Tombo
|
5
5
|
autoload :Client, 'mushikago/tombo/client'
|
6
|
-
autoload :Request, 'mushikago/tombo/request'
|
7
6
|
autoload :CaptureRequest, 'mushikago/tombo/capture_request'
|
8
7
|
autoload :CapturesRequest, 'mushikago/tombo/captures_request'
|
9
8
|
autoload :DeleteRequest, 'mushikago/tombo/delete_request'
|
@@ -2,15 +2,15 @@
|
|
2
2
|
module Mushikago
|
3
3
|
module Tombo
|
4
4
|
# キャプチャリクエスト
|
5
|
-
class CaptureRequest <
|
6
|
-
def
|
5
|
+
class CaptureRequest < Mushikago::Http::PostRequest
|
6
|
+
def path; '/1/tombo/capture' end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
request_parameter :url
|
9
|
+
request_parameter :image_format
|
10
|
+
request_parameter :image_quality do |v| v.to_i.to_s end
|
11
|
+
request_parameter :thumbnail do |v| (v ? 1 : 0).to_s end
|
12
|
+
request_parameter :tags do |v| [v].flatten.compact.join(',') end
|
13
|
+
request_parameter :useragent
|
14
14
|
|
15
15
|
# @param [String] url キャプチャ対象のURL
|
16
16
|
# @param [Hash] options リクエストのオプション
|
@@ -29,11 +29,6 @@ module Mushikago
|
|
29
29
|
self.useragent = options[:useragent] if options.has_key?(:useragent)
|
30
30
|
@headers['Content-type'] = 'application/x-www-form-urlencoded; charset=utf-8'
|
31
31
|
end
|
32
|
-
|
33
|
-
# @private
|
34
|
-
def new_http_request
|
35
|
-
new_http_post_request(path)
|
36
|
-
end
|
37
32
|
end
|
38
33
|
end
|
39
34
|
end
|
@@ -2,14 +2,14 @@
|
|
2
2
|
module Mushikago
|
3
3
|
module Tombo
|
4
4
|
# キャプチャ一覧取得リクエスト
|
5
|
-
class CapturesRequest <
|
6
|
-
def
|
5
|
+
class CapturesRequest < Mushikago::Http::GetRequest
|
6
|
+
def path; '/1/tombo/captures' end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
request_parameter :id
|
9
|
+
request_parameter :limit
|
10
|
+
request_parameter :offset
|
11
|
+
request_parameter :domain
|
12
|
+
request_parameter :tag
|
13
13
|
|
14
14
|
# @param [Hash] options リクエストのオプション
|
15
15
|
# @option options [String] :id 画像のID
|
@@ -2,10 +2,10 @@
|
|
2
2
|
module Mushikago
|
3
3
|
module Tombo
|
4
4
|
# Deleteリクエスト
|
5
|
-
class DeleteRequest <
|
6
|
-
def
|
5
|
+
class DeleteRequest < Mushikago::Http::DeleteRequest
|
6
|
+
def path; '/1/tombo/delete' end
|
7
7
|
|
8
|
-
|
8
|
+
request_parameter :id
|
9
9
|
|
10
10
|
# @param [String] id 画像のID
|
11
11
|
# @param [Hash] options リクエストのオプション
|
@@ -13,11 +13,6 @@ module Mushikago
|
|
13
13
|
super(options)
|
14
14
|
self.id = id
|
15
15
|
end
|
16
|
-
|
17
|
-
# @private
|
18
|
-
def new_http_request
|
19
|
-
new_http_delete_request("#{path}?#{url_encoded_params}")
|
20
|
-
end
|
21
16
|
end
|
22
17
|
end
|
23
18
|
end
|
data/lib/mushikago/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mushikago-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-14 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &5026580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *5026580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mime-types
|
27
|
-
requirement: &
|
27
|
+
requirement: &5025320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *5025320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &5023960 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *5023960
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: maruku
|
49
|
-
requirement: &
|
49
|
+
requirement: &5020940 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *5020940
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: yard
|
60
|
-
requirement: &
|
60
|
+
requirement: &5020020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *5020020
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &5017980 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 2.6.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *5017980
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: ZenTest
|
82
|
-
requirement: &
|
82
|
+
requirement: &5016460 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *5016460
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: bundler
|
93
|
-
requirement: &
|
93
|
+
requirement: &5015400 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *5015400
|
102
102
|
description: A SDK for Mushikago Web Service.
|
103
103
|
email:
|
104
104
|
- t.matsuoka@miningbrownie.co.jp
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- lib/mushikago/hotaru/client.rb
|
115
115
|
- lib/mushikago/auth/signer.rb
|
116
116
|
- lib/mushikago/auth/signature.rb
|
117
|
-
- lib/mushikago/tombo/request.rb
|
118
117
|
- lib/mushikago/tombo/info_request.rb
|
119
118
|
- lib/mushikago/tombo/capture_request.rb
|
120
119
|
- lib/mushikago/tombo/captures_request.rb
|
@@ -125,7 +124,6 @@ files:
|
|
125
124
|
- lib/mushikago/mitsubachi/resource_delete_request.rb
|
126
125
|
- lib/mushikago/mitsubachi/http_fetch_request.rb
|
127
126
|
- lib/mushikago/mitsubachi/resource.rb
|
128
|
-
- lib/mushikago/mitsubachi/multipart_request.rb
|
129
127
|
- lib/mushikago/mitsubachi/script_delete_request.rb
|
130
128
|
- lib/mushikago/mitsubachi/http_push_request.rb
|
131
129
|
- lib/mushikago/mitsubachi/resource_get_request.rb
|
@@ -134,7 +132,6 @@ files:
|
|
134
132
|
- lib/mushikago/mitsubachi/scripts.rb
|
135
133
|
- lib/mushikago/mitsubachi/project_update_request.rb
|
136
134
|
- lib/mushikago/mitsubachi/resources.rb
|
137
|
-
- lib/mushikago/mitsubachi/request.rb
|
138
135
|
- lib/mushikago/mitsubachi/projects.rb
|
139
136
|
- lib/mushikago/mitsubachi/resource_list_request.rb
|
140
137
|
- lib/mushikago/mitsubachi/project.rb
|
@@ -150,8 +147,14 @@ files:
|
|
150
147
|
- lib/mushikago/version.rb
|
151
148
|
- lib/mushikago/auth.rb
|
152
149
|
- lib/mushikago/configuration.rb
|
153
|
-
- lib/mushikago/http/
|
150
|
+
- lib/mushikago/http/multipart.rb
|
154
151
|
- lib/mushikago/http/request.rb
|
152
|
+
- lib/mushikago/http/request/post.rb
|
153
|
+
- lib/mushikago/http/request/multipart_put.rb
|
154
|
+
- lib/mushikago/http/request/put.rb
|
155
|
+
- lib/mushikago/http/request/delete.rb
|
156
|
+
- lib/mushikago/http/request/get.rb
|
157
|
+
- lib/mushikago/http/request/multipart_post.rb
|
155
158
|
- lib/mushikago/http/response.rb
|
156
159
|
- lib/mushikago/http/client.rb
|
157
160
|
- lib/mushikago/http.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
module Mushikago
|
3
|
-
module Mitsubachi
|
4
|
-
# Mitsubachiのリクエストを表す抽象クラス
|
5
|
-
class MultipartRequest < Mushikago::Http::MultipartRequest
|
6
|
-
include Mushikago::Auth::Signature
|
7
|
-
|
8
|
-
# @param [Hash] options オプション
|
9
|
-
# @option options [String] :endpoint('tombo.mushikago.org') Mitsubachiのエンドポイント
|
10
|
-
def initialize options={}
|
11
|
-
super()
|
12
|
-
endpoint = options[:endpoint] || Mushikago.config.endpoint
|
13
|
-
host, port = endpoint.split(':')
|
14
|
-
@host = host
|
15
|
-
@port = port if port
|
16
|
-
@path = "/#{api_version}/mitsubachi/#{method_name}"
|
17
|
-
end
|
18
|
-
|
19
|
-
# @private
|
20
|
-
private
|
21
|
-
def api_version
|
22
|
-
1
|
23
|
-
end
|
24
|
-
|
25
|
-
# @private
|
26
|
-
private
|
27
|
-
def method_name
|
28
|
-
''
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
module Mushikago
|
3
|
-
module Mitsubachi
|
4
|
-
# Mitsubachiのリクエストを表す抽象クラス
|
5
|
-
class Request < Mushikago::Http::Request
|
6
|
-
include Mushikago::Auth::Signature
|
7
|
-
|
8
|
-
# @param [Hash] options オプション
|
9
|
-
# @option options [String] :endpoint('api.mushikago.org') Mitsubachiのエンドポイント
|
10
|
-
def initialize options={}
|
11
|
-
super()
|
12
|
-
endpoint = options[:endpoint] || Mushikago.config.endpoint
|
13
|
-
host, port = endpoint.split(':')
|
14
|
-
@host = host
|
15
|
-
@port = port if port
|
16
|
-
@path = "/#{api_version}/mitsubachi/#{method_name}"
|
17
|
-
end
|
18
|
-
|
19
|
-
# @private
|
20
|
-
private
|
21
|
-
def api_version
|
22
|
-
1
|
23
|
-
end
|
24
|
-
|
25
|
-
# @private
|
26
|
-
private
|
27
|
-
def method_name
|
28
|
-
''
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
module Mushikago
|
3
|
-
module Tombo
|
4
|
-
# Tomboのリクエストを表す抽象クラス
|
5
|
-
class Request < Mushikago::Http::Request
|
6
|
-
include Mushikago::Auth::Signature
|
7
|
-
|
8
|
-
# @param [Hash] options オプション
|
9
|
-
# @option options [String] :endpoint('tombo.mushikago.org') Tomboのエンドポイント
|
10
|
-
def initialize options={}
|
11
|
-
super()
|
12
|
-
endpoint = options[:endpoint] || Mushikago.config.endpoint
|
13
|
-
host, port = endpoint.split(':')
|
14
|
-
@host = host
|
15
|
-
@port = port if port
|
16
|
-
@path = "/#{api_version}/tombo/#{method_name}"
|
17
|
-
end
|
18
|
-
|
19
|
-
# @private
|
20
|
-
private
|
21
|
-
def api_version
|
22
|
-
1
|
23
|
-
end
|
24
|
-
|
25
|
-
# @private
|
26
|
-
private
|
27
|
-
def method_name
|
28
|
-
''
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|