mushikago-sdk 0.3.4 → 0.3.5

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 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.4
8
+ - **Latest Version**: 0.3.5
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
+ - **Jan.27.12**: 0.3.5 release
155
+ - resource_get,script_getに:with_bodyオプション追加
154
156
  - **Jan.27.12**: 0.3.4 release
155
157
  - 数字を含むリクエストの不具合に対応
156
158
  - **Jan.26.12**: 0.3.2 release
@@ -45,6 +45,10 @@ module Mushikago
45
45
  def [] key
46
46
  response[key]
47
47
  end
48
+
49
+ def []= key, value
50
+ response[key] = value
51
+ end
48
52
  end
49
53
  end
50
54
  end
@@ -211,13 +211,22 @@ module Mushikago
211
211
  # @param [String] project_name プロジェクト名
212
212
  # @param [String] script_name デプロイ先のファイル名
213
213
  # @param [Hash] options リクエストのオプション
214
+ # @option options [Boolean] :with_body trueを指定すると、response['body']でファイルの内容にアクセスすることができるようになります。
214
215
  # @example
215
216
  # result = client.script_get('project01', 'sample.rb')
216
217
  # puts result['url']
217
218
  # @return [Mushikago::Http::Response] リクエストの結果
218
219
  def script_get project_name, script_name, options={}
219
220
  request = ScriptGetRequest.new(project_name, script_name, options)
220
- send_request(request)
221
+ result = send_request(request)
222
+ if options[:with_body]
223
+ begin
224
+ uri = URI.parse(result['url'])
225
+ result['body'] = Net::HTTP.get(uri.host, uri.request_uri)
226
+ rescue
227
+ end
228
+ end
229
+ return result
221
230
  end
222
231
 
223
232
  # script/deleteを発行します
@@ -281,13 +290,22 @@ module Mushikago
281
290
  # @param [String] project_name プロジェクト名
282
291
  # @param [String] file_name 保存先のファイル名
283
292
  # @param [Hash] options リクエストのオプション
293
+ # @option options [Boolean] :with_body trueを指定すると、response['body']でファイルの内容にアクセスすることができるようになります。
284
294
  # @example
285
295
  # result = client.resource_get('project01', 'sample.rb')
286
296
  # puts result['url']
287
297
  # @return [Mushikago::Http::Response] リクエストの結果
288
298
  def resource_get project_name, file_name, options={}
289
299
  request = ResourceGetRequest.new(project_name, file_name, options)
290
- send_request(request)
300
+ result = send_request(request)
301
+ if options[:with_body]
302
+ begin
303
+ uri = URI.parse(result['url'])
304
+ result['body'] = Net::HTTP.get(uri.host, uri.request_uri)
305
+ rescue
306
+ end
307
+ end
308
+ return result
291
309
  end
292
310
 
293
311
  # resource/deleteを発行します
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module Mushikago
3
3
  # Mushikago SDK for Ruby のバージョン
4
- VERSION = '0.3.4'
4
+ VERSION = '0.3.5'
5
5
  end
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
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &4100320 !ruby/object:Gem::Requirement
16
+ requirement: &4370000 !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: *4100320
24
+ version_requirements: *4370000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mime-types
27
- requirement: &3957320 !ruby/object:Gem::Requirement
27
+ requirement: &4369100 !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: *3957320
35
+ version_requirements: *4369100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &3956320 !ruby/object:Gem::Requirement
38
+ requirement: &4368120 !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: *3956320
46
+ version_requirements: *4368120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: maruku
49
- requirement: &3955060 !ruby/object:Gem::Requirement
49
+ requirement: &4366940 !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: *3955060
57
+ version_requirements: *4366940
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: yard
60
- requirement: &3952980 !ruby/object:Gem::Requirement
60
+ requirement: &4366100 !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: *3952980
68
+ version_requirements: *4366100
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &3952100 !ruby/object:Gem::Requirement
71
+ requirement: &4332260 !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: *3952100
79
+ version_requirements: *4332260
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: ZenTest
82
- requirement: &3951420 !ruby/object:Gem::Requirement
82
+ requirement: &4313740 !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: *3951420
90
+ version_requirements: *4313740
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: bundler
93
- requirement: &3314080 !ruby/object:Gem::Requirement
93
+ requirement: &4309060 !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: *3314080
101
+ version_requirements: *4309060
102
102
  description: A SDK for Mushikago Web Service.
103
103
  email:
104
104
  - t.matsuoka@miningbrownie.co.jp