footrest 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/footrest/client.rb +19 -6
- data/lib/footrest/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c1b2c4019f2a8af6e3ee1c001e93aebe66a3cb26215dabc42d4320f1acee55b8
|
|
4
|
+
data.tar.gz: d508b92955ea388de8ed97771a1d721bfb5954f712333049e4b49fee10262c9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02053c315c359b5e49f3e2ff398b40e9aef316fc4b8e51dddfcfdf79c86a813fbe5053e3581463d46bf947810b3dcd1f023561a65d88f50a23252eac2d4150fa
|
|
7
|
+
data.tar.gz: dea36a4ff0aa9bde0bc4ad78a4354ab2c82aa10289bc96ce9a5863264dbb4ceece7e5a35b371ce13a1c6fc32a83aef4350b6e2885fdd642684516df3b44ff8b3
|
data/lib/footrest/client.rb
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
require 'footrest/connection'
|
|
2
2
|
require 'footrest/request'
|
|
3
|
-
require 'active_support/
|
|
3
|
+
require 'active_support/ordered_options'
|
|
4
4
|
|
|
5
5
|
module Footrest
|
|
6
6
|
class Client
|
|
7
7
|
include Footrest::Connection
|
|
8
8
|
include Footrest::Request
|
|
9
|
-
include ActiveSupport::Configurable
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
# Well-known options surfaced as reader/writer methods (e.g. client.token).
|
|
11
|
+
# Any other option remains reachable through #config (e.g. config[:domain]).
|
|
12
|
+
CONFIG_ACCESSORS = %i[token prefix logging].freeze
|
|
14
13
|
|
|
15
14
|
def initialize(options={}, &block)
|
|
16
|
-
|
|
15
|
+
config.merge!(options)
|
|
17
16
|
yield self if block_given?
|
|
18
17
|
set_connection(config)
|
|
19
18
|
end
|
|
20
19
|
|
|
20
|
+
# Per-instance options bag. ActiveSupport::OrderedOptions supports both
|
|
21
|
+
# hash-style (config[:token]) and method-style (config.token) access, the
|
|
22
|
+
# same surface ActiveSupport::Configurable's config object provided. This
|
|
23
|
+
# replaces `include ActiveSupport::Configurable`, which activesupport
|
|
24
|
+
# deprecates in 8.1 and removes in 8.2.
|
|
25
|
+
def config
|
|
26
|
+
@config ||= ActiveSupport::OrderedOptions.new
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
CONFIG_ACCESSORS.each do |name|
|
|
30
|
+
define_method(name) { config[name] }
|
|
31
|
+
define_method("#{name}=") { |value| config[name] = value }
|
|
32
|
+
end
|
|
33
|
+
|
|
21
34
|
def connection(&block)
|
|
22
35
|
@connection.tap do |conn|
|
|
23
36
|
yield conn if block_given?
|
data/lib/footrest/version.rb
CHANGED