mushikago-sdk 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -0,0 +1,125 @@
1
+ Mushikago SDK for Ruby.
2
+ =======================
3
+
4
+ - **Homepage**: [http://www.miningbrownie.co.jp/](http://www.miningbrownie.co.jp/)
5
+ - **Author**: Toru Matsuoka
6
+ - **Copyright**: 2011
7
+ - **License**: MIT License
8
+ - **Latest Version**: 0.1.7
9
+ - **Release Date**: September 6th 2011
10
+
11
+
12
+ 概要
13
+ ----
14
+
15
+ [株式会社マイニングブラウニー](http://www.miningbrownie.co.jp/)が提供するMushikago Webサービスを、Rubyから扱うためのライブラリです。
16
+
17
+
18
+ 機能一覧
19
+ --------
20
+
21
+ **1.Tomboを利用する**: [Tombo](http://www.tombo.ne.jp/)は、APIを通してWebサイトのキャプチャ画像を取得するサービスです。
22
+ キャプチャ画像にはタグをつけて管理することができます。
23
+ キャプチャ画像は非同期で取得され、サーバの混雑具合によってリクエストから取得まで最大1時間の時間差があります。
24
+
25
+
26
+
27
+ インストール方法
28
+ ----------------
29
+
30
+ Mushikago SDK for Rubyはgemを使ってインストールします。
31
+
32
+ $ gem install mushikago-sdk
33
+
34
+ (root権限が必要な場合は`sudo`を使ってください。)
35
+
36
+
37
+ 使い方
38
+ ------
39
+
40
+ ### Tomboを利用する
41
+
42
+ 以下のコードで[Tombo](http://www.tombo.ne.jp/)を利用することができます。
43
+
44
+ require 'rubygems'
45
+ require 'mushikago'
46
+
47
+ client = Mushikago::Tombo::Client.new(:api_key => '<APIキー>', :secret_key => '<シークレットキー>')
48
+
49
+ ########
50
+ # Captureメソッド
51
+ ret = client.capture('http://www.tombo.ne.jp/', {:tags => ['service'], :thumbnail => true})
52
+ p ret.meta
53
+ p ret.response
54
+ # => {"message"=>"OK", "status"=>200}
55
+ # => {"image_url"=>"http://img.tombo.ne.jp/tombo-sample/7e11d3fd-7865-4ab9-80fb-b0fc8f362614.jpg", ...
56
+
57
+ ########
58
+ # Capturesメソッド
59
+ ret = client.captures
60
+ p ret.meta
61
+ p ret.response
62
+ # => {"message"=>"OK", "status"=>200}
63
+ # => {"total"=>134, "images"=>[{"image_id"=>"ea7998d3-f8b6-4505-ae22-fc986439c569", "thumbnail_size"=>5120, ....
64
+
65
+ ########
66
+ # deleteメソッド
67
+ ret = client.delete('xxxxxxxx')
68
+ p ret.meta
69
+ p ret.response
70
+ # => {"message"=>"OK", "status"=>200}
71
+ # => {"id"=>"xxxxxxxx"}
72
+
73
+ ########
74
+ # infoメソッド
75
+ ret = client.info
76
+ p ret.meta
77
+ p ret.response
78
+ # => {"message"=>"OK", "status"=>200}
79
+ # => {"disk_usage"=>25372565, "image_num"=>133, "api_count"=>499}
80
+
81
+ #### APIキーとシークレットキーの設定方法
82
+
83
+ APIキーとシークレットキーは以下の方法でも設定することができます。
84
+
85
+ **YAMLファイルを利用する場合**
86
+
87
+ 以下のYAMLファイルを用意します。
88
+
89
+ <pre class="code">
90
+ api_key:&lt;APIキー&gt;
91
+ secret_key:&lt;シークレットキー&gt;
92
+ </pre>
93
+
94
+ 以下のコードでYAMLファイルを読み込んで使用してください。
95
+
96
+ require 'rubygems'
97
+ require 'mushikago'
98
+
99
+ Mushikago.config.load(YAML.load(File.read('config.yml')))
100
+
101
+ client = Mushikago::Tombo::Client.new
102
+
103
+ **環境変数を利用する場合**
104
+
105
+ 環境変数MUSHIKAGO_API_KEYとMUSHIKAGO_SECRET_KEYにそれぞれAPIキーとシークレットキーの設定を行います。
106
+
107
+ <pre class="code">
108
+ $ export MUSHIKAGO_API_KEY=&lt;APIキー&gt;
109
+ $ export MUSHIKAGO_SECRET_KEY=&lt;シークレットキー&gt;
110
+ </pre>
111
+
112
+ require 'rubygems'
113
+ require 'mushikago'
114
+
115
+ client = Mushikago::Tombo::Client.new
116
+
117
+
118
+ 変更履歴
119
+ --------
120
+
121
+ - **Sep.6.11**: 0.1.7 release
122
+ - Mushikago SDK for Ruby新規作成
123
+ - Tombo サポート
124
+
125
+
@@ -0,0 +1,7 @@
1
+ $:.unshift File.expand_path('../lib', __FILE__)
2
+ require 'rubygems'
3
+ require 'bundler'
4
+ Bundler.setup :default, :test, :development
5
+
6
+ ENV['SPEC_OPTS'] = '--colour'
7
+ Autotest.add_discovery { "rspec2" }
@@ -0,0 +1,243 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Mushikago
8
+
9
+ &mdash; Documentation by YARD 0.7.2
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html">Index (M)</a> &raquo;
37
+
38
+
39
+ <span class="title">Mushikago</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Module: Mushikago
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r1 last">Defined in:</dt>
75
+ <dd class="r1 last">lib/mushikago.rb<span class="defines">,<br />
76
+ lib/mushikago/auth.rb,<br /> lib/mushikago/http.rb,<br /> lib/mushikago/tombo.rb,<br /> lib/mushikago/version.rb,<br /> lib/mushikago/auth/signer.rb,<br /> lib/mushikago/http/client.rb,<br /> lib/mushikago/tombo/client.rb,<br /> lib/mushikago/http/request.rb,<br /> lib/mushikago/http/response.rb,<br /> lib/mushikago/tombo/request.rb,<br /> lib/mushikago/configuration.rb,<br /> lib/mushikago/auth/signature.rb,<br /> lib/mushikago/tombo/info_request.rb,<br /> lib/mushikago/tombo/delete_request.rb,<br /> lib/mushikago/tombo/capture_request.rb,<br /> lib/mushikago/tombo/captures_request.rb</span>
77
+ </dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+ <h2>Overview</h2><div class="docstring">
83
+ <div class="discussion">
84
+
85
+ <p>Mushikagoサービスを提供するモジュール</p>
86
+
87
+
88
+ </div>
89
+ </div>
90
+ <div class="tags">
91
+
92
+ </div><h2>Defined Under Namespace</h2>
93
+ <p class="children">
94
+
95
+
96
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Mushikago/Auth.html" title="Mushikago::Auth (module)">Auth</a></span>, <span class='object_link'><a href="Mushikago/Http.html" title="Mushikago::Http (module)">Http</a></span>, <span class='object_link'><a href="Mushikago/Tombo.html" title="Mushikago::Tombo (module)">Tombo</a></span>
97
+
98
+
99
+
100
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Mushikago/Config.html" title="Mushikago::Config (class)">Config</a></span>
101
+
102
+
103
+ </p>
104
+
105
+ <h2>Constant Summary</h2>
106
+
107
+ <dl class="constants">
108
+
109
+ <dt id="VERSION-constant" class="">VERSION =
110
+ <div class="docstring">
111
+ <div class="discussion">
112
+
113
+ <p>Mushikago SDK for Ruby のバージョン</p>
114
+
115
+
116
+ </div>
117
+ </div>
118
+ <div class="tags">
119
+
120
+ </div>
121
+ </dt>
122
+ <dd><pre class="code"><span class='string val'>'0.1.7'</span>
123
+ </pre></dd>
124
+
125
+ </dl>
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ <h2>
134
+ Class Method Summary
135
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
136
+ </h2>
137
+
138
+ <ul class="summary">
139
+
140
+ <li class="public ">
141
+ <span class="summary_signature">
142
+
143
+ <a href="#config-class_method" title="config (class method)">+ (Mushikago::Config) <strong>config</strong> </a>
144
+
145
+
146
+
147
+ </span>
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <span class="summary_desc"><div class='inline'>
157
+ <p>Config
158
+ コンフィグのインスタンスへのアクセスを提供する.</p>
159
+ </div></span>
160
+
161
+ </li>
162
+
163
+
164
+ </ul>
165
+
166
+
167
+
168
+
169
+ <div id="class_method_details" class="method_details_list">
170
+ <h2>Class Method Details</h2>
171
+
172
+
173
+ <div class="method_details first">
174
+ <p class="signature first" id="config-class_method">
175
+
176
+ + (<tt><span class='object_link'><a href="Mushikago/Config.html" title="Mushikago::Config (class)">Mushikago::Config</a></span></tt>) <strong>config</strong>
177
+
178
+
179
+
180
+ </p><div class="docstring">
181
+ <div class="discussion">
182
+
183
+ <p>Config
184
+ コンフィグのインスタンスへのアクセスを提供する</p>
185
+
186
+
187
+ </div>
188
+ </div>
189
+ <div class="tags">
190
+ <h3>Returns:</h3>
191
+ <ul class="return">
192
+
193
+ <li>
194
+
195
+
196
+ <span class='type'>(<tt><span class='object_link'><a href="Mushikago/Config.html" title="Mushikago::Config (class)">Mushikago::Config</a></span></tt>)</span>
197
+
198
+
199
+
200
+ &mdash;
201
+ <div class='inline'>
202
+ <p>config
203
+ コンフィグのインスタンスへのアクセスを提供する</p>
204
+ </div>
205
+
206
+ </li>
207
+
208
+ </ul>
209
+
210
+ </div><table class="source_code">
211
+ <tr>
212
+ <td>
213
+ <pre class="lines">
214
+
215
+
216
+ 12
217
+ 13
218
+ 14</pre>
219
+ </td>
220
+ <td>
221
+ <pre class="code"><span class="info file"># File 'lib/mushikago.rb', line 12</span>
222
+
223
+ <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='config identifier id'>config</span>
224
+ <span class='Config constant id'>Config</span><span class='dot token'>.</span><span class='instance identifier id'>instance</span>
225
+ <span class='end end kw'>end</span>
226
+ </pre>
227
+ </td>
228
+ </tr>
229
+ </table>
230
+ </div>
231
+
232
+ </div>
233
+
234
+ </div>
235
+
236
+ <div id="footer">
237
+ Generated on Tue Sep 6 18:23:00 2011 by
238
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
239
+ 0.7.2 (ruby-1.8.7).
240
+ </div>
241
+
242
+ </body>
243
+ </html>
@@ -0,0 +1,120 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Mushikago::Auth
8
+
9
+ &mdash; Documentation by YARD 0.7.2
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../_index.html">Index (A)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../Mushikago.html" title="Mushikago (module)">Mushikago</a></span></span>
38
+ &raquo;
39
+ <span class="title">Auth</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Module: Mushikago::Auth
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r1 last">Defined in:</dt>
75
+ <dd class="r1 last">lib/mushikago/auth.rb<span class="defines">,<br />
76
+ lib/mushikago/auth/signer.rb,<br /> lib/mushikago/auth/signature.rb</span>
77
+ </dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+ <h2>Overview</h2><div class="docstring">
83
+ <div class="discussion">
84
+
85
+ <p>Mushikagoサービスの認証を扱うモジュール</p>
86
+
87
+
88
+ </div>
89
+ </div>
90
+ <div class="tags">
91
+
92
+ </div><h2>Defined Under Namespace</h2>
93
+ <p class="children">
94
+
95
+
96
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Auth/Signature.html" title="Mushikago::Auth::Signature (module)">Signature</a></span>
97
+
98
+
99
+
100
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Auth/Signer.html" title="Mushikago::Auth::Signer (class)">Signer</a></span>
101
+
102
+
103
+ </p>
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ </div>
112
+
113
+ <div id="footer">
114
+ Generated on Tue Sep 6 18:22:59 2011 by
115
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
116
+ 0.7.2 (ruby-1.8.7).
117
+ </div>
118
+
119
+ </body>
120
+ </html>