bridgetown_jam_comments 1.0.0 → 1.1.0

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: 894d5942a9afbe658793e21869e2a3eed94c2685908a376cd0902991bcc3ac3f
4
- data.tar.gz: eeba19e1e804ffeb385b4c81f30234bd0747a9e77fe9bd67696bfa6b73bcd266
3
+ metadata.gz: dc1ade04a92941a06edb3d035b4e463573169f3f9468d4b7c76e3115ca3f3e77
4
+ data.tar.gz: cc1954288fb499e01201c52986bed3dd160a4658d6a9e45eb43993839a8205ab
5
5
  SHA512:
6
- metadata.gz: 95df636b3a640187fc95f78c8c4670d61e36123402365ba2f5d38ff7a72bc95c3db88d2abe1404f08ba2f9a4b4d2e9de098d1c041ab5a7c49f687bd31a12492c
7
- data.tar.gz: c0778447aabc281da8a28f2d2cd31b0e8a65fca5f105723f08738e835a1be37c853cf4a5fc8e6ca5c4550ccceda5d5b5167e4c72c12068e9c3c3357d107da7d2
6
+ metadata.gz: 4319c02130d1354e17a9e5c2c13e2293e544268644208edbe9cffa966397d2df25ca568192c651993445c392dfad423e63510900ab8273c3d0087bfb67c3b736
7
+ data.tar.gz: 40d8972ac88a7096e99b2c18824998751ef44ca7e51b5d24d9e72e382d03c124f6bbf79900fad22bb6424f90d47ac8b0db0a1816da1b9f07e2916684ec8e62de
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./service"
4
- require_relative "./renderer"
5
- require_relative "./configuration"
3
+ require_relative "service"
4
+ require_relative "renderer"
5
+ require_relative "configuration"
6
6
 
7
7
  module JamComments
8
8
  class Builder < Bridgetown::Builder
@@ -23,5 +23,21 @@ module JamComments
23
23
  def environment
24
24
  config["environment"] || ENV["JAM_COMMENTS_ENVIRONMENT"] || ENV.fetch("BRIDGETOWN_ENV", nil)
25
25
  end
26
+
27
+ def copy
28
+ original_copy = config["copy"] || {}
29
+
30
+ {
31
+ copy_confirmation_message: original_copy["confirmation_message"],
32
+ copy_submit_button: original_copy["submit_button"],
33
+ copy_name_placeholder: original_copy["name_placeholder"],
34
+ copy_email_placeholder: original_copy["email_placeholder"],
35
+ copy_comment_placeholder: original_copy["comment_placeholder"],
36
+ copy_write_tab: original_copy["write_tab"],
37
+ copy_preview_tab: original_copy["preview_tab"],
38
+ copy_auth_button: original_copy["auth_button"],
39
+ copy_log_out_button: original_copy["log_out_button"],
40
+ }.compact
41
+ end
26
42
  end
27
43
  end
@@ -4,7 +4,7 @@ require "httparty"
4
4
 
5
5
  module JamComments
6
6
  class Service
7
- attr_reader :base_url, :tz, :environment, :domain, :api_key, :client
7
+ attr_reader :base_url, :tz, :environment, :domain, :api_key, :client, :copy
8
8
 
9
9
  def initialize(
10
10
  domain:,
@@ -12,9 +12,11 @@ module JamComments
12
12
  base_url: nil,
13
13
  environment: nil,
14
14
  tz: nil,
15
+ copy: {},
15
16
  client: HTTParty
16
17
  )
17
18
  @tz = tz
19
+ @copy = copy
18
20
  @client = client
19
21
  @domain = domain
20
22
  @api_key = api_key
@@ -24,12 +26,7 @@ module JamComments
24
26
 
25
27
  def fetch(path:)
26
28
  options = {
27
- query: {
28
- path: formatted_path(path),
29
- domain: domain,
30
- stub: stub_value,
31
- tz: tz,
32
- },
29
+ query: request_query_params(path),
33
30
  headers: {
34
31
  Authorization: "Bearer #{api_key}",
35
32
  Accept: "application/json",
@@ -42,6 +39,15 @@ module JamComments
42
39
 
43
40
  private
44
41
 
42
+ def request_query_params(path)
43
+ {
44
+ path: formatted_path(path),
45
+ domain: domain,
46
+ stub: stub_value,
47
+ tz: tz,
48
+ }.merge(copy)
49
+ end
50
+
45
51
  def send_request(options)
46
52
  response = client.get(endpoint, options)
47
53
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JamComments
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bridgetown"
4
- require_relative "./bridgetown_jam_comments/builder"
4
+ require_relative "bridgetown_jam_comments/builder"
5
5
 
6
6
  Bridgetown.initializer :bridgetown_jam_comments do |config, domain: nil, api_key: nil, base_url: nil, environment: nil|
7
7
  config.bridgetown_jam_comments ||= {}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown_jam_comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacArthur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-13 00:00:00.000000000 Z
11
+ date: 2024-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown