jekyll_jam_comments 2.0.0 → 2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66b4386ab717058c9da7d050c8a38e559a87800fc115e1f2e970b8547f8a255f
|
4
|
+
data.tar.gz: a681c5bc06fac414da48b981abd8e3db127a2690d56290f765b5659e2bf3a42b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44633d27ca90e67c49d10cf10d462450324693f8381d415c4ed39ee7cf5dd7d7760d9f8bb1795f7aefe9b5d8cddc19f200614f1761d456bcd4ba80d98b472045
|
7
|
+
data.tar.gz: cc334027a5be28af733519e7d318f6fddce558edc07dbaa912e5c279867e91b49b6e517ae9d91acea7a668fd869a3a7eacd32d91c1822bad0b91cda4ae2d0597
|
@@ -22,6 +22,22 @@ module Jekyll
|
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
25
|
+
def copy
|
26
|
+
original_copy = configuration["copy"] || {}
|
27
|
+
|
28
|
+
{
|
29
|
+
:copy_confirmation_message => original_copy["confirmation_message"],
|
30
|
+
:copy_submit_button => original_copy["submit_button"],
|
31
|
+
:copy_name_placeholder => original_copy["name_placeholder"],
|
32
|
+
:copy_email_placeholder => original_copy["email_placeholder"],
|
33
|
+
:copy_comment_placeholder => original_copy["comment_placeholder"],
|
34
|
+
:copy_write_tab => original_copy["write_tab"],
|
35
|
+
:copy_preview_tab => original_copy["preview_tab"],
|
36
|
+
:copy_auth_button => original_copy["auth_button"],
|
37
|
+
:copy_log_out_button => original_copy["log_out_button"],
|
38
|
+
}.compact! { |_key, value| value.nil? }
|
39
|
+
end
|
40
|
+
|
25
41
|
def configuration
|
26
42
|
Jekyll.configuration({})["jam_comments"] || {}
|
27
43
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "httparty"
|
4
|
+
require "pry"
|
4
5
|
|
5
6
|
module Jekyll
|
6
7
|
module JamComments
|
7
8
|
class Service
|
8
|
-
attr_reader :base_url, :environment, :domain, :api_key, :client, :tz
|
9
|
+
attr_reader :base_url, :environment, :domain, :api_key, :client, :tz, :copy
|
9
10
|
|
10
11
|
def initialize(
|
11
12
|
domain:,
|
@@ -13,9 +14,11 @@ module Jekyll
|
|
13
14
|
base_url: nil,
|
14
15
|
environment: nil,
|
15
16
|
tz: nil,
|
17
|
+
copy: {},
|
16
18
|
client: HTTParty
|
17
19
|
)
|
18
20
|
@tz = tz
|
21
|
+
@copy = copy
|
19
22
|
@client = client
|
20
23
|
@domain = domain
|
21
24
|
@api_key = api_key
|
@@ -25,12 +28,7 @@ module Jekyll
|
|
25
28
|
|
26
29
|
def fetch(path:)
|
27
30
|
options = {
|
28
|
-
:query =>
|
29
|
-
:path => formatted_path(path),
|
30
|
-
:domain => domain,
|
31
|
-
:stub => stub_value,
|
32
|
-
:tz => tz,
|
33
|
-
},
|
31
|
+
:query => request_query_params(path),
|
34
32
|
:headers => {
|
35
33
|
:Authorization => "Bearer #{api_key}",
|
36
34
|
:Accept => "application/json",
|
@@ -43,11 +41,22 @@ module Jekyll
|
|
43
41
|
|
44
42
|
private
|
45
43
|
|
44
|
+
def request_query_params(path)
|
45
|
+
{
|
46
|
+
:path => formatted_path(path),
|
47
|
+
:domain => domain,
|
48
|
+
:stub => stub_value,
|
49
|
+
:tz => tz,
|
50
|
+
}.merge(copy)
|
51
|
+
end
|
52
|
+
|
46
53
|
def send_request(options)
|
47
54
|
response = client.get(endpoint, options)
|
48
55
|
|
56
|
+
raise "JamComments request is invalid: #{response["message"]}" if response.code == 422
|
57
|
+
|
49
58
|
if response.code == 401
|
50
|
-
raise "
|
59
|
+
raise "Unauthorized! It looks like your credentials for JamComments are incorrect."
|
51
60
|
end
|
52
61
|
|
53
62
|
if response.code != 200
|
data/lib/jekyll_jam_comments.rb
CHANGED
@@ -32,7 +32,8 @@ module Jekyll
|
|
32
32
|
:domain => Jekyll::JamComments::Configuration.domain,
|
33
33
|
:api_key => Jekyll::JamComments::Configuration.api_key,
|
34
34
|
:base_url => Jekyll::JamComments::Configuration.base_url,
|
35
|
-
:environment => Jekyll::JamComments::Configuration.environment
|
35
|
+
:environment => Jekyll::JamComments::Configuration.environment,
|
36
|
+
:copy => Jekyll::JamComments::Configuration.copy
|
36
37
|
)
|
37
38
|
end
|
38
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_jam_comments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.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: httparty
|