jekyll_jam_comments 2.0.0 → 2.1.1
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: cb5c79b3a2fdc6f8e293049a1f38d500d01f32ea8113959af398f47828ba8122
|
4
|
+
data.tar.gz: 63fb4c2f44d7b037a8076e16c45f42e821bbe828d1e46c99aa0cf098ac04cde7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 250d7012e9c982852ad1e82497c5878eb4413146130424a87637db5a2e8b145514f5ac396f2a0191f3358770c3ae1ca2df836fbbb0b2723a06cd220a9073cc6b
|
7
|
+
data.tar.gz: 7450e7077ada0a66193147b4ea0549b6e2e147fab1d9b873c9b63b77a515edb93b22bc78ead0c91acb6cce4598d3792e8aefceffffd6c3902d04140f1801f1b1
|
@@ -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
|
@@ -5,7 +5,7 @@ require "httparty"
|
|
5
5
|
module Jekyll
|
6
6
|
module JamComments
|
7
7
|
class Service
|
8
|
-
attr_reader :base_url, :environment, :domain, :api_key, :client, :tz
|
8
|
+
attr_reader :base_url, :environment, :domain, :api_key, :client, :tz, :copy
|
9
9
|
|
10
10
|
def initialize(
|
11
11
|
domain:,
|
@@ -13,9 +13,11 @@ module Jekyll
|
|
13
13
|
base_url: nil,
|
14
14
|
environment: nil,
|
15
15
|
tz: nil,
|
16
|
+
copy: {},
|
16
17
|
client: HTTParty
|
17
18
|
)
|
18
19
|
@tz = tz
|
20
|
+
@copy = copy
|
19
21
|
@client = client
|
20
22
|
@domain = domain
|
21
23
|
@api_key = api_key
|
@@ -25,12 +27,7 @@ module Jekyll
|
|
25
27
|
|
26
28
|
def fetch(path:)
|
27
29
|
options = {
|
28
|
-
:query =>
|
29
|
-
:path => formatted_path(path),
|
30
|
-
:domain => domain,
|
31
|
-
:stub => stub_value,
|
32
|
-
:tz => tz,
|
33
|
-
},
|
30
|
+
:query => request_query_params(path),
|
34
31
|
:headers => {
|
35
32
|
:Authorization => "Bearer #{api_key}",
|
36
33
|
:Accept => "application/json",
|
@@ -43,11 +40,22 @@ module Jekyll
|
|
43
40
|
|
44
41
|
private
|
45
42
|
|
43
|
+
def request_query_params(path)
|
44
|
+
{
|
45
|
+
:path => formatted_path(path),
|
46
|
+
:domain => domain,
|
47
|
+
:stub => stub_value,
|
48
|
+
:tz => tz,
|
49
|
+
}.merge(copy)
|
50
|
+
end
|
51
|
+
|
46
52
|
def send_request(options)
|
47
53
|
response = client.get(endpoint, options)
|
48
54
|
|
55
|
+
raise "JamComments request is invalid: #{response["message"]}" if response.code == 422
|
56
|
+
|
49
57
|
if response.code == 401
|
50
|
-
raise "
|
58
|
+
raise "Unauthorized! It looks like your credentials for JamComments are incorrect."
|
51
59
|
end
|
52
60
|
|
53
61
|
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.1
|
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
|