magellan-cli 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/magellan/cli/base.rb +12 -12
- data/lib/magellan/cli/version.rb +1 -1
- data/spec/magellan/cli/resources/project_spec.rb +5 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d6704f43cf56d986b9ff84182bc449ff4cab94b
|
4
|
+
data.tar.gz: 7288afebe3ad3db21870424d976e52d9467a4bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c84ff3dce8dd50cd767f14ba1cb8bcb503acd0fe81cebbec878a1e0e7fbc51ab5cddb0007915a9248478694bec73997bca4d3337094797ea55329e9f292ca8d
|
7
|
+
data.tar.gz: 954f8c14b5bbf532fab82cc1f02aa1ef89396eaa88d89b25b89c07a759f82d6adbcbfbea667f61fe70d8f182faf51e37d9dd166a5a621075e2d15a9e5f8025a4
|
data/Gemfile.lock
CHANGED
data/lib/magellan/cli/base.rb
CHANGED
@@ -96,9 +96,9 @@ module Magellan
|
|
96
96
|
# @param [String] rel_path http.base_url からの相対パス
|
97
97
|
# @param [Hash] params クエリ文字列
|
98
98
|
# @return [Object] レスポンスのBODYをJSONとしてパースした結果オブジェクト
|
99
|
-
def get_json(rel_path, params = {})
|
99
|
+
def get_json(rel_path, params = {}, &block)
|
100
100
|
http_access do |api|
|
101
|
-
api.get_json(rel_path, params)
|
101
|
+
api.get_json(rel_path, params, &block)
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -106,9 +106,9 @@ module Magellan
|
|
106
106
|
# @param [String] rel_path http.base_url からの相対パス
|
107
107
|
# @param [Hash] params POSTで渡されるパラメータ
|
108
108
|
# @return nil
|
109
|
-
def post(rel_path, params)
|
109
|
+
def post(rel_path, params, &block)
|
110
110
|
http_access do |api|
|
111
|
-
api.post(rel_path, params)
|
111
|
+
api.post(rel_path, params, &block)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -116,9 +116,9 @@ module Magellan
|
|
116
116
|
# @param [String] rel_path http.base_url からの相対パス
|
117
117
|
# @param [Hash] params POSTで渡されるパラメータ
|
118
118
|
# @return nil
|
119
|
-
def post_json(rel_path, params)
|
119
|
+
def post_json(rel_path, params, &block)
|
120
120
|
http_access do |api|
|
121
|
-
api.post_json(rel_path, params)
|
121
|
+
api.post_json(rel_path, params, &block)
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -126,9 +126,9 @@ module Magellan
|
|
126
126
|
# @param [String] rel_path http.base_url からの相対パス
|
127
127
|
# @param [Hash] params PUTで渡されるパラメータ
|
128
128
|
# @return nil
|
129
|
-
def put(rel_path, params)
|
129
|
+
def put(rel_path, params, &block)
|
130
130
|
http_access do |api|
|
131
|
-
api.put(rel_path, params)
|
131
|
+
api.put(rel_path, params, &block)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
@@ -136,18 +136,18 @@ module Magellan
|
|
136
136
|
# @param [String] rel_path http.base_url からの相対パス
|
137
137
|
# @param [Hash] params PUTで渡されるパラメータ
|
138
138
|
# @return nil
|
139
|
-
def put_json(rel_path, params)
|
139
|
+
def put_json(rel_path, params, &block)
|
140
140
|
http_access do |api|
|
141
|
-
api.put_json(rel_path, params)
|
141
|
+
api.put_json(rel_path, params, &block)
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
145
|
# ログインしてDELETEします
|
146
146
|
# @param [String] rel_path http.base_url からの相対パス
|
147
147
|
# @return nil
|
148
|
-
def delete(rel_path)
|
148
|
+
def delete(rel_path, &block)
|
149
149
|
http_access do |api|
|
150
|
-
api.delete(rel_path)
|
150
|
+
api.delete(rel_path, &block)
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
data/lib/magellan/cli/version.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe Magellan::Cli::Resources::Project do
|
5
|
+
before{ FileUtils.cp(File.expand_path("../../../../.magellan-cli.original", __FILE__), ENV["MAGELLAN_CLI_CONFIG_FILE"]) }
|
5
6
|
|
6
7
|
let(:base_url){ "https://localhost:3000" }
|
7
8
|
before{ allow(Magellan::Cli::Http).to receive(:base_url).and_return(base_url) }
|
@@ -18,7 +19,8 @@ describe Magellan::Cli::Resources::Project do
|
|
18
19
|
|
19
20
|
describe :list do
|
20
21
|
it do
|
21
|
-
|
22
|
+
url = "#{base_url}/admin/project.json?%s=%s&%s=%s" % [CGI.escape("f[organization][6][o]"), "is", CGI.escape("f[organization][6][v]"), 1]
|
23
|
+
expect(httpclient).to receive(:get).with(url).and_return(res)
|
22
24
|
expect($stdout).to receive(:puts)
|
23
25
|
cmd.list
|
24
26
|
end
|
@@ -31,7 +33,8 @@ describe Magellan::Cli::Resources::Project do
|
|
31
33
|
buf = StringIO.new
|
32
34
|
$stdout, backup = buf, $stdout
|
33
35
|
begin
|
34
|
-
|
36
|
+
url = "#{base_url}/admin/project.json?%s=%s&%s=%s" % [CGI.escape("f[organization][7][o]"), "is", CGI.escape("f[organization][7][v]"), 1]
|
37
|
+
expect(httpclient).to receive(:get).with(url).and_return(list_res)
|
35
38
|
expect(httpclient).to receive(:get).with(%{#{base_url}/admin/magellan~auth~organization.json?compact=true}).and_return(org_res)
|
36
39
|
cmd.list
|
37
40
|
buf.rewind
|