qiita-sdk 0.6.0 → 1.1.0
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/qiita/sdk/api_actions.rb +11 -6
- data/lib/qiita/sdk/client.rb +4 -4
- data/lib/qiita/sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 311e36c1a5a0355fa1e0bda4a180bce0e2e50c752d22b50f84b95ec05ff467df
|
4
|
+
data.tar.gz: b90bef94e1d7adb2e924f094416002d6658105ff21ddf7a9a1a4a3be3f4577af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11227f48d4e195cc3d1ec554ebb6b47a05562eefc85c302e323119361e28c6b7c1a26edaf149122108a4e74c8ded987b5549c7d1044be5fb2cbb7d562e6ddf53
|
7
|
+
data.tar.gz: 595910ea815db143e96003cd4433e160fbc083eb5e55a933a51f7a952a2d855a2007980fd731de28a0ca84c7157b803fd42285e927487e2bf23da747a4faa9a0
|
data/Gemfile.lock
CHANGED
@@ -167,17 +167,20 @@ module Qiita
|
|
167
167
|
end
|
168
168
|
|
169
169
|
# 新たに記事を作成
|
170
|
-
def post_item(title:, body:,
|
170
|
+
def post_item(title:, body:, tags: [], tweet: false, restricted: false)
|
171
171
|
path = '/api/v2/items'
|
172
172
|
|
173
173
|
params = {
|
174
174
|
title: title,
|
175
175
|
body: body,
|
176
176
|
tweet: tweet,
|
177
|
-
|
178
|
-
private: restricted
|
177
|
+
private: restricted,
|
179
178
|
}
|
180
179
|
|
180
|
+
tag_params = tags.map { |tag| { name: tag } }
|
181
|
+
|
182
|
+
params.merge!({tags: tag_params}) if !tags.empty?
|
183
|
+
|
181
184
|
post(path, params)
|
182
185
|
end
|
183
186
|
|
@@ -196,16 +199,18 @@ module Qiita
|
|
196
199
|
end
|
197
200
|
|
198
201
|
# 記事を更新
|
199
|
-
def update_item(item_id:, title: nil, body: nil, restricted:
|
202
|
+
def update_item(item_id:, title: nil, body: nil, restricted: false, tags: [])
|
200
203
|
path = "/api/v2/items/#{item_id}"
|
201
204
|
params = {
|
202
|
-
item_id: item_id,
|
203
205
|
title: title,
|
204
206
|
body: body,
|
205
207
|
private: restricted,
|
206
|
-
tags: tags
|
207
208
|
}
|
208
209
|
|
210
|
+
tag_params = tags.map { |tag| { name: tag } }
|
211
|
+
|
212
|
+
params.merge!({tags: tag_params}) if !tags.empty?
|
213
|
+
|
209
214
|
patch(path, params)
|
210
215
|
end
|
211
216
|
|
data/lib/qiita/sdk/client.rb
CHANGED
@@ -32,25 +32,25 @@ module Qiita
|
|
32
32
|
headers
|
33
33
|
end
|
34
34
|
|
35
|
-
def get(path, params)
|
35
|
+
def get(path, params = {})
|
36
36
|
url = endpoint + path
|
37
37
|
httpclient = HTTPClient.new
|
38
38
|
httpclient.get(url, params, headers)
|
39
39
|
end
|
40
40
|
|
41
|
-
def patch(path, params)
|
41
|
+
def patch(path, params = {})
|
42
42
|
url = endpoint + path
|
43
43
|
httpclient = HTTPClient.new
|
44
44
|
httpclient.patch(url, params.to_json, headers)
|
45
45
|
end
|
46
46
|
|
47
|
-
def put(path, params)
|
47
|
+
def put(path, params = {})
|
48
48
|
url = endpoint + path
|
49
49
|
httpclient = HTTPClient.new
|
50
50
|
httpclient.put(url, params)
|
51
51
|
end
|
52
52
|
|
53
|
-
def post(path, params)
|
53
|
+
def post(path, params = {})
|
54
54
|
url = endpoint + path
|
55
55
|
httpclient = HTTPClient.new
|
56
56
|
httpclient.post(url, params.to_json, headers)
|
data/lib/qiita/sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qiita-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sibakeny
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: qiita sdk for ruby
|
14
14
|
email:
|