qiita 1.1.0 → 1.1.1

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: 08a53dd50aa4de2458e4402a963e6fd3ba09443a
4
- data.tar.gz: b819b9c447eda41b1a3d6087572ba6777d446f07
3
+ metadata.gz: a07e81a06224f1bfe1b35e2d0f5a0ee5435a28f8
4
+ data.tar.gz: 9f6e470df28e6af846efa9e66b0b66a651d89f6c
5
5
  SHA512:
6
- metadata.gz: 83f9b97799f869b6f54d5da5404d8746e31680cb0c5aecbc8e52425c0ddc9bb98bd842a8ca72f81d8c2e4ae94673d51945cf2394b72963cb413d04b5f243406a
7
- data.tar.gz: 822077c30bcf3146e8427ba2cb9832290cb5bf12869a3f3335a93899032f34e7b83b38b0224f0f62827714d72f7e1592c01b23bc1776265006febe4b5e0570fe
6
+ metadata.gz: 13ba9b095052b531f9e63280fd28428b9ed720df9a206aa19503b837dc5d077143a03c133f0b03988d9a22843a7ea9af9e910599824b7d3acff334229cb0fab3
7
+ data.tar.gz: 0ce849d8f87acaea053154afedfff916f946cbad4f4b80508ef8789a032b3c748eb9d01efdd56f3ff7669b56c436d657953a51c844a2e59802d93160544c57f7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.1.1
2
+ - Support --host with --team option
3
+
1
4
  ## 1.1.0
2
5
  - Add --no-ssl-verification option
3
6
 
data/lib/qiita/client.rb CHANGED
@@ -120,6 +120,10 @@ module Qiita
120
120
 
121
121
  private
122
122
 
123
+ def base_host
124
+ @host || DEFAULT_HOST
125
+ end
126
+
123
127
  def default_headers
124
128
  headers = DEFAULT_HEADERS.clone
125
129
  headers["Authorization"] = "Bearer #{@access_token}" if @access_token
@@ -137,13 +141,10 @@ module Qiita
137
141
  end
138
142
 
139
143
  def host
140
- case
141
- when @host
142
- @host
143
- when @team
144
- "#{@team}.#{DEFAULT_HOST}"
144
+ if @team
145
+ "#{@team}.#{base_host}"
145
146
  else
146
- DEFAULT_HOST
147
+ base_host
147
148
  end
148
149
  end
149
150
 
data/lib/qiita/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qiita
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -203,6 +203,29 @@ describe Qiita::Client do
203
203
  end
204
204
  end
205
205
 
206
+ context "with :host and :team options" do
207
+ before do
208
+ options[:host] = host
209
+ options[:team] = team
210
+ end
211
+
212
+ let(:host) do
213
+ "example.com"
214
+ end
215
+
216
+ let(:team) do
217
+ "test"
218
+ end
219
+
220
+ let(:requested_host) do
221
+ [team, host].join(".")
222
+ end
223
+
224
+ it "sends request to configured host including team as subdomain" do
225
+ should be_a Qiita::Response
226
+ end
227
+ end
228
+
206
229
  context "with a Qiita::Client created with :access_token option" do
207
230
  before do
208
231
  options[:access_token] = access_token
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.1.0
4
+ version: 1.1.1
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-15 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport