hotchoc 0.3.0 → 0.3.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: c9e5cbbe0a4ac84c3a34276088b1ee8f99bdb4d6
4
- data.tar.gz: 23957659ecc09f31f748b56b3117316ba7d9d22f
3
+ metadata.gz: 4343918396edff5deef7f5b6f9f2b4056f49ac85
4
+ data.tar.gz: 6a7735696aef0581aae2eb2707053e7497ec8eac
5
5
  SHA512:
6
- metadata.gz: 56bace741611ecb19ef9e10ca7e5120c61936b257bdbd07271599887ccda5ddcbc05722f19ea96e8e00b6e03382e97b0ae62fac72be74ea458d7917a0a4ed4c8
7
- data.tar.gz: f57a0c75eee90516efc980ec3eef3bfb034216011f456083b7c19e49147f938f4bb51743c9f9f1531109f10ab246ce6169490241fb12e10edb1b5de2d8c436af
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)
@@ -1,5 +1,5 @@
1
1
  module Hotchoc
2
2
  class Client
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  end
5
5
  end
@@ -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,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Hotchoc::Client::API' do
3
+ describe Hotchoc::Client::API do
4
4
  let(:client) do
5
5
  Hotchoc::Client.new(
6
6
  api_key: 'test',
@@ -1,14 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Hotchoc::Client::Configuration' do
3
+ describe Hotchoc::Client::Configuration do
4
4
  after do
5
5
  Hotchoc.reset
6
6
  end
7
7
 
8
- Hotchoc::Client::Configuration::VALID_CONFIG_KEYS.each do |key|
8
+ described_class::VALID_CONFIG_KEYS.each do |key|
9
9
  describe ".#{key}" do
10
- it "should return the default #{key}" do
11
- expect(Hotchoc.send(key)).to eq Hotchoc::Client::Configuration.const_get("DEFAULT_#{key.upcase}")
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
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Hotchoc' do
4
- it 'should have a version' do
3
+ describe Hotchoc do
4
+ it 'has a version' do
5
5
  expect(Hotchoc::Client::VERSION).to_not be_nil
6
6
  end
7
7
  end
@@ -1,37 +1,36 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Hotchoc::Client' do
4
- before do
5
- @keys = Hotchoc::Client::Configuration::VALID_CONFIG_KEYS
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
- before do
10
- @config = {
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
- @keys.each do |key|
22
- expect(client.send(key)).to eq @config[key]
20
+ keys.each do |key|
21
+ expect(client.send(key)).to eq config[key]
23
22
  end
24
23
  end
25
24
 
26
- it 'should override module configuration after' do
27
- client = Hotchoc::Client.new(api_key: 'rst', site: 'uvw', hostname: 'xyz', verify: true)
25
+ it 'overrides module configuration after' do
26
+ client = described_class.new(api_key: 'rst', site: 'uvw', hostname: 'xyz', verify: true)
28
27
 
29
- @config.each do |key, value|
28
+ config.each do |key, value|
30
29
  client.send("#{key}=", value)
31
30
  end
32
31
 
33
- @keys.each do |key|
34
- expect(client.send("#{key}")).to eq @config[key]
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 'Hotchoc::Presenters::Album' do
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
- Hotchoc::Presenters::Album.new(data)
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 'Hotchoc::Presenters::Blocks::Image' do
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
- Hotchoc::Presenters::Blocks::Image.new(data)
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 'Hotchoc::Presenters::Blocks::Text' do
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
- Hotchoc::Presenters::Blocks::Text.new(data)
10
+ described_class.new(data)
11
11
  end
12
12
 
13
13
  it 'has an html version' do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Hotchoc::Presenters::File' do
3
+ describe Hotchoc::Presenters::File do
4
4
  let(:data) do
5
5
  JSON.parse(File.read(response_stub('albums')))['albums'].first['blocks'].first
6
6
  end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Hotchoc::Presenters::Page' do
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
- Hotchoc::Presenters::Page.new(data)
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 'Hotchoc::Presenters::Post' do
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
- Hotchoc::Presenters::Post.new(data)
9
+ described_class.new(data)
10
10
  end
11
11
 
12
12
  it 'has an ID' do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Hotchoc::Presenters::Thumbnail' do
3
+ describe Hotchoc::Presenters::Thumbnail do
4
4
  let(:data) do
5
5
  JSON.parse(File.read(response_stub('albums')))['albums'].first['blocks'].first
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Hotchoc::Presenters::Topic' do
3
+ describe Hotchoc::Presenters::Topic do
4
4
  let(:data) do
5
5
  JSON.parse(File.read(response_stub('posts')))['posts'].first
6
6
  end
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.0
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-10 00:00:00.000000000 Z
11
+ date: 2015-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty