diplomat 2.0.0 → 2.0.1

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: 0aa77dadc7f5b36f11bdd50ee2e43b1bad16d351
4
- data.tar.gz: e5c534280a221d8f17e2195a68fb9863cd58f31e
3
+ metadata.gz: e4c8c4d80b3709be01d325281097f3db8506cb9c
4
+ data.tar.gz: cb5c77df09a30b802e4a69c7d55c0f634f13d27c
5
5
  SHA512:
6
- metadata.gz: bf071f060eb8683f220baff80a21974d1b25e73e25caaa1e9a825949752476be8e76f85da1874ba003cbf6b1b8d580c85ffa733155299305e79edfb0bb50acad
7
- data.tar.gz: d57740b2bb515c6e74db8540db26e1dc5ef63b0e1d3cb3d8cdef554e9d9d48731e98f20a78827e76201ed22c8d8c06d0ca28645ab92d68163f0c1717b16e1405
6
+ metadata.gz: 58067ecae844fea9ce3e2240847542820c65ff17c49b6e1cd4b7c02a8f2872089f1ddb9c075a824d2265f6c10055a1f669dfeab4612e45ca1389390046ba404f
7
+ data.tar.gz: 011a2fe3e0a428922e13b595f86f143514227c80a3cf12aa0a17f20b99b3e0bafe20af9982fd70383a697686e874852df6de86bee90e8235e8af0c4bc44106dd
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Diplomat
2
- [![Gem Version](https://badge.fury.io/rb/diplomat.svg)](http://badge.fury.io/rb/diplomat) [![Build Status](https://travis-ci.org/WeAreFarmGeek/diplomat.svg?branch=master)](https://travis-ci.org/WeAreFarmGeek/diplomat) [![Code Climate](https://codeclimate.com/github/johnhamelink/diplomat.png)](https://codeclimate.com/github/WeAreFarmGeek/diplomat) [![Dependency Status](https://gemnasium.com/WeAreFarmGeek/diplomat.svg)](https://gemnasium.com/WeAreFarmGeek/diplomat) [![Inline docs](http://inch-ci.org/github/wearefarmgeek/diplomat.svg?branch=master)](http://inch-ci.org/github/wearefarmgeek/diplomat)
2
+ [![Gem Version](https://badge.fury.io/rb/diplomat.svg)](http://badge.fury.io/rb/diplomat) [![Gem](https://img.shields.io/gem/dt/diplomat.svg)](https://rubygems.org/gems/diplomat/versions/2.0.0) [![Build Status](https://travis-ci.org/WeAreFarmGeek/diplomat.svg?branch=master)](https://travis-ci.org/WeAreFarmGeek/diplomat) [![Code Climate](https://codeclimate.com/github/johnhamelink/diplomat.png)](https://codeclimate.com/github/WeAreFarmGeek/diplomat) [![Dependency Status](https://gemnasium.com/WeAreFarmGeek/diplomat.svg)](https://gemnasium.com/WeAreFarmGeek/diplomat) [![Inline docs](http://inch-ci.org/github/wearefarmgeek/diplomat.svg?branch=master)](http://inch-ci.org/github/wearefarmgeek/diplomat)
3
3
  ### A HTTP Ruby API for [Consul](http://www.consul.io/)
4
4
 
5
5
  ![Diplomacy Boad Game](http://i.imgur.com/Nkuy4b7.jpg)
@@ -77,7 +77,7 @@ module Diplomat
77
77
  @raw = parse_body
78
78
  return @raw.first['ModifyIndex'] if @options && @options[:modify_index]
79
79
  return decode_values if @options && @options[:decode_values]
80
- return convert_to_hash(return_value(return_nil_values, transformation, true)) if @options && @options[:convert_to_hash]
80
+ return convert_to_hash(return_value(return_nil_values, transformation)) if @options && @options[:convert_to_hash]
81
81
  return return_value(return_nil_values, transformation)
82
82
  when :wait
83
83
  index = raw.headers['x-consul-index']
@@ -148,20 +148,14 @@ module Diplomat
148
148
  end
149
149
 
150
150
  # Get the key/value(s) from the raw output
151
- # rubocop:disable PerceivedComplexity, MethodLength, CyclomaticComplexity, AbcSize
152
- def return_value(nil_values = false, transformation = nil, return_hash = false)
151
+ def return_value(nil_values = false, transformation = nil)
153
152
  @value = decode_values
154
153
  return @value if @value.first.is_a? String
155
- if @value.count == 1 && !return_hash
156
- @value = @value.first['Value']
157
- @value = transformation.call(@value) if transformation && !@value.nil?
158
- return @value
159
- else
160
- @value = @value.map do |el|
161
- el['Value'] = transformation.call(el['Value']) if transformation && !el['Value'].nil?
162
- { key: el['Key'], value: el['Value'] } if el['Value'] || nil_values
163
- end.compact
164
- end
154
+
155
+ @value = @value.map do |el|
156
+ el['Value'] = transformation.call(el['Value']) if transformation && !el['Value'].nil?
157
+ { key: el['Key'], value: el['Value'] } if el['Value'] || nil_values
158
+ end.compact
165
159
  end
166
160
  # rubocop:enable PerceivedComplexity, MethodLength, CyclomaticComplexity, AbcSize
167
161
 
@@ -1,3 +1,3 @@
1
1
  module Diplomat
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diplomat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hamelink
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-28 00:00:00.000000000 Z
12
+ date: 2017-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler