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 +4 -4
- data/lib/pupper.rb +7 -1
- data/lib/pupper/backend.rb +9 -5
- data/lib/pupper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d34dc2ba64de639036eb23d7bedb6e04ce1d9f12
|
4
|
+
data.tar.gz: d9e8f140ffc3148c54cac9b070ff09f651ca16ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/pupper/backend.rb
CHANGED
@@ -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:
|
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
|
48
|
+
builder.response :logger if Pupper.config.logging?
|
45
49
|
builder.response :raise_error
|
46
50
|
builder.adapter :typhoeus
|
47
|
-
builder.headers
|
51
|
+
builder.headers = headers.merge!('User-Agent' => Pupper.config.user_agent)
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
data/lib/pupper/version.rb
CHANGED
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.
|
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
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|