qiita 1.0.7 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 260ca411d7a89f1b8119d24ecb54d3b044ecdb92
4
- data.tar.gz: 09fdba77df146d0ddd656dce92ba431e81121d56
3
+ metadata.gz: 08a53dd50aa4de2458e4402a963e6fd3ba09443a
4
+ data.tar.gz: b819b9c447eda41b1a3d6087572ba6777d446f07
5
5
  SHA512:
6
- metadata.gz: 89c96dff3a6a081175273cf8a2cecc967e3fd66c99cf89ca13085b0d8959d1f1cfc5a602767afd28498f844a8213c417c634bb32f3680bc5c6d9153d1306ef20
7
- data.tar.gz: e4b5e91e6c8b8f21a58397c91b5c65746730ee07c8e90c503ec93994d8440783392e5e41f17d5752c0fb5c596a3b5c2b70e94c33362a64cdbbf90ff9f5b39c70
6
+ metadata.gz: 83f9b97799f869b6f54d5da5404d8746e31680cb0c5aecbc8e52425c0ddc9bb98bd842a8ca72f81d8c2e4ae94673d51945cf2394b72963cb413d04b5f243406a
7
+ data.tar.gz: 822077c30bcf3146e8427ba2cb9832290cb5bf12869a3f3335a93899032f34e7b83b38b0224f0f62827714d72f7e1592c01b23bc1776265006febe4b5e0570fe
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.1.0
2
+ - Add --no-ssl-verification option
3
+
1
4
  ## 1.0.7
2
5
  - Add list_authenticated_user_items method
3
6
 
data/README.md CHANGED
@@ -36,6 +36,7 @@ $ qiita <method> <arguments> [headers|params] [options]
36
36
  | | | | -h, --help
37
37
  | | | | --header
38
38
  | | | | --no-body
39
+ | | | | --no-ssl-verification
39
40
  | | | | -t, --team
40
41
  | | | |
41
42
  | | | `------------ key=value or key:=value
data/doc/client.md CHANGED
@@ -4,6 +4,7 @@ Creates a new instance of `Qiita::Client` class.
4
4
 
5
5
  * `access_token` - (String) Access token issued to authenticate and authorize user.
6
6
  * `host` - (String) Hostname where this client accesses to.
7
+ * `ssl` - (Boolean) Use SSL verification. (default: true)
7
8
  * `team` - (String) Team name to be used as subdomain.
8
9
 
9
10
  ```rb
@@ -90,6 +91,9 @@ client.connection.response :logger
90
91
  ### Qiita::Client#list_items(params = nil, headers = nil)
91
92
  投稿の一覧を返します。
92
93
 
94
+ ### Qiita::Client#list_authenticated_user_items(params = nil, headers = nil)
95
+ 認証中のユーザの投稿の一覧を返します。
96
+
93
97
  ### Qiita::Client#create_item(params = nil, headers = nil)
94
98
  新たに投稿を作成します。
95
99
 
@@ -28,6 +28,10 @@ module Qiita
28
28
  slop_options["host"]
29
29
  end
30
30
 
31
+ def ssl
32
+ !slop_options["no-ssl-verification"]
33
+ end
34
+
31
35
  def method_name
32
36
  ARGV[0]
33
37
  end
@@ -131,6 +135,7 @@ module Qiita
131
135
  on "h", "help", "Display help message"
132
136
  on "header", "Show response header"
133
137
  on "no-body", "Hide response body"
138
+ on "no-ssl-verification", "Ignore SSL verification"
134
139
  on "t", "team=", "Team name to be used as subdomain"
135
140
  end
136
141
  end
data/lib/qiita/client.rb CHANGED
@@ -26,6 +26,7 @@ module Qiita
26
26
  #
27
27
  # * `access_token` - (String) Access token issued to authenticate and authorize user.
28
28
  # * `host` - (String) Hostname where this client accesses to.
29
+ # * `ssl` - (Boolean) Use SSL verification. (default: true)
29
30
  # * `team` - (String) Team name to be used as subdomain.
30
31
  #
31
32
  # ```rb
@@ -35,9 +36,10 @@ module Qiita
35
36
  # Qiita::Client.new(team: "my-team-name")
36
37
  # ```
37
38
  #
38
- def initialize(access_token: nil, host: nil, team: nil)
39
+ def initialize(access_token: nil, host: nil, ssl: true, team: nil)
39
40
  @access_token = access_token
40
41
  @host = host
42
+ @ssl = ssl
41
43
  @team = team
42
44
  end
43
45
 
@@ -109,7 +111,7 @@ module Qiita
109
111
  # ```
110
112
  #
111
113
  def connection
112
- @connection ||= Faraday.new(headers: default_headers, url: url_prefix) do |connection|
114
+ @connection ||= Faraday.new(faraday_client_options) do |connection|
113
115
  connection.request :json
114
116
  connection.response :json
115
117
  connection.adapter Faraday.default_adapter
@@ -124,6 +126,16 @@ module Qiita
124
126
  headers
125
127
  end
126
128
 
129
+ def faraday_client_options
130
+ {
131
+ headers: default_headers,
132
+ ssl: {
133
+ verify: @ssl,
134
+ },
135
+ url: url_prefix,
136
+ }
137
+ end
138
+
127
139
  def host
128
140
  case
129
141
  when @host
@@ -22,6 +22,7 @@ module Qiita
22
22
  Client.new(
23
23
  access_token: @arguments.access_token,
24
24
  host: @arguments.host,
25
+ ssl: @arguments.ssl,
25
26
  team: @arguments.team,
26
27
  )
27
28
  end
data/lib/qiita/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qiita
2
- VERSION = "1.0.7"
2
+ VERSION = "1.1.0"
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.0.7
4
+ version: 1.1.0
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-01-14 00:00:00.000000000 Z
11
+ date: 2015-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport