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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3659ecd8d7d5b7d1fdfaddb0b8538b86414e34687febec04f29c3352dff8d6c2
4
- data.tar.gz: f877ba937e8361518ca4a0c16f5d3ae77dfb101ac94becd0e2f2c3ae5f01abf4
3
+ metadata.gz: ee98e42b5e3436991cfb73764252e21db5ed18c9bfd2760045ee268250d1c79a
4
+ data.tar.gz: 63e682e894bb2838ee0a46393b75b600ad83197a1fc4b9735b2a7e77897dafe8
5
5
  SHA512:
6
- metadata.gz: a866429e4ad00e427b8302527e4eafcd488d16b938b51d12f370104d9a8dc0abdec1f5b868f62c0afb7b10ac162a120bbe2494d6b4347f521c9c6f35cf9c00cd
7
- data.tar.gz: 89575f81e742ca2bcd40d14c6e54ed3618daf4ad8434720ed65b6cdd4350e2189ba0721265351d62d565c49c9ac8c9a4686e96e93eabc358e29984a66999f3c1
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
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Postwave
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-01-17 00:00:00.000000000 Z
11
+ date: 2025-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet