zazu-ruby 0.1.3 → 0.2.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: b25350e3bf7b25828a45c347c24e84173bf5c567285cd59b5e252ca78fd20714
4
- data.tar.gz: 7186167ea9a03991516ae1236d6be7ec10a7bcae254d7f82846643fe0ea41bc0
3
+ metadata.gz: 620203d0346c1431c20e9cfad3069bf979422714bef0e742aa8e6842da1e1ef3
4
+ data.tar.gz: 2853e240e0ef39bf83ff1c56bc19baafee48fdf6e52ce8024d2a6eb3c01b740b
5
5
  SHA512:
6
- metadata.gz: 37930d69383fe71b3910062fa542cccdc59c0d945f7df514e744bf55d995cf6921e6869a3cb2541d85467d8241be5cf55d718d55a88fd9c4325d295a1c6c9d4a
7
- data.tar.gz: 38b875fc3bd5dae72da127fc1f7d6b8dd360c2b70257a632b63ea2c0fa96e1fe62ff33d8c8214b1e16314bea7f21842b7f0c8651383b6118257fbbc288683c0f
6
+ metadata.gz: e0cb5ff54711f427cea94cf92f89e2e8ac8e238296b918bcdbf840403cb12e7d967a782278bc65e4499c4bf402645bdb34a8f7605e4df66734459e77503ed9dd
7
+ data.tar.gz: 8cdb8f94525b4de4174d48f8d3e95a3ac13e558c2c9acca7626c32eaaf29d08dba4353850f20cf59a3cc1b755bc3de24bc797a98c6cf7abe0af94bd1917c7081
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - `Zazu::Resources::CheckoutSessions` — `create` and `get` for one-off
13
+ hosted checkout sessions. Status enum: `open`, `processing`,
14
+ `complete`, `expired` (read-only — no API to mutate). No list, no
15
+ update, no delete; sessions are addressed by their `cs_…` id.
16
+
10
17
  ## [0.1.0]
11
18
 
12
19
  Initial release.
data/README.md CHANGED
@@ -69,6 +69,16 @@ zazu.payment_links.create(
69
69
  )
70
70
  zazu.payment_links.cancel("01a0...")
71
71
 
72
+ zazu.checkout_sessions.create(
73
+ account_id: "019dde7d-...",
74
+ amount: "1500.00",
75
+ success_url: "https://merchant.example.com/success?session_id={CHECKOUT_SESSION_ID}",
76
+ cancel_url: "https://merchant.example.com/cancel",
77
+ customer_email: "buyer@example.com",
78
+ metadata: { order_id: "ORD-123" }
79
+ )
80
+ zazu.checkout_sessions.get("cs_...")
81
+
72
82
  zazu.webhook_endpoints.list
73
83
  zazu.webhook_endpoints.create(
74
84
  url: "https://example.com/webhooks/zazu",
data/lib/zazu/client.rb CHANGED
@@ -45,6 +45,10 @@ module Zazu
45
45
  @accounts ||= Resources::Accounts.new(self)
46
46
  end
47
47
 
48
+ def checkout_sessions
49
+ @checkout_sessions ||= Resources::CheckoutSessions.new(self)
50
+ end
51
+
48
52
  def customers
49
53
  @customers ||= Resources::Customers.new(self)
50
54
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zazu
4
+ module Resources
5
+ # One-off hosted checkout sessions. Pre-API there's no list,
6
+ # update, or delete — sessions are created and inspected by id.
7
+ # State (`open`, `processing`, `complete`, `expired`) transitions
8
+ # are read-only from the SDK's perspective.
9
+ class CheckoutSessions < Base
10
+ # GET /api/checkout_sessions/:id
11
+ def get(id)
12
+ http_get(encode_path("api/checkout_sessions", id))
13
+ end
14
+
15
+ # POST /api/checkout_sessions
16
+ #
17
+ # @param attributes [Hash] checkout-session attributes — see API docs.
18
+ # Required: account_id, amount, success_url.
19
+ # Optional: metadata, customer_email, cancel_url, description, expires_at.
20
+ def create(**attributes)
21
+ http_post("api/checkout_sessions", body: attributes)
22
+ end
23
+ end
24
+ end
25
+ end
data/lib/zazu/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zazu
4
- VERSION = "0.1.3"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/zazu.rb CHANGED
@@ -22,6 +22,7 @@ require_relative "zazu/response"
22
22
  require_relative "zazu/page"
23
23
  require_relative "zazu/resources/base"
24
24
  require_relative "zazu/resources/accounts"
25
+ require_relative "zazu/resources/checkout_sessions"
25
26
  require_relative "zazu/resources/customers"
26
27
  require_relative "zazu/resources/entity"
27
28
  require_relative "zazu/resources/invoices"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zazu-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zazu
@@ -69,6 +69,7 @@ files:
69
69
  - lib/zazu/page.rb
70
70
  - lib/zazu/resources/accounts.rb
71
71
  - lib/zazu/resources/base.rb
72
+ - lib/zazu/resources/checkout_sessions.rb
72
73
  - lib/zazu/resources/customers.rb
73
74
  - lib/zazu/resources/entity.rb
74
75
  - lib/zazu/resources/invoices.rb