pupper 0.1.13 → 0.2.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: 29be9877392eb7b418e0471bb3e589e62d84da40
4
- data.tar.gz: 15a0e0fd07d4bc4e3d96e4e5969b669e48b84482
3
+ metadata.gz: d34dc2ba64de639036eb23d7bedb6e04ce1d9f12
4
+ data.tar.gz: d9e8f140ffc3148c54cac9b070ff09f651ca16ec
5
5
  SHA512:
6
- metadata.gz: c21bfda8117276e99c317c894dbf654d1bf5739b5efed282778fff0c7ad8188ea68f57feb60401a079c4e84762103220f5d1ac7c825b60b527582168508072c1
7
- data.tar.gz: d19488aaa84819d780dac2f83d762b1a52e5f67154f875ae615b2159d605c8d5f0999ac7649d57ea1193183fb13dc6c349119344c6752702114211594ee6e9f1
6
+ metadata.gz: 9b59fa6e816dddca58b812fc823a642876e09f10e2d4a5dd9091a1a871194c6fe95f4dac494d3e7167d529412e399df4dd5a65812b85732ac86a3738974069a4
7
+ data.tar.gz: b70f8f26c85643ba8c75bd142760c574e45596c8457ff5d19a3a63638fa1a50f9ef2228a0423e82232979c08298c1f631c9ccf5abc7a1afa6acfb6f52dc068e1
data/lib/pupper.rb CHANGED
@@ -24,12 +24,18 @@ module Pupper
24
24
  end
25
25
 
26
26
  class Config
27
- attr_accessor :audit_with, :user_agent
27
+ attr_accessor :audit_with, :user_agent, :ssl, :logging
28
28
  thread_mattr_accessor :current_user
29
29
 
30
30
  def initialize
31
31
  @audit_with = :audit_log
32
32
  @user_agent = "pupper (v: #{Pupper::VERSION})"
33
+ @ssl = {}
34
+ @logging = false
35
+ end
36
+
37
+ def logging?
38
+ @logging
33
39
  end
34
40
  end
35
41
  end
@@ -7,12 +7,16 @@ module Pupper
7
7
 
8
8
  attr_reader :client, :model
9
9
 
10
- delegate :base_url, to: :class
10
+ delegate :base_url, :headers, to: :class
11
11
 
12
12
  class << self
13
13
  # Sets the base URL the API client will call
14
14
  # @return [String] the URL (plus - optionally - a path)
15
- attr_writer :base_url
15
+ attr_writer :base_url, :headers
16
+
17
+ def headers
18
+ @headers ||= {}
19
+ end
16
20
 
17
21
  def base_url
18
22
  if @base_url.nil?
@@ -38,13 +42,13 @@ module Pupper
38
42
  end
39
43
 
40
44
  def initialize
41
- @client = Faraday.new(base_url, ssl: { verify: Rails.env.production? }) do |builder|
45
+ @client = Faraday.new(base_url, ssl: Pupper.config.ssl) do |builder|
42
46
  builder.request :json
43
47
  builder.use Pupper::ParseJson
44
- builder.response :logger if Rails.env.development?
48
+ builder.response :logger if Pupper.config.logging?
45
49
  builder.response :raise_error
46
50
  builder.adapter :typhoeus
47
- builder.headers['User-Agent'] = Pupper.config.user_agent
51
+ builder.headers = headers.merge!('User-Agent' => Pupper.config.user_agent)
48
52
  end
49
53
  end
50
54
 
@@ -1,3 +1,3 @@
1
1
  module Pupper
2
- VERSION = "0.1.13"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pupper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Machin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-21 00:00:00.000000000 Z
11
+ date: 2017-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler