hotchoc 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/hotchoc/client/version.rb +1 -1
- data/lib/hotchoc/client.rb +1 -1
- data/spec/hotchoc/client/api_spec.rb +1 -1
- data/spec/hotchoc/client/configuration_spec.rb +4 -4
- data/spec/hotchoc/client/main_spec.rb +2 -2
- data/spec/hotchoc/client_spec.rb +20 -21
- data/spec/hotchoc/presenters/album_spec.rb +2 -2
- data/spec/hotchoc/presenters/blocks/image_spec.rb +2 -2
- data/spec/hotchoc/presenters/blocks/text_spec.rb +2 -2
- data/spec/hotchoc/presenters/file_spec.rb +1 -1
- data/spec/hotchoc/presenters/page_spec.rb +2 -2
- data/spec/hotchoc/presenters/post_spec.rb +2 -2
- data/spec/hotchoc/presenters/thumbnail_spec.rb +1 -1
- data/spec/hotchoc/presenters/topic_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4343918396edff5deef7f5b6f9f2b4056f49ac85
|
4
|
+
data.tar.gz: 6a7735696aef0581aae2eb2707053e7497ec8eac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a9ce027a457ea6ea088c41fce52e5f6e4e3dc2eeaa925a5b5a380be77c52e24fe07a7c472916b1ad5032934cb028c5cb365f1389d781352d4ad6fb33b7c1f66
|
7
|
+
data.tar.gz: c044fefbf11ad365ef3035269b369df8f8acb91ca9a1ac8d93061115047446b762ba5a25ef95c1814e28148aaa64fbba5290b075d8c11acbd8f377971819c446
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
+
## 0.3.1
|
6
|
+
|
7
|
+
[Full changelog](https://github.com/choc/hotchoc-ruby/compare/v0.3.0...v0.3.1)
|
8
|
+
|
9
|
+
Bugfixes:
|
10
|
+
|
11
|
+
* Client options merging fixed
|
12
|
+
|
5
13
|
## 0.3.0
|
6
14
|
|
7
15
|
[Full changelog](https://github.com/choc/hotchoc-ruby/compare/v0.2.1...v0.3.0)
|
data/lib/hotchoc/client.rb
CHANGED
@@ -8,7 +8,7 @@ module Hotchoc
|
|
8
8
|
attr_accessor(*Configuration::VALID_CONFIG_KEYS)
|
9
9
|
|
10
10
|
def initialize(opts = {})
|
11
|
-
options = Hotchoc.options.merge(opts)
|
11
|
+
options = Hotchoc.options.merge(opts) { |key, oldval, newval| oldval || newval }
|
12
12
|
|
13
13
|
fail ArgumentError, 'API key is required' unless options[:api_key]
|
14
14
|
fail ArgumentError, 'Site name is required' unless options[:site]
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Hotchoc::Client::Configuration do
|
4
4
|
after do
|
5
5
|
Hotchoc.reset
|
6
6
|
end
|
7
7
|
|
8
|
-
|
8
|
+
described_class::VALID_CONFIG_KEYS.each do |key|
|
9
9
|
describe ".#{key}" do
|
10
|
-
it "
|
11
|
-
expect(Hotchoc.send(key)).to eq
|
10
|
+
it "returns the default #{key}" do
|
11
|
+
expect(Hotchoc.send(key)).to eq described_class.const_get("DEFAULT_#{key.upcase}")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/spec/hotchoc/client_spec.rb
CHANGED
@@ -1,37 +1,36 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
3
|
+
describe Hotchoc::Client do
|
4
|
+
let(:keys) do
|
5
|
+
Hotchoc::Client::Configuration::VALID_CONFIG_KEYS
|
6
|
+
end
|
7
|
+
let(:config) do
|
8
|
+
{
|
9
|
+
api_key: 'abc',
|
10
|
+
site: 'def',
|
11
|
+
hostname: 'ghi',
|
12
|
+
verify: false
|
13
|
+
}
|
6
14
|
end
|
7
15
|
|
8
16
|
describe 'with class configuration' do
|
9
|
-
|
10
|
-
|
11
|
-
api_key: 'abc',
|
12
|
-
site: 'def',
|
13
|
-
hostname: 'ghi',
|
14
|
-
verify: false
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should override module configuration' do
|
19
|
-
client = Hotchoc::Client.new(@config)
|
17
|
+
it 'overrides module configuration' do
|
18
|
+
client = described_class.new(config)
|
20
19
|
|
21
|
-
|
22
|
-
expect(client.send(key)).to eq
|
20
|
+
keys.each do |key|
|
21
|
+
expect(client.send(key)).to eq config[key]
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
|
-
it '
|
27
|
-
client =
|
25
|
+
it 'overrides module configuration after' do
|
26
|
+
client = described_class.new(api_key: 'rst', site: 'uvw', hostname: 'xyz', verify: true)
|
28
27
|
|
29
|
-
|
28
|
+
config.each do |key, value|
|
30
29
|
client.send("#{key}=", value)
|
31
30
|
end
|
32
31
|
|
33
|
-
|
34
|
-
expect(client.send("#{key}")).to eq
|
32
|
+
keys.each do |key|
|
33
|
+
expect(client.send("#{key}")).to eq config[key]
|
35
34
|
end
|
36
35
|
end
|
37
36
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Hotchoc::Presenters::Album do
|
4
4
|
let(:data) do
|
5
5
|
JSON.parse(File.read(response_stub('albums')))['albums'].first
|
6
6
|
end
|
7
7
|
|
8
8
|
let(:album) do
|
9
|
-
|
9
|
+
described_class.new(data)
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'has an ID' do
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Hotchoc::Presenters::Blocks::Image do
|
4
4
|
let(:data) do
|
5
5
|
JSON.parse(File.read(response_stub('albums')))['albums'].first['blocks'].first
|
6
6
|
end
|
7
7
|
|
8
8
|
let(:block) do
|
9
|
-
|
9
|
+
described_class.new(data)
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'has a title' do
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Hotchoc::Presenters::Blocks::Text do
|
4
4
|
let(:data) do
|
5
5
|
blocks = JSON.parse(File.read(response_stub('pages')))['pages'].first['blocks']
|
6
6
|
blocks.detect { |block| block['type'] == 'text' }
|
7
7
|
end
|
8
8
|
|
9
9
|
let(:block) do
|
10
|
-
|
10
|
+
described_class.new(data)
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'has an html version' do
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Hotchoc::Presenters::Page do
|
4
4
|
let(:data) do
|
5
5
|
JSON.parse(File.read(response_stub('pages')))['pages'].first
|
6
6
|
end
|
7
7
|
|
8
8
|
let(:page) do
|
9
|
-
|
9
|
+
described_class.new(data)
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'has an ID' do
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Hotchoc::Presenters::Post do
|
4
4
|
let(:data) do
|
5
5
|
JSON.parse(File.read(response_stub('posts')))['posts'].first
|
6
6
|
end
|
7
7
|
|
8
8
|
let(:post) do
|
9
|
-
|
9
|
+
described_class.new(data)
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'has an ID' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hotchoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Siegel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|