qiita 1.3.2 → 1.3.3

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
  SHA1:
3
- metadata.gz: ff54dab5582ad203e37a3941ca047a93562cda6b
4
- data.tar.gz: c86302b6d2f9d01ef2963b5f791218a8c2d4e453
3
+ metadata.gz: 77ad705b845e426474f821cfa0ea698d1a936d1b
4
+ data.tar.gz: d85dc4d9927f8d642fc8bf95cdcd1c0f24371df8
5
5
  SHA512:
6
- metadata.gz: fa97be1ed70a2b5f6fa48e6bcb10d898065ed9d16d9249322b8f29b9c7d412f7a5dc94db798eac802b7fa81e6ebb2c9744a7b9b3fa81d70e3abf0adacf0d7b43
7
- data.tar.gz: 6d7cc4a106549fc92cb5e64b0e3773fe66c27ae652013d01b208d917e0a63090e613b939c36bb778640a280b8dd651d7747cbf4304df7151ba893e8e0ba35930
6
+ metadata.gz: 0f47b689c3d96475f5e6b100318da9c0a4bd352de3389ae80e7fc417c0ab7467307c741f6330dfe15238ac4a0cf33bbc184b9ec52399ecee491c21ec754860c4
7
+ data.tar.gz: a022b4966b4c098b7e0b211eacda3a93fee66f6ffae217a5b8e871b27223a4d5e86bfbc28fdf58dac823941223ca55e9c365e8e5ea711bb3ffc33b34b0c902af
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
3
+ - 2.3.1
@@ -1,44 +1,66 @@
1
- ## 1.3.2
2
- - Fix broken client methods (thx @kmrshntr)
1
+ ## v1.3.3
3
2
 
4
- ## 1.3.1
5
- - Fix client methods that have templated path (#12, thx @mzp)
3
+ - Add `#get_item_like` method
4
+ - Add `#list_item_likes` method
5
+ - Change method name from `#patch_project` to `#update_project`
6
+ - Fix broken `#delete_item`
7
+
8
+ ## v1.3.2
9
+
10
+ - Fix broken client methods
11
+
12
+ ## v1.3.1
13
+
14
+ - Fix client methods that have templated path
15
+
16
+ ## v1.3.0
6
17
 
7
- ## 1.3.0
8
18
  - Update methods and their descriptions
9
19
 
10
- ## 1.2.0
20
+ ## v1.2.0
21
+
11
22
  - Update method names and docs about likes API
12
23
 
13
- ## 1.1.2
24
+ ## v1.1.2
25
+
14
26
  - Slop v4 is not supported for now
15
27
 
16
- ## 1.1.1
28
+ ## v1.1.1
29
+
17
30
  - Support --host with --team option
18
31
 
19
- ## 1.1.0
32
+ ## v1.1.0
33
+
20
34
  - Add --no-ssl-verification option
21
35
 
22
- ## 1.0.7
36
+ ## v1.0.7
37
+
23
38
  - Add list_authenticated_user_items method
24
39
 
25
- ## 1.0.6
40
+ ## v1.0.6
41
+
26
42
  - Add create_tagging and delete_tagging methods
27
43
 
28
- ## 1.0.5
44
+ ## v1.0.5
45
+
29
46
  - Add client methods about following, LGTM, and stock
30
47
 
31
- ## 1.0.4
48
+ ## v1.0.4
49
+
32
50
  - Add list_teams method
33
51
 
34
- ## 1.0.3
52
+ ## v1.0.3
53
+
35
54
  - Escape request URL path
36
55
 
37
- ## 1.0.2
56
+ ## v1.0.2
57
+
38
58
  - Add a new API: list_item_stockers(item_id)
39
59
 
40
- ## 1.0.1
60
+ ## v1.0.1
61
+
41
62
  - Fix response body existence check logic
42
63
 
43
- ## 1.0.0
64
+ ## v1.0.0
65
+
44
66
  - Support Qiita API v2
data/README.md CHANGED
@@ -1,17 +1,21 @@
1
- # Qiita [![Build Status](https://travis-ci.org/increments/qiita-rb.svg?branch=master)](https://travis-ci.org/increments/qiita-rb)
1
+ # Qiita
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/qiita.svg)](https://rubygems.org/gems/qiita)
4
+ [![Build Status](https://travis-ci.org/increments/qiita-rb.svg?branch=master)](https://travis-ci.org/increments/qiita-rb)
5
+
2
6
  Qiita API v2 client library and CLI tool, written in Ruby.
3
7
 
4
8
  ### Install
9
+
5
10
  Note: requires Ruby 2.0.0 or higher.
6
11
 
7
- ```sh
12
+ ```bash
8
13
  gem install qiita
9
14
  ```
10
15
 
11
16
  ## Library
12
- See [/doc](/doc) for more details.
13
17
 
14
- ```rb
18
+ ```ruby
15
19
  require "qiita"
16
20
 
17
21
  client = Qiita::Client.new(access_token: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcd")
@@ -25,6 +29,7 @@ client.get_user("r7kamura").body
25
29
  ```
26
30
 
27
31
  ## CLI
32
+
28
33
  `qiita` executable calls `Qiita::Client`'s methods.
29
34
 
30
35
  ```
@@ -53,12 +58,15 @@ $ qiita list_user_items r7kamura
53
58
  ```
54
59
 
55
60
  ### Method and Arguments
56
- Pass [Qiita::Client's method name](doc/client.md) and required arguments.
61
+
62
+ Pass `Qiita::Client` method name and required arguments.
57
63
 
58
64
  ### Access token
65
+
59
66
  Accepts access token via `-a, --access-token` or `QIITA_ACCESS_TOKEN` environment variable.
60
67
 
61
68
  ### Headers
69
+
62
70
  To set custom request headers, use `Key:value` syntax.
63
71
 
64
72
  ```
@@ -66,6 +74,7 @@ $ qiita list_items "Authorization:Bearer 1234567890abcdef1234567890abcdef1234567
66
74
  ```
67
75
 
68
76
  ### Params
77
+
69
78
  Params are used for query string in GET method, or for request body in other methods.
70
79
  You can set params by `key=value` or `key:=value` syntax.
71
80
  `key=value` is parsed into String value,
@@ -33,7 +33,7 @@ module Qiita
33
33
  end
34
34
 
35
35
  def method_name
36
- ARGV[0]
36
+ @argv[0]
37
37
  end
38
38
 
39
39
  def params
@@ -106,7 +106,7 @@ module Qiita
106
106
  params = {}
107
107
  headers = {}
108
108
  arguments = []
109
- ARGV[1..-1].each do |section|
109
+ @argv[1..-1].each do |section|
110
110
  case
111
111
  when /(?<key>.+):(?<value>[^=]+)/ =~ section
112
112
  headers[key] = value
@@ -102,7 +102,7 @@ module Qiita
102
102
  # Delete an item.
103
103
  #
104
104
  def delete_item(item_id, params = nil, headers = nil)
105
- get("/api/v2/items/#{item_id}", params, headers)
105
+ delete("/api/v2/items/#{item_id}", params, headers)
106
106
  end
107
107
 
108
108
  # ### Qiita::Client#get_item(item_id, params = nil, headers = nil)
@@ -133,6 +133,13 @@ module Qiita
133
133
  put("/api/v2/items/#{item_id}/like", params, headers)
134
134
  end
135
135
 
136
+ # ### Qiita::Client#stock_item(item_id, params = nil, headers = nil)
137
+ # Stock an item.
138
+ #
139
+ def stock_item(item_id, params = nil, headers = nil)
140
+ put("/api/v2/items/#{item_id}/stock", params, headers)
141
+ end
142
+
136
143
  # ### Qiita::Client#unstock_item(item_id, params = nil, headers = nil)
137
144
  # Unstock an item.
138
145
  #
@@ -147,11 +154,11 @@ module Qiita
147
154
  get("/api/v2/items/#{item_id}/stock", params, headers)
148
155
  end
149
156
 
150
- # ### Qiita::Client#stock_item(item_id, params = nil, headers = nil)
151
- # Stock an item.
157
+ # ### Qiita::Client#get_item_like(item_id, params = nil, headers = nil)
158
+ # Check if you liked an item.
152
159
  #
153
- def stock_item(item_id, params = nil, headers = nil)
154
- put("/api/v2/items/#{item_id}/stock", params, headers)
160
+ def get_item_like(item_id, params = nil, headers = nil)
161
+ get("/api/v2/items/#{item_id}/like", params, headers)
155
162
  end
156
163
 
157
164
  # ### Qiita::Client#stock_item(item_id, params = nil, headers = nil)
@@ -182,6 +189,13 @@ module Qiita
182
189
  get("/api/v2/users/#{user_id}/stocks", params, headers)
183
190
  end
184
191
 
192
+ # ### Qiita::Client#list_item_likes(item_id, params = nil, headers = nil)
193
+ # List likes in newest order.
194
+ #
195
+ def list_item_likes(item_id, params = nil, headers = nil)
196
+ get("/api/v2/items/#{item_id}/likes", params, headers)
197
+ end
198
+
185
199
  # ### Qiita::Client#list_projects(params = nil, headers = nil)
186
200
  # List projects in newest order.
187
201
  #
@@ -210,10 +224,10 @@ module Qiita
210
224
  get("/api/v2/projects/#{project_id}", params, headers)
211
225
  end
212
226
 
213
- # ### Qiita::Client#patch_project(project_id, params = nil, headers = nil)
227
+ # ### Qiita::Client#update_project(project_id, params = nil, headers = nil)
214
228
  # Update a project
215
229
  #
216
- def patch_project(project_id, params = nil, headers = nil)
230
+ def update_project(project_id, params = nil, headers = nil)
217
231
  patch("/api/v2/projects/#{project_id}", params, headers)
218
232
  end
219
233
 
@@ -1,3 +1,3 @@
1
1
  module Qiita
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qiita
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-03 00:00:00.000000000 Z
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -209,8 +209,6 @@ files:
209
209
  - README.md
210
210
  - Rakefile
211
211
  - bin/qiita
212
- - doc/client.md
213
- - doc/response.md
214
212
  - images/cli.png
215
213
  - lib/qiita.rb
216
214
  - lib/qiita/arguments.rb
@@ -246,11 +244,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
244
  version: '0'
247
245
  requirements: []
248
246
  rubyforge_project:
249
- rubygems_version: 2.4.5
247
+ rubygems_version: 2.4.5.1
250
248
  signing_key:
251
249
  specification_version: 4
252
250
  summary: A client library for Qiita API v2 written in Ruby.
253
251
  test_files:
254
252
  - spec/qiita/client_spec.rb
255
253
  - spec/spec_helper.rb
256
- has_rdoc:
@@ -1,219 +0,0 @@
1
- ### Qiita::Client.new(options = {})
2
- Creates a new instance of `Qiita::Client` class.
3
- `options` can have following key-values:
4
-
5
- * `access_token` - (String) Access token issued to authenticate and authorize user.
6
- * `host` - (String) Hostname where this client accesses to.
7
- * `ssl` - (Boolean) Use SSL verification. (default: true)
8
- * `team` - (String) Team name to be used as subdomain.
9
-
10
- ```rb
11
- Qiita::Client.new
12
- Qiita::Client.new(access_token: "...")
13
- Qiita::Client.new(host: "my-team-name.qiita.com")
14
- Qiita::Client.new(team: "my-team-name")
15
- ```
16
-
17
- ### Qiita::Client#get(path, params = nil, headers = nil)
18
- Sends GET request with given parameters, then returns a `Qiita::Response`.
19
- `params` are url-encoded and used as URI query string.
20
-
21
- ```rb
22
- client.get("/api/v2/items", page: 2)
23
- ```
24
-
25
- ### Qiita::Client#post(path, params = nil, headers = nil)
26
- Sends POST request with given parameters, then returns a Qiita::Response.
27
- `params` are JSON-encoded and used as request body.
28
-
29
- ```rb
30
- client.post("/api/v2/items", title: "...", body: "...")
31
- ```
32
-
33
- ### Qiita::Client#patch(path, params = nil, headers = nil)
34
- Sends PATCH request with given parameters, then returns a Qiita::Response.
35
- `params` are JSON-encoded and used as request body.
36
-
37
- ```rb
38
- client.patch("/api/v2/items/543efd13001e30837319", title: "...", body: "...")
39
- ```
40
-
41
- ### Qiita::Client#put(path, params = nil, headers = nil)
42
- Sends PUT request, then returns a Qiita::Response.
43
- `params` are JSON-encoded and used as request body.
44
-
45
- ```rb
46
- client.put("/api/v2/items/543efd13001e30837319/stock")
47
- ```
48
-
49
- ### Qiita::Client#delete(path, params = nil, headers = nil)
50
- Sends DELETE request, then returns a Qiita::Response.
51
- `params` are url-encoded and used as URI query string.
52
-
53
- ```rb
54
- client.delete("/api/v2/items/543efd13001e30837319/stock")
55
- ```
56
-
57
- ### Qiita::Client#connection
58
- Returns a Faraday::Connection to customize by your favorite middlewares.
59
-
60
- ```rb
61
- client.connection.response :logger
62
- ```
63
-
64
- ### Qiita::Client#create_access_token(params = nil, headers = nil)
65
- 与えられた認証情報をもとに新しいアクセストークンを発行します。
66
-
67
- ### Qiita::Client#delete_access_token(token, params = nil, headers = nil)
68
- 与えられたアクセストークンを失効させ、それ以降利用されないようにします。
69
-
70
- ### Qiita::Client#get_comment(id, params = nil, headers = nil)
71
- 特定のコメントを返します。
72
-
73
- ### Qiita::Client#delete_comment(id, params = nil, headers = nil)
74
- 特定のコメントを削除します。
75
-
76
- ### Qiita::Client#update_comment(id, params = nil, headers = nil)
77
- 特定のコメントを更新します。
78
-
79
- ### Qiita::Client#list_item_comments(item_id, params = nil, headers = nil)
80
- 特定の投稿に寄せられたコメント一覧を作成日時の降順で返します。
81
-
82
- ### Qiita::Client#create_item_comment(item_id, params = nil, headers = nil)
83
- 特定の投稿にコメントを付けます。
84
-
85
- ### Qiita::Client#thank_comment(comment_id, params = nil, headers = nil)
86
- 特定のコメントにThankを付けます。
87
-
88
- ### Qiita::Client#unthank_comment(comment_id, params = nil, headers = nil)
89
- 特定のコメントからThankを外します。
90
-
91
- ### Qiita::Client#list_items(params = nil, headers = nil)
92
- 投稿の一覧を作成日時の降順で返します。
93
-
94
- ### Qiita::Client#list_authenticated_user_items(params = nil, headers = nil)
95
- 認証中のユーザの投稿の一覧を作成日時の降順で返します。
96
-
97
- ### Qiita::Client#create_item(params = nil, headers = nil)
98
- 新たに投稿を作成します。
99
-
100
- ### Qiita::Client#get_item(id, params = nil, headers = nil)
101
- 特定の投稿を返します。
102
-
103
- ### Qiita::Client#update_item(id, params = nil, headers = nil)
104
- 特定の投稿を編集します。
105
-
106
- ### Qiita::Client#delete_item(id, params = nil, headers = nil)
107
- 特定の投稿を削除します。
108
-
109
- ### Qiita::Client#list_tag_items(id, params = nil, headers = nil)
110
- 特定のタグが付けられた投稿一覧を、タグを付けた日時の降順で返します。
111
-
112
- ### Qiita::Client#list_user_items(user_id, params = nil, headers = nil)
113
- 特定のユーザの投稿一覧を作成日時の降順で返します。
114
-
115
- ### Qiita::Client#list_user_stocks(user_id, params = nil, headers = nil)
116
- 特定のユーザがストックした投稿一覧をストックした日時の降順で返します。
117
-
118
- ### Qiita::Client#get_item_stock(item_id, params = nil, headers = nil)
119
- 特定の投稿をストックしている場合に204を返します。
120
-
121
- ### Qiita::Client#stock_item(item_id, params = nil, headers = nil)
122
- 特定の投稿をストックします。
123
-
124
- ### Qiita::Client#unstock_item(item_id, params = nil, headers = nil)
125
- 特定の投稿をストックから取り除きます。
126
-
127
- ### Qiita::Client#like_item(item_id, params = nil, headers = nil)
128
- 特定の投稿に「いいね!」を付けます。Qiita:Teamでのみ有効です。
129
-
130
- ### Qiita::Client#unlike_item(item_id, params = nil, headers = nil)
131
- 特定の投稿への「いいね!」を取り消します。Qiita:Teamでのみ有効です。
132
-
133
- ### Qiita::Client#list_projects(params = nil, headers = nil)
134
- チーム内に存在するプロジェクト一覧をプロジェクト作成日時の降順で返します。
135
-
136
- ### Qiita::Client#get_project(id, params = nil, headers = nil)
137
- 特定のプロジェクトを返します。
138
-
139
- ### Qiita::Client#create_project(params = nil, headers = nil)
140
- プロジェクトを新たに作成します。
141
-
142
- ### Qiita::Client#delete_project(id, params = nil, headers = nil)
143
- 特定のプロジェクトを削除します。
144
-
145
- ### Qiita::Client#update_project(id, params = nil, headers = nil)
146
- 特定のプロジェクトを編集します。
147
-
148
- ### Qiita::Client#create_expanded_template(params = nil, headers = nil)
149
- 受け取ったテンプレート用文字列の変数を展開して返します。
150
-
151
- ### Qiita::Client#list_tags(params = nil, headers = nil)
152
- 全てのタグ一覧をタグ作成日時の降順で返します。
153
-
154
- ### Qiita::Client#get_tag(id, params = nil, headers = nil)
155
- 特定のタグを返します。
156
-
157
- ### Qiita::Client#list_user_following_tags(user_id, params = nil, headers = nil)
158
- 特定のユーザがフォローしているタグ一覧をフォローした日時の降順で返します。
159
-
160
- ### Qiita::Client#get_tag_following(id, params = nil, headers = nil)
161
- 特定のタグをフォローしている場合に204を返します。
162
-
163
- ### Qiita::Client#follow_tag(id, params = nil, headers = nil)
164
- 特定のタグをフォローします。
165
-
166
- ### Qiita::Client#unfollow_tag(id, params = nil, headers = nil)
167
- 特定のタグへのフォローを解除します。
168
-
169
- ### Qiita::Client#create_tagging(item_id, params = nil, headers = nil)
170
- 投稿にタグを追加します。Qiita:Teamでのみ有効です。
171
-
172
- ### Qiita::Client#delete_tagging(item_id, name, params = nil, headers = nil)
173
- 投稿から指定されたタグを取り除きます。Qiita:Teamでのみ有効です。
174
-
175
- ### Qiita::Client#list_teams(params = nil, headers = nil)
176
- 現在のリクエストで認証されているユーザが所属している全てのチームを、チーム作成日時の降順で返します。
177
-
178
- ### Qiita::Client#list_templates(params = nil, headers = nil)
179
- そのチームに存在するテンプレート一覧を返します。
180
-
181
- ### Qiita::Client#get_template(id, params = nil, headers = nil)
182
- 特定のテンプレートを返します。
183
-
184
- ### Qiita::Client#delete_template(id, params = nil, headers = nil)
185
- 特定のテンプレートを削除します。
186
-
187
- ### Qiita::Client#create_template(params = nil, headers = nil)
188
- 新しくテンプレートを作成します。
189
-
190
- ### Qiita::Client#update_template(id, params = nil, headers = nil)
191
- 特定のテンプレートを編集します。
192
-
193
- ### Qiita::Client#list_users(params = nil, headers = nil)
194
- 全てのユーザの一覧を作成日時の降順で返します。
195
-
196
- ### Qiita::Client#get_user(id, params = nil, headers = nil)
197
- 特定のユーザを返します。
198
-
199
- ### Qiita::Client#get_authenticated_user(params = nil, headers = nil)
200
- アクセストークンに紐付いたユーザを返します。
201
-
202
- ### Qiita::Client#list_user_followees(user_id, params = nil, headers = nil)
203
- 特定のユーザがフォローしているユーザ一覧を返します。
204
-
205
- ### Qiita::Client#list_user_followers(user_id, params = nil, headers = nil)
206
- 特定のユーザをフォローしているユーザ一覧を返します。
207
-
208
- ### Qiita::Client#list_item_stockers(item_id, params = nil, headers = nil)
209
- 特定の投稿をストックしているユーザ一覧を、ストックした日時の降順で返します。
210
-
211
- ### Qiita::Client#get_user_following(user_id, params = nil, headers = nil)
212
- 特定のユーザをフォローしている場合に204を返します。
213
-
214
- ### Qiita::Client#follow_user(user_id, params = nil, headers = nil)
215
- 特定のユーザをフォローします。
216
-
217
- ### Qiita::Client#unfollow_user(user_id, params = nil, headers = nil)
218
- 特定のユーザへのフォローを外します。
219
-
@@ -1,33 +0,0 @@
1
- ### Qiita::Response#body
2
- Returns response body returned from API as a `Hash` or an `Array` of `Hash`.
3
-
4
- ```rb
5
- response.body #=> { ... }
6
- ```
7
-
8
- ### Qiita::Response#first_page_url
9
- Returns first page URL or nil.
10
-
11
- ### Qiita::Response#last_page_url
12
- Returns last page URL or nil.
13
-
14
- ### Qiita::Response#next_page_url
15
- Returns next page URL or nil.
16
-
17
- ### Qiita::Response#previous_page_url
18
- Returns previous page URL or nil.
19
-
20
- ### Qiita::Response#headers
21
- Returns response headers returned from API as a `Hash`.
22
-
23
- ```rb
24
- response.headers #=> { "Content-Type" => "application/json" }
25
- ```
26
-
27
- ### Qiita::Response#status
28
- Returns response status code returned from API as a `Fixnum`.
29
-
30
- ```rb
31
- response.status #=> 200
32
- ```
33
-