qiita-sdk 0.5.0 → 1.0.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.rb +0 -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: 853ebd08ba2c451c79f2185537278a546546de80f43671150396623e4727a8bd
|
4
|
+
data.tar.gz: 10a2a5b62a150b746c2c7d6360ab0d5e3f66a63bbbb368ff2aaa305adf4a1981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7157947d2bcc029467464309accfc5f05108d3d7d7894bc9354a7a5ec48658965bcd9941a74ad90bc44dd4364137f5b015ef488a60360d8b076fb3975b531d76
|
7
|
+
data.tar.gz: 82d14103b644e58f4f93a3f13d8823ad53ee4cbf75d26968f94b5b4a02230d61270e1e78ddb4db2275c898af7ec87031e93b8e966fa3dc1d94cb2fed39baca2f
|
data/Gemfile.lock
CHANGED
data/lib/qiita/sdk.rb
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.present?
|
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.present?
|
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: 0.
|
4
|
+
version: 1.0.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:
|