bridgetown_jam_comments 0.2.0 → 1.1.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc1ade04a92941a06edb3d035b4e463573169f3f9468d4b7c76e3115ca3f3e77
|
4
|
+
data.tar.gz: cc1954288fb499e01201c52986bed3dd160a4658d6a9e45eb43993839a8205ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4319c02130d1354e17a9e5c2c13e2293e544268644208edbe9cffa966397d2df25ca568192c651993445c392dfad423e63510900ab8273c3d0087bfb67c3b736
|
7
|
+
data.tar.gz: 40d8972ac88a7096e99b2c18824998751ef44ca7e51b5d24d9e72e382d03c124f6bbf79900fad22bb6424f90d47ac8b0db0a1816da1b9f07e2916684ec8e62de
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "
|
4
|
-
require_relative "
|
5
|
-
require_relative "
|
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
|
|
@@ -59,7 +65,7 @@ module JamComments
|
|
59
65
|
end
|
60
66
|
|
61
67
|
def endpoint
|
62
|
-
"#{base_url}/api/
|
68
|
+
"#{base_url}/api/v3/markup"
|
63
69
|
end
|
64
70
|
|
65
71
|
def formatted_path(path)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bridgetown"
|
4
|
-
require_relative "
|
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:
|
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:
|
11
|
+
date: 2024-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bridgetown
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
148
|
+
rubygems_version: 3.3.26
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: A Bridgetown plugin for setting up JamComments in a Bridgetown site.
|