hotchoc 0.5.0 → 0.6.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: 50267ed0d074efc5ce675e1763a947da964d0ebd
4
- data.tar.gz: 40d722542faa6efc13c90b168bac0e559e0a0cd2
3
+ metadata.gz: 861c7314101175aed1f8e95ebb240e12fe0fe406
4
+ data.tar.gz: 389e3e46b305d1ed80e43cb99da820f7809c6536
5
5
  SHA512:
6
- metadata.gz: 9831a75a659d14b26e9bd1fe1e94e102143f00fd9b5be051f93ccd481041ceed29d77c724e7b1cbda957c0d824e712f40ab71261fa7e9a63c27942f74388e727
7
- data.tar.gz: 17974b2a003c220394bbbe19ba5d1bbe1c8fa6b3145a966ba5fa6b6b2d73b9a63ad6436620b4d0613e5658b780a55da93101594574f5fcd7ff833edc73418ca2
6
+ metadata.gz: ffee16f71aded938646f11c3765292d810c9adcfc88c67bd2541b9d866b40de38ec92e1d22f40de73e286a082cc525520e1dd870fb3b1308eb9883340231eae0
7
+ data.tar.gz: 9d287d520b323f889fda92c50c19ccb0f260f9023b9f16756859b0e0dceb6704cb5de1b43199ef4a383df25efcf11664df163b67c137ce3a042190281d000f0d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## Master
4
4
 
5
+ ## 0.6.0
6
+
7
+ [Full changelog](https://github.com/choc/hotchoc-ruby/compare/v0.5.0...v0.6.0)
8
+
9
+ Changes:
10
+
11
+ * Removed `verify` option
12
+ * Added `protocol` option
13
+
5
14
  ## 0.5.0
6
15
 
7
16
  [Full changelog](https://github.com/choc/hotchoc-ruby/compare/v0.4.1...v0.5.0)
@@ -1,12 +1,12 @@
1
1
  module Hotchoc
2
2
  class Client
3
3
  module Configuration
4
- VALID_CONFIG_KEYS = [:api_key, :site, :hostname, :verify].freeze
4
+ VALID_CONFIG_KEYS = [:api_key, :site, :hostname, :protocol].freeze
5
5
 
6
6
  DEFAULT_API_KEY = nil
7
7
  DEFAULT_SITE = nil
8
8
  DEFAULT_HOSTNAME = 'hotchoc.io'
9
- DEFAULT_VERIFY = true
9
+ DEFAULT_PROTOCOL = 'https'
10
10
 
11
11
  #
12
12
  # Build accessor methods for every config options so we can do this, for example:
@@ -26,7 +26,7 @@ module Hotchoc
26
26
  self.api_key = DEFAULT_API_KEY
27
27
  self.site = DEFAULT_SITE
28
28
  self.hostname = DEFAULT_HOSTNAME
29
- self.verify = DEFAULT_VERIFY
29
+ self.protocol = DEFAULT_PROTOCOL
30
30
  end
31
31
 
32
32
  def options
@@ -13,12 +13,12 @@ module Hotchoc
13
13
  follow_redirects: true
14
14
  }
15
15
 
16
- def self.get(url, opts = {}, verify = true)
17
- new.get(url, opts, verify)
16
+ def self.get(url, opts = {})
17
+ new.get(url, opts)
18
18
  end
19
19
 
20
- def get(url, opts = {}, verify = true)
21
- response = HTTParty.get(url, params(opts, verify))
20
+ def get(url, opts = {})
21
+ response = HTTParty.get(url, params(opts))
22
22
 
23
23
  if response.success?
24
24
  JSON.parse(response.body)
@@ -29,11 +29,8 @@ module Hotchoc
29
29
 
30
30
  private
31
31
 
32
- def params(opts, verify)
33
- {
34
- query: opts,
35
- verify: verify
36
- }.merge(DEFAULT_OPTIONS)
32
+ def params(opts)
33
+ { query: opts }.merge(DEFAULT_OPTIONS)
37
34
  end
38
35
 
39
36
  def request_error_message(response)
@@ -1,5 +1,5 @@
1
1
  module Hotchoc
2
2
  class Client
3
- VERSION = '0.5.0'
3
+ VERSION = '0.6.0'
4
4
  end
5
5
  end
@@ -32,9 +32,9 @@ module Hotchoc
32
32
  private
33
33
 
34
34
  def get(path, opts = {})
35
- url = "https://#{site}.#{hostname}/api/#{path}"
35
+ url = "#{protocol}://#{site}.#{hostname}/api/#{path}"
36
36
 
37
- Fetcher.get(url, merged_options(opts), verify)
37
+ Fetcher.get(url, merged_options(opts))
38
38
  end
39
39
 
40
40
  def merged_options(opts)
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Hotchoc::Album do
4
4
  let(:data) do
5
- JSON.parse(File.read(response_stub('albums')))['albums'].first
5
+ JSON.parse(File.read(response_stub('albums'))).first
6
6
  end
7
7
 
8
8
  let(:album) do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Hotchoc::Blocks::Image do
4
4
  let(:data) do
5
- JSON.parse(File.read(response_stub('albums')))['albums'].first['blocks'].first
5
+ JSON.parse(File.read(response_stub('albums'))).first['blocks'].first
6
6
  end
7
7
 
8
8
  let(:block) do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Hotchoc::Blocks::Text do
4
4
  let(:data) do
5
- blocks = JSON.parse(File.read(response_stub('pages')))['pages'].first['blocks']
5
+ blocks = JSON.parse(File.read(response_stub('pages'))).first['blocks']
6
6
  blocks.detect { |block| block['type'] == 'text' }
7
7
  end
8
8
 
@@ -11,7 +11,7 @@ describe Hotchoc::Client::API do
11
11
  describe 'Albums' do
12
12
  context 'GET collection' do
13
13
  let(:albums) do
14
- JSON.parse(File.read(response_stub('albums')))['albums'].map { |album| Hotchoc::Album.new(album) }
14
+ JSON.parse(File.read(response_stub('albums'))).map { |album| Hotchoc::Album.new(album) }
15
15
  end
16
16
 
17
17
  it 'returns an array with the albums' do
@@ -23,7 +23,7 @@ describe Hotchoc::Client::API do
23
23
  describe 'Pages' do
24
24
  context 'GET collection' do
25
25
  let(:pages) do
26
- JSON.parse(File.read(response_stub('pages')))['pages'].map { |page| Hotchoc::Page.new(page) }
26
+ JSON.parse(File.read(response_stub('pages'))).map { |page| Hotchoc::Page.new(page) }
27
27
  end
28
28
 
29
29
  it 'returns an array with the pages' do
@@ -35,7 +35,7 @@ describe Hotchoc::Client::API do
35
35
  describe 'Posts' do
36
36
  context 'GET collection' do
37
37
  let(:posts) do
38
- JSON.parse(File.read(response_stub('posts')))['posts'].map { |post| Hotchoc::Post.new(post) }
38
+ JSON.parse(File.read(response_stub('posts'))).map { |post| Hotchoc::Post.new(post) }
39
39
  end
40
40
 
41
41
  it 'returns an array with the posts' do
@@ -47,7 +47,7 @@ describe Hotchoc::Client::API do
47
47
  describe 'Topics' do
48
48
  context 'GET collection' do
49
49
  let(:topics) do
50
- JSON.parse(File.read(response_stub('topics')))['topics'].map { |topic| Hotchoc::Topic.new(topic) }
50
+ JSON.parse(File.read(response_stub('topics'))).map { |topic| Hotchoc::Topic.new(topic) }
51
51
  end
52
52
 
53
53
  it 'returns an array with the topics' do
@@ -9,7 +9,7 @@ describe Hotchoc::Client do
9
9
  api_key: 'abc',
10
10
  site: 'def',
11
11
  hostname: 'ghi',
12
- verify: false
12
+ protocol: 'http'
13
13
  }
14
14
  end
15
15
 
@@ -23,7 +23,7 @@ describe Hotchoc::Client do
23
23
  end
24
24
 
25
25
  it 'overrides module configuration after' do
26
- client = described_class.new(api_key: 'rst', site: 'uvw', hostname: 'xyz', verify: true)
26
+ client = described_class.new(api_key: 'rst', site: 'uvw', hostname: 'xyz', protocol: 'https')
27
27
 
28
28
  config.each do |key, value|
29
29
  client.send("#{key}=", value)
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Hotchoc::File do
4
4
  let(:data) do
5
- JSON.parse(File.read(response_stub('albums')))['albums'].first['blocks'].first
5
+ JSON.parse(File.read(response_stub('albums'))).first['blocks'].first
6
6
  end
7
7
 
8
8
  let(:file) do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Hotchoc::Page do
4
4
  let(:data) do
5
- JSON.parse(File.read(response_stub('pages')))['pages'].first
5
+ JSON.parse(File.read(response_stub('pages'))).first
6
6
  end
7
7
 
8
8
  let(:page) do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Hotchoc::Post do
4
4
  let(:data) do
5
- JSON.parse(File.read(response_stub('posts')))['posts'].first
5
+ JSON.parse(File.read(response_stub('posts'))).first
6
6
  end
7
7
 
8
8
  let(:post) do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Hotchoc::Thumbnail do
4
4
  let(:data) do
5
- JSON.parse(File.read(response_stub('albums')))['albums'].first['blocks'].first
5
+ JSON.parse(File.read(response_stub('albums'))).first['blocks'].first
6
6
  end
7
7
 
8
8
  let(:thumbnail) do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Hotchoc::Topic do
4
4
  let(:data) do
5
- JSON.parse(File.read(response_stub('posts')))['posts'].first
5
+ JSON.parse(File.read(response_stub('posts'))).first
6
6
  end
7
7
 
8
8
  let(:topic) do