qiita-sdk 0.1.0 → 0.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef3399319b6663a45463b626c00587b01e17a82d6dcc659cda6e20ab88b09a86
4
- data.tar.gz: 102404f6146bdc3e1da5d34aa9888d8a6f1be4eec348c63a56528d0ecb74ec6c
3
+ metadata.gz: 780338808d3cf7b8d12073b34dcf52eb5636db8fca64ab564a38b7ec6eb3ebce
4
+ data.tar.gz: 8171b3502aed7e42ee1201bfcffe9be28325ac8fc64c04f3cae711c1a201037d
5
5
  SHA512:
6
- metadata.gz: 637a211f86a0afa7148f5c9411dd088c6bfd425c9495a66310f683959bf1870ee2c8a4cb5d8b07967a1ba982d990210f1ac5430700b3839b259c1dd06acd33f6
7
- data.tar.gz: b4cccf3edaa50a4e6794d027776ff963da8d63a4e45c7f54e44f10f8e98f6489bd1f1e4a341c486e141bbb90019b81d461d65737b2a52a444f4db7079f92021a
6
+ metadata.gz: cc2238a489e205915fa38a2953e4e39db89d295a06fcb3b0404215c173ef79692dfa15504b597c227071d185bfaccab1486cc8b3ffc69ded1c50707018829748
7
+ data.tar.gz: b4d114f19fb603199f1994ae24e50fb89cb14bf37cda71ee37022afeb1558b518c1b772381ecad569ab711134fc9ded6aacfc88529586cdf6ce4a214ded05dbe
@@ -0,0 +1,14 @@
1
+ Style/AsciiComments:
2
+ Enabled: false
3
+
4
+ Style/FrozenStringLiteralComment:
5
+ Enabled: false
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ Metrics/BlockLength:
11
+ Enabled: false
12
+
13
+ Metrics/ModuleLength:
14
+ Enabled: false
data/Gemfile CHANGED
@@ -1,7 +1,10 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in qiita-sdk.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
6
+ gem 'rake', '~> 12.0'
7
+ gem 'rspec', '~> 3.0'
8
+ gem 'rubocop'
9
+ gem 'webmock'
10
+ gem 'pry-byebug'
@@ -1,13 +1,35 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qiita-sdk (0.1.0)
4
+ qiita-sdk (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ addressable (2.7.0)
10
+ public_suffix (>= 2.0.2, < 5.0)
11
+ ast (2.4.1)
12
+ byebug (11.1.3)
13
+ coderay (1.1.3)
14
+ crack (0.4.3)
15
+ safe_yaml (~> 1.0.0)
9
16
  diff-lcs (1.4.4)
17
+ hashdiff (1.0.1)
18
+ method_source (1.0.0)
19
+ parallel (1.19.2)
20
+ parser (2.7.1.4)
21
+ ast (~> 2.4.1)
22
+ pry (0.13.1)
23
+ coderay (~> 1.1)
24
+ method_source (~> 1.0)
25
+ pry-byebug (3.9.0)
26
+ byebug (~> 11.0)
27
+ pry (~> 0.13.0)
28
+ public_suffix (4.0.5)
29
+ rainbow (3.0.0)
10
30
  rake (12.3.3)
31
+ regexp_parser (1.7.1)
32
+ rexml (3.2.4)
11
33
  rspec (3.9.0)
12
34
  rspec-core (~> 3.9.0)
13
35
  rspec-expectations (~> 3.9.0)
@@ -21,14 +43,35 @@ GEM
21
43
  diff-lcs (>= 1.2.0, < 2.0)
22
44
  rspec-support (~> 3.9.0)
23
45
  rspec-support (3.9.3)
46
+ rubocop (0.89.1)
47
+ parallel (~> 1.10)
48
+ parser (>= 2.7.1.1)
49
+ rainbow (>= 2.2.2, < 4.0)
50
+ regexp_parser (>= 1.7)
51
+ rexml
52
+ rubocop-ast (>= 0.3.0, < 1.0)
53
+ ruby-progressbar (~> 1.7)
54
+ unicode-display_width (>= 1.4.0, < 2.0)
55
+ rubocop-ast (0.3.0)
56
+ parser (>= 2.7.1.4)
57
+ ruby-progressbar (1.10.1)
58
+ safe_yaml (1.0.5)
59
+ unicode-display_width (1.7.0)
60
+ webmock (3.8.3)
61
+ addressable (>= 2.3.6)
62
+ crack (>= 0.3.2)
63
+ hashdiff (>= 0.4.0, < 2.0.0)
24
64
 
25
65
  PLATFORMS
26
66
  ruby
27
67
 
28
68
  DEPENDENCIES
69
+ pry-byebug
29
70
  qiita-sdk!
30
71
  rake (~> 12.0)
31
72
  rspec (~> 3.0)
73
+ rubocop
74
+ webmock
32
75
 
33
76
  BUNDLED WITH
34
77
  2.1.4
data/README.md CHANGED
@@ -1,13 +1,9 @@
1
1
  # Qiita::Sdk
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/qiita/sdk`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ [Qiita Api](https://qiita.com/api/v2/docs) Api クライアント
6
4
 
7
5
  ## Installation
8
6
 
9
- Add this line to your application's Gemfile:
10
-
11
7
  ```ruby
12
8
  gem 'qiita-sdk'
13
9
  ```
@@ -22,18 +18,451 @@ Or install it yourself as:
22
18
 
23
19
  ## Usage
24
20
 
25
- TODO: Write usage instructions here
21
+ ### インスタンスの作成
22
+
23
+ ```ruby
24
+ client = Qiita::Sdk::Client.new
25
+ ```
26
+ <br />
27
+ <br />
28
+
29
+ 認証が必要なアクションを行う場合
30
+
31
+ ```ruby
32
+ client = Qiita::Sdk::Client.new do |config|
33
+ config.access_token = 'XXXX'
34
+ end
35
+ ```
36
+ <br />
37
+ <br />
38
+
39
+ ### メソッド一覧
40
+
41
+ 全て戻り値は [Net::HTTPResponse] を返す
42
+
43
+
44
+ - 記事につけられた「LGTM!」一覧を取得
45
+
46
+ ```ruby
47
+ item_id = 'XXXX'
48
+ res = client.fetch_item_likes(item_id: item_id)
49
+ ```
50
+ <br />
51
+ <br />
52
+
53
+
54
+ - コメントを削除
55
+
56
+ ```ruby
57
+ comment_id = 'XXXX'
58
+ client.delete_comment(comment_id: comment_id)
59
+ ```
60
+ <br />
61
+ <br />
62
+
63
+
64
+
65
+ - コメントを取得
66
+
67
+ ```ruby
68
+ comment_id = 'XXXX'
69
+ res = client.fetch_comment(comment_id: comment_id)
70
+ ```
71
+ <br />
72
+ <br />
73
+
74
+
75
+ - コメントを更新
76
+
77
+ ```ruby
78
+ comment_id = 'XXXX'
79
+ body = 'update body'
80
+ client.update_comment(comment_id: comment_id, body: body)
81
+ ```
82
+ <br />
83
+ <br />
84
+
85
+
86
+
87
+ - 投稿に紐づけられた投稿一覧
88
+
89
+ ```ruby
90
+ item_id = 'XXXX'
91
+ res = client.fetch_item_comments(item_id: item_id)
92
+ ```
93
+ <br />
94
+ <br />
95
+
96
+
97
+
98
+ - 記事に対してコメントを投稿
99
+
100
+ ```ruby
101
+ item_id = 'XXXX'
102
+ body = 'comment body'
103
+ client.post_comment(item_id: item_id, body: body)
104
+ ```
105
+ <br />
106
+ <br />
107
+
108
+
109
+
110
+ - タグを取得
111
+
112
+ ```ruby
113
+ tag_id = 'XXXX'
114
+ res = client.fetch_tag(tag_id: tag_id)
115
+ ```
116
+ <br />
117
+ <br />
118
+
119
+
120
+
121
+ - ユーザがフォローしているタグ一覧
122
+
123
+ ```ruby
124
+ user_id = 'XXXX'
125
+ res = client.fetch_following_tags(user_id: user_id)
126
+ ```
127
+ <br />
128
+ <br />
129
+
130
+
131
+
132
+ - タグのフォローを外す
133
+
134
+ ```ruby
135
+ tag_id = 'XXXX'
136
+ client.delete_tag_following(tag_id: tag_id)
137
+ ```
138
+ <br />
139
+ <br />
140
+
141
+
142
+
143
+ - タグをフォローしているかどうかを調る
144
+
145
+ ```ruby
146
+ tag_id = 'XXXX'
147
+ res = client.check_tag_following(tag_id: tag_id)
148
+ ```
149
+ <br />
150
+ <br />
151
+
152
+
153
+
154
+ - タグをフォロー
155
+
156
+ ```ruby
157
+ tag_id = 'XXXX'
158
+ client.follow_tag(tag_id: tag_id)
159
+ ```
160
+ <br />
161
+ <br />
162
+
163
+
164
+
165
+ - 記事をストックしているユーザ一覧を、ストックした日時の降順で返す
166
+
167
+ ```ruby
168
+ item_id = 'XXXX'
169
+ res = client.fetch_item_stockers(item_id: item_id)
170
+ ```
171
+ <br />
172
+ <br />
173
+
174
+
175
+
176
+ - 全てのユーザの一覧を作成日時の降順で取得
177
+
178
+ ```ruby
179
+ res = client.fetch_users
180
+ ```
181
+ <br />
182
+ <br />
183
+
184
+
185
+
186
+ - ユーザを取得
187
+
188
+ ```ruby
189
+ user_id = 'XXXX'
190
+ res = client.fetch_user(user_id: user_id)
191
+ ```
192
+ <br />
193
+ <br />
194
+
195
+
196
+
197
+ - ユーザがフォローしているユーザ一覧を取得
198
+
199
+ ```ruby
200
+ user_id = 'XXXX'
201
+ res = client.fetch_followees(user_id: user_id)
202
+ ```
203
+ <br />
204
+ <br />
205
+
206
+
207
+
208
+ - ユーザをフォローしているユーザ一覧を取得
209
+
210
+ ```ruby
211
+ user_id = 'XXXX'
212
+ res = client.fetch_followers(user_id: user_id)
213
+ ```
214
+ <br />
215
+ <br />
216
+
217
+
218
+
219
+ - ユーザへのフォローを外します。
220
+
221
+ ```ruby
222
+ user_id = 'XXXX'
223
+ client.delete_following(user_id: user_id)
224
+ ```
225
+ <br />
226
+ <br />
227
+
228
+
26
229
 
27
- ## Development
230
+ - ユーザをフォローしている場合に204を返す
231
+
232
+ ```ruby
233
+ user_id = 'XXXX'
234
+ res = client.check_following(user_id: user_id)
235
+ ```
236
+ <br />
237
+ <br />
238
+
239
+
240
+
241
+ - ユーザをフォロー
242
+
243
+ ```ruby
244
+ user_id = 'XXXX'
245
+ client.follow_user(user_id: user_id)
246
+ ```
247
+ <br />
248
+ <br />
249
+
250
+
251
+
252
+ - 認証中のユーザの記事の一覧を作成日時の降順で返す
253
+
254
+ ```ruby
255
+ res = client.fetch_my_items
256
+ ```
257
+ <br />
258
+ <br />
259
+
260
+
261
+
262
+ - 記事の一覧を作成日時の降順で返す
263
+
264
+ ```ruby
265
+ res = client.fetch_items
266
+ ```
267
+ <br />
268
+ <br />
269
+
270
+
271
+
272
+ - 新たに記事を作成
273
+
274
+ title, bodyは必須
275
+
276
+ デフォルト値
277
+ tweet = false
278
+ tags = []
279
+ restricted = false
280
+
281
+ ```ruby
282
+ title = 'title'
283
+ body = 'body'
284
+ tweet = true
285
+ tags = ['ruby', 'rails']
286
+ restricted = false
287
+
288
+ client.post_item(title: title, body: body, tweet: tweet, tags: tags, restricted: restricted)
289
+ ```
290
+ <br />
291
+ <br />
292
+
293
+
294
+ - 記事を削除
295
+
296
+ ```ruby
297
+ item_id = 'XXXX'
298
+ client.delete_item(item_id: item_id)
299
+ ```
300
+ <br />
301
+ <br />
302
+
303
+
304
+ - 記事を取得
305
+
306
+ ```ruby
307
+ item_id = 'XXXX'
308
+ res = client.fetch_item(item_id: item_id)
309
+ ```
310
+ <br />
311
+ <br />
312
+
313
+
314
+ - 記事を更新
315
+
316
+ ```ruby
317
+ item_id = 'XXXX'
318
+ title = 'update title'
319
+ body = 'update body'
320
+ restricted = false
321
+ tags = ['rails']
322
+
323
+ client.update_item(item_id: item_id, title: title, body: body, restricted: restricted, tags: tags)
324
+ ```
325
+ <br />
326
+ <br />
327
+
328
+
329
+ - 記事をストック
330
+
331
+ ```ruby
332
+ item_id = 'XXXX'
333
+ client.stock_item(item_id: item_id)
334
+ ```
335
+ <br />
336
+ <br />
337
+
338
+
339
+ - 記事をストックから取り除く
340
+
341
+ ```ruby
342
+ item_id = 'XXXX'
343
+ client.delete_stock(item_id: item_id)
344
+ ```
345
+ <br />
346
+ <br />
28
347
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
348
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
349
+ - 記事をストックしているかどうか調べる
350
+
351
+ ```ruby
352
+ item_id = 'XXXX'
353
+ res = client.check_item_stock(item_id: item_id)
354
+ ```
355
+ <br />
356
+ <br />
357
+
358
+
359
+ - タグの記事一覧
360
+
361
+ ```ruby
362
+ tag_id = 'XXXX'
363
+ res = client.fetch_tag_items(teg_id: tag_id)
364
+ ```
365
+ <br />
366
+ <br />
367
+
368
+
369
+ - 指定されたユーザの記事一覧
370
+
371
+ ```ruby
372
+ user_id = 'XXXX'
373
+ res = client.fetch_user_items(user_id: user_id)
374
+ ```
375
+ <br />
376
+ <br />
377
+
378
+
379
+ - 指定されたユーザがストックした記事一覧
380
+
381
+ ```ruby
382
+ user_id = 'XXXX'
383
+ res = client.fetch_user_stocks(user_id: user_id)
384
+ ```
385
+ <br />
386
+ <br />
387
+
388
+
389
+ - コメントに絵文字リアクションを付ける
390
+
391
+ ```ruby
392
+ comment_id = 'XXXX'
393
+ name = 'XXXX'
394
+
395
+ client.attach_reaction_to_comment(comment_id: comment_id, name: name)
396
+ ```
397
+ <br />
398
+ <br />
399
+
400
+
401
+ - 記事に絵文字リアクションを付ける
402
+
403
+ ```ruby
404
+ item_id = 'XXXX'
405
+ name = 'XXXX'
406
+
407
+ client.attach_reaction_to_item(item_id: item_id, name: name)
408
+ ```
409
+ <br />
410
+ <br />
411
+
412
+
413
+ - コメントから絵文字リアクションを削除
414
+
415
+ ```ruby
416
+ comment_id = 'XXXX'
417
+ reaction_name = 'XXXX'
418
+
419
+ client.delete_comment_reaction(comment_id: comment_id, reaction_name: reaction_name)
420
+ ```
421
+ <br />
422
+ <br />
423
+
424
+
425
+ - 記事から絵文字リアクションを削除
426
+
427
+ ```ruby
428
+ item_id = 'XXXX'
429
+ reaction_name = 'XXXX'
430
+
431
+ client.delete_item_reaction(item_id: item_id, reaction_name: reaction_name)
432
+ ```
433
+ <br />
434
+ <br />
32
435
 
33
- ## Contributing
34
436
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/qiita-sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/qiita-sdk/blob/master/CODE_OF_CONDUCT.md).
437
+ - コメントに付けられた絵文字リアクション一覧
36
438
 
439
+ ```ruby
440
+ comment_id = 'XXXX'
441
+
442
+ res = client.fetch_comment_reactions(comment_id: comment_id)
443
+ ```
444
+ <br />
445
+ <br />
446
+
447
+
448
+ - 記事に付けられた絵文字リアクション一覧
449
+
450
+ ```ruby
451
+ item_id = 'XXXX'
452
+
453
+ res = client.fetch_item_reactions(item_id: item_id)
454
+ ```
455
+ <br />
456
+ <br />
457
+
458
+
459
+ - アクセストークンに紐付いたユーザを返す
460
+
461
+ ```ruby
462
+ res = client.fetch_authenticated_user
463
+ ```
464
+ <br />
465
+ <br />
37
466
 
38
467
  ## License
39
468