postwave 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +4 -0
- data/lib/postwave/client.rb +11 -0
- data/lib/postwave/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee98e42b5e3436991cfb73764252e21db5ed18c9bfd2760045ee268250d1c79a
|
4
|
+
data.tar.gz: 63e682e894bb2838ee0a46393b75b600ad83197a1fc4b9735b2a7e77897dafe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7df94a047a4875a2f317ed26f0c30bec4f1a6178967ab721280cb5c40fdb41e35f790537ccbf40a151c9fcddf61862adad0c058ffc04f5dab944ccec48b58652
|
7
|
+
data.tar.gz: 182ae4013b7064810db4f5358d5202100ef8ce3563c79edcfc0af121f4f95f622f9641f5b9b53563916deb8c385123697b1443260ef1377b0a66d695792cc1be
|
data/README.md
CHANGED
@@ -121,6 +121,10 @@ post = postwave_client.post("my-great-post")
|
|
121
121
|
|
122
122
|
puts post.title
|
123
123
|
# "My Great Post"
|
124
|
+
puts post.body
|
125
|
+
# "bla bla bla..."
|
126
|
+
puts post.body_html # uses Redcarpt to convert body Markdown to HTML
|
127
|
+
# "<p>bla bla bla...</p>"
|
124
128
|
```
|
125
129
|
|
126
130
|
### Get a Collection of Posts
|
data/lib/postwave/client.rb
CHANGED
@@ -8,6 +8,7 @@ require "yaml"
|
|
8
8
|
|
9
9
|
Postwave::PostStub = Struct.new(:date, :title, :slug)
|
10
10
|
Postwave::Tag = Struct.new(:name, :count, :post_slugs)
|
11
|
+
Postwave::Pagination = Struct.new(:current_page, :prev_page, :next_page, :total_pages)
|
11
12
|
|
12
13
|
module Postwave
|
13
14
|
class Client
|
@@ -69,6 +70,16 @@ module Postwave
|
|
69
70
|
rss.read
|
70
71
|
end
|
71
72
|
|
73
|
+
# reuturns: a Pagination Struct - <struct Pagination current_page=3, prev_page=2, next_page=4, total_pages=20>
|
74
|
+
def pagination(current_page: 1, per_page: 10)
|
75
|
+
summary = @blog_summary || get_summary
|
76
|
+
total_pages = (summary[:post_count].to_f / per_page).ceil
|
77
|
+
in_bound_current = current_page.clamp(1, total_pages)
|
78
|
+
prev_page = in_bound_current > 1 ? in_bound_current - 1 : nil
|
79
|
+
next_page = in_bound_current < total_pages ? in_bound_current + 1 : nil
|
80
|
+
Postwave::Pagination.new(in_bound_current, prev_page, next_page, total_pages)
|
81
|
+
end
|
82
|
+
|
72
83
|
private
|
73
84
|
|
74
85
|
def is_valid_config?(config_path)
|
data/lib/postwave/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postwave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Schwantes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|