postwave 0.1.1 → 0.1.2
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 +42 -0
- data/lib/postwave/client.rb +12 -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: b4511f2e9288a14247515ff919efbcdfaf4aef9f7e6ae5d7de5c207795307d73
|
4
|
+
data.tar.gz: 6997bdd3f519948e40fbf701d792bc761e0d563f23bd171b47cf35b6ba652fb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3248a5fdd235809dee5026f53ecf5dd637c96a3e69e6acff19d91617a6632ae61e49989a79dd16f91258b21de14d54ed748b31af5dbb2974d3e0c97d6f65accf
|
7
|
+
data.tar.gz: 74bd0b0f980cb534b63c06a3374e4d1e807c68113cf18cc56f1bf6aa601adb4b4c2ae0c5bb55103ed2d2a496064b1b730435933dda937eb2aa446a92bf3279fc
|
data/README.md
CHANGED
@@ -179,12 +179,54 @@ tag = postwave_clinet.tag("tag1")
|
|
179
179
|
|
180
180
|
### Get Text For An RSS Feed
|
181
181
|
|
182
|
+
This will give you the text for an Atom feed of your blog.
|
183
|
+
|
182
184
|
```ruby
|
183
185
|
rss = postwave_client.rss
|
184
186
|
|
185
187
|
# "<?xml version="1.0" encoding="utf-8"?>..."
|
186
188
|
```
|
187
189
|
|
190
|
+
### Get Pagination Information
|
191
|
+
|
192
|
+
This will give you a `Postwave::Pagination` object that you can use to build pagination in your Postwave powered site.
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
pagination = postwave_client.pagination(current_page: 3, per_page: 10)
|
196
|
+
|
197
|
+
# <Postwave::Pagination current_page=3, prev_page=2, next_page=4, total_pages=20>
|
198
|
+
```
|
199
|
+
|
200
|
+
### Get An Archive of Posts
|
201
|
+
|
202
|
+
This returns a Hash with year as the key and an ordered array of PostStubs
|
203
|
+
|
204
|
+
```ruby
|
205
|
+
archive = postwave_client.archive
|
206
|
+
|
207
|
+
# {
|
208
|
+
# 2025 =>
|
209
|
+
# [<Postwave::PostStub title="My Great Post"...>, <PostwaveStub...>, ...],
|
210
|
+
# 2024 =>
|
211
|
+
# [<PostwaveStub...>, <PostwaveStub...>]
|
212
|
+
# }
|
213
|
+
```
|
214
|
+
|
215
|
+
You can pass in a `by: "month"` parameter to further subdivide the archive by month.
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
archive = postwave_client.archive(by: "month")
|
219
|
+
|
220
|
+
# {
|
221
|
+
# 2025 =>
|
222
|
+
# 1 => [<PostwaveStub...>, <PostwaveStub...>],
|
223
|
+
# 2 => [<PostwaveStub...>, <PostwaveStub...>]
|
224
|
+
# 2024 =>
|
225
|
+
# 11 => [<PostwaveStub...>, <PostwaveStub...>],
|
226
|
+
# 12 => [<PostwaveStub...>, <PostwaveStub...>]
|
227
|
+
# }
|
228
|
+
```
|
229
|
+
|
188
230
|
## Run Tests
|
189
231
|
|
190
232
|
```
|
data/lib/postwave/client.rb
CHANGED
@@ -30,6 +30,18 @@ module Postwave
|
|
30
30
|
working_index[offset, count]
|
31
31
|
end
|
32
32
|
|
33
|
+
def archive(by: "year")
|
34
|
+
working_index = @full_index || get_full_index
|
35
|
+
post_hash = posts.group_by { |post| post.date.year }.transform_values { |posts| posts.sort_by(&:date) }
|
36
|
+
if by == "month"
|
37
|
+
post_hash.each do |key, value|
|
38
|
+
post_hash[key] = value.group_by { |post| post.date.month }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
post_hash
|
43
|
+
end
|
44
|
+
|
33
45
|
# returns: a post - Postwave::Post
|
34
46
|
def post(slug)
|
35
47
|
post_file_path = Dir["#{File.join(@blog_root, POSTS_DIR)}/*#{slug}.md"].first
|
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.2
|
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-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|