cloudflare-ruby 0.3.0 → 0.4.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: 230de80c474a3f8441f60687160aba0f2cd53c5db2d9465498866994150cc60f
4
- data.tar.gz: 470768dc30305293361258880a74be07ea42832449ec4a77cae0079d42ca3cbc
3
+ metadata.gz: faf59fad7249fb09b116b307b5446a26381af6f30aca99d9b737a750ee05f9a6
4
+ data.tar.gz: cfdc5d7177c63a315ae3270eb730a9ac7089842191ed3728bca90aea621c859f
5
5
  SHA512:
6
- metadata.gz: 3416c0f5b271e376182525b183324d5ec7e0c11e5437f13194a75f35265c8463ac6d843414386e4fb1954966c340515f6eee2540e10b67bec1d6b50eae98574b
7
- data.tar.gz: 7c2d7a9a594d06f674af34d26cf9a9570da463ac81e817aa56738d2a0332760c0116550c3adf68b1616cd019f33b2e9ccd24dbcf8ab7e414ef3e222d57e5e68d
6
+ metadata.gz: a11f83675dbb47f4991c8cd6802ff2fc12ea92fc6e869498a68e1ad0ca5c39021793f3a8cf4bf162d60dc6ae7aa8677fa54e32cc9cda20e0821d09ec4adc6a95
7
+ data.tar.gz: 966022305b13974079cf11402ada92210540c77fbe982dc8412a5e596f865f7c3e7ee7b16a13befca10f6c1d1ed83009480b78828ca2590d6164c4a0cf9b4972
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0
4
+
5
+ - **`App.current`** — convenience that returns the App matching
6
+ `Cloudflare::RealtimeKit.app_id` (or nil if no match). Useful for
7
+ verifying the configured app_id resolves to a real app and for
8
+ inspecting its name / created_at. Implemented over `App.all` +
9
+ client-side filter; upstream doesn't expose `GET /apps/{id}`.
10
+
3
11
  ## 0.3.0
4
12
 
5
13
  - **Per-product API tokens.** Set `Cloudflare::RealtimeKit.api_token` to
@@ -31,6 +31,8 @@ Top-level tenants. Meetings, sessions, recordings, presets, webhooks, livestream
31
31
  ```ruby
32
32
  RK::App.create(name: "Production") # POST /apps
33
33
  RK::App.all # GET /apps
34
+ RK::App.current # GET /apps + filter by Cloudflare::RealtimeKit.app_id
35
+ # — verify your configured app_id resolves to a real app
34
36
  ```
35
37
 
36
38
  ## Meetings
@@ -18,6 +18,9 @@ module Cloudflare
18
18
  # app.created_at # => Time
19
19
  #
20
20
  # Cloudflare::RealtimeKit::App.all
21
+ #
22
+ # # Inspect the app the rest of the SDK is configured to use:
23
+ # Cloudflare::RealtimeKit::App.current
21
24
  class App < Resource
22
25
  collection_path "/accounts/{account_id}/realtime/kit/apps"
23
26
 
@@ -45,6 +48,23 @@ module Cloudflare
45
48
  Array(unwrap_envelope(response)).map { new(_1, scope: scope) }
46
49
  end
47
50
 
51
+ # Returns the App whose id matches +Cloudflare::RealtimeKit.app_id+,
52
+ # or nil if no such app exists in the account. Convenience for
53
+ # verifying that the configured app_id is valid and inspecting the
54
+ # app's name / created_at.
55
+ #
56
+ # Implemented over GET /apps + client-side filter because upstream
57
+ # doesn't expose GET /apps/{id} — see the Resource class docs above
58
+ # for the apps surface.
59
+ #
60
+ # Cloudflare::RealtimeKit::App.current
61
+ # # => #<App id="...", name="tokimonki-exchange-development">
62
+ def current(account_id: nil)
63
+ target = RealtimeKit.app_id
64
+ raise ArgumentError, "Cloudflare::RealtimeKit.app_id not configured" if target.nil?
65
+ all(account_id: account_id).find { |app| app.id == target }
66
+ end
67
+
48
68
  private
49
69
  def unwrap_create_payload(response)
50
70
  payload = unwrap_envelope(response)
@@ -1,3 +1,3 @@
1
1
  module Cloudflare
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudflare-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tokimonki