opengraphplus 0.1.10 → 0.1.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d5e0af7ba91d92d1f9c20380bd19c0d684eb68e65fb7f90bfdb803b051c3d4a
4
- data.tar.gz: 4bc63ce1ff20de87a5101edea02ffa931875a8231bed0047cc90ee69cede2a6f
3
+ metadata.gz: ccee4b54a3e8c28fa2c495ed9aec3f00c8ac772956454e515cfa914f08991c3f
4
+ data.tar.gz: 4bc72536524a668219f58afd5fde7e4108458c026f1604a85cb45e29d889bd99
5
5
  SHA512:
6
- metadata.gz: 5f4d532d192695beb6fd9565e3cf8a12e5e478cb72fdebc7467a26122810eeedf5d75fd9bee5e78cbd74f8879de040ccae1d2c4352ca099308a311f6cbe99ee9
7
- data.tar.gz: b238b9d0ac0aff9bf41164d8d9b9a8b882557c6e57f57bd1d2230b36d03a8ea6a20ab8c0d9302a828c6083141f9d6fa9b8b2d39a66b01306f2d42ab74af4c9cb
6
+ metadata.gz: 6eb2e090b249de41cd61a88afbb3aaf5a144b73c5a4f66958b9d5f6a3142a4d7370bd7af502df67037f2cbae1a451f86acc257d7f7ef065b6f8da12d95eb3168
7
+ data.tar.gz: d1e8d614f9d047acb2afd2e9481e8b692a3742a7ddde4ac389b731e69df0fb656e9167d765b406d40dc0eaa19b36b08fabd30f99d07b7cdedd2814c749ceae1e
@@ -2,8 +2,13 @@
2
2
 
3
3
  module OpenGraphPlus
4
4
  class Configuration
5
+ DEFAULT_URL = "https://opengraphplus.com"
6
+
7
+ attr_accessor :url
8
+
5
9
  def initialize
6
10
  @api_key = nil
11
+ @url = DEFAULT_URL
7
12
  end
8
13
 
9
14
  def api_key
@@ -5,26 +5,25 @@ require "uri"
5
5
  module OpenGraphPlus
6
6
  module Signature
7
7
  class URL
8
- DEFAULT_BASE_URL = "https://opengraphplus.com"
8
+ attr_reader :base
9
+ alias :base_url :base
9
10
 
10
- attr_reader :base_uri
11
-
12
- def initialize(base_url: nil)
13
- @base_uri = URI.parse(base_url || ENV.fetch("OGPLUS_URL", DEFAULT_BASE_URL))
11
+ def initialize(url: OpenGraphPlus.configuration.url)
12
+ @base = URI.parse(url)
14
13
  end
15
14
 
16
15
  def signed_path(prefix, api_key)
17
- SignedPath.new(prefix:, api_key:, base_uri:)
16
+ SignedPath.new(prefix:, api_key:, base_url:)
18
17
  end
19
18
  end
20
19
 
21
20
  class SignedPath
22
- attr_reader :prefix, :api_key, :base_uri
21
+ attr_reader :prefix, :api_key, :base_url
23
22
 
24
- def initialize(prefix:, api_key:, base_uri:)
23
+ def initialize(prefix:, api_key:, base_url:)
25
24
  @prefix = prefix
26
25
  @api_key = api_key
27
- @base_uri = base_uri
26
+ @base_url = base_url
28
27
  end
29
28
 
30
29
  def generator
@@ -36,7 +35,7 @@ module OpenGraphPlus
36
35
  path_and_query = params.empty? ? signed_path : "#{signed_path}?#{URI.encode_www_form(params)}"
37
36
  signature = generator.generate(path_and_query)
38
37
 
39
- base_uri.dup.tap do |uri|
38
+ base_url.dup.tap do |uri|
40
39
  uri.path = File.join(prefix, signature, *segments.map(&:to_s))
41
40
  uri.query = URI.encode_www_form(params) unless params.empty?
42
41
  end.to_s
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenGraphPlus
4
- VERSION = "0.1.10"
4
+ VERSION = "0.1.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opengraphplus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler