clientele 0.3.12 → 0.3.13

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: 8a9de556f76af020598d75acc6e88342b1883ff3
4
- data.tar.gz: 49ca10119b63bd8f6b2d8fdf193fa0feaac719aa
3
+ metadata.gz: dc552f54b5318617ee7a3ef13a17a6d77c9b2522
4
+ data.tar.gz: d4dbabbce83092be75b00ae04a74ae992887fb09
5
5
  SHA512:
6
- metadata.gz: 854171f71a536110e927c6d315e2c11d9f563c32fa1ef3e3606b2b164fa2a7ba173f2ba82790927192d2ab7028dfe8aebd1d28efbc8a30e38b99e928b317294f
7
- data.tar.gz: 48c490df9685c2499973ec329f2450bc381fd66b77c058456a366145f985c0b323f64fa58c4983f0b6123e69c1813bf4a100ee0508feb9b1bf221e4535114227
6
+ metadata.gz: fbada55602e3bc8ac17c88715403a8b36f37571f7ae23288f1c8210eb94382fc91744d0760914f92075922c7100eca2b742b8abce16336926567cec27b9d4ef6
7
+ data.tar.gz: 43b09d58a722ea64b61a15d69764325e0c9b3ca09d944eb52a48ffa988a60d72a0b653cf7cb84a845b313565f15a5d19e703d742e4db322d09021be06a978256
data/lib/clientele/api.rb CHANGED
@@ -16,7 +16,9 @@ module Clientele
16
16
  configure_with Configuration
17
17
 
18
18
  extend SingleForwardable
19
- def_delegator :configuration, :logger
19
+ extend Forwardable
20
+ def_single_delegator :configuration, :logger
21
+ def_instance_delegator self, :has_resource?
20
22
 
21
23
  class_attribute :resources, instance_predicate: false
22
24
  self.resources = Hashie::Rash.new
@@ -8,12 +8,13 @@ module Clientele
8
8
  attr_accessor :logger, :adapter, :headers, :hashify_content_type, :root_url, :follow_redirects, :redirect_limit
9
9
 
10
10
  def initialize
11
- self.logger = Logger.new($stdout)
12
- self.adapter = Faraday.default_adapter
13
- self.headers = {}
14
- self.hashify_content_type = /\bjson$/
15
- self.follow_redirects = true
16
- self.redirect_limit = 5
11
+ self.logger = Logger.new($stdout)
12
+ self.adapter = Faraday.default_adapter
13
+ self.headers = {}
14
+ self.hashify_content_type = /\bjson$/
15
+ self.follow_redirects = true
16
+ self.redirect_limit = 5
17
+ self.ensure_trailing_slash = true
17
18
  end
18
19
 
19
20
  end
@@ -81,7 +81,8 @@ module Clientele
81
81
  end
82
82
 
83
83
  def response
84
- @response ||= faraday_client.send(verb, ensure_trailing_slash(path)) do |request|
84
+ request_path = options[:ensure_trailing_slash] ? ensure_trailing_slash(path) : path
85
+ @response ||= faraday_client.send(verb, request_path) do |request|
85
86
  request.headers = options.fetch(:headers, {}).merge(headers)
86
87
  request.params = deep_camelize_keys(query)
87
88
  request.body = JSON.dump(deep_camelize_keys(body))
@@ -8,7 +8,7 @@ module Clientele
8
8
  module_function
9
9
 
10
10
  def merge_paths(*urls)
11
- ensure_trailing_slash urls.reject(&:blank?).join('/').sub(/(?<!:)\/+/, '/')
11
+ urls.reject(&:blank?).join('/').sub(/(?<!:)\/+/, '/')
12
12
  end
13
13
 
14
14
  def ensure_trailing_slash(url)
@@ -1,3 +1,3 @@
1
1
  module Clientele
2
- VERSION = "0.3.12"
2
+ VERSION = "0.3.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clientele
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Keele
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-03 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday