tapfall 0.0.1 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10d16e103fb9bb828f86ba932076d45f3f7d5e89b81eceb3f60292dfc5605aa7
4
- data.tar.gz: 3087c8bbc196e557f046aaef5bfc48ac49220d2efc835996319b3b74db352aa7
3
+ metadata.gz: 66d3598fd16d3ed0289b2007c59996a93bdda3c65c48adb49196dec33961308f
4
+ data.tar.gz: 87929c9107cb655f57e3d00ae08030b0d753ea3daae72bfc0fc337a6943e0ebb
5
5
  SHA512:
6
- metadata.gz: e18feb0d610d2d6e16edcb6e68fd6f8e8a949117e609e519501b4b2299aa0f2b721e7b008f8f4be5f3fdb1239f43ae8a5ce7fa3cc2d6991262fa99917e7b21d2
7
- data.tar.gz: 91557b3f07d953e622ad190c24c0bf471ece14184e004731f30eaa104a36f78121704ee1e38b0191ec7d3e5d02549f383300002d5bb11efeaed48363c0537b3a
6
+ metadata.gz: 6b811a74573589f3e3650c88df74ed3ea9e4a1109e3a074e32b4e5d8c8158f4239afd2f76f215d4a089ddba03e937082c727fb915d1b621f0bf96de763e97471
7
+ data.tar.gz: 569b52443ee8ebf798524619634aca85b5bb50e56869ea35e700a0e754bc29716227ccf498dbbbeaa2145a8e3d4e5a8b0e6c2fdf93ac17bf7165ac9cfa7853a1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.0.2] - 2025-12-23
2
+
3
+ - added `#operation` method (aliased as `#op`) to `Operation`
4
+ - added `#resolve_did` for calling the `/resolve/:did` API endpoint
5
+ - workaround for `isActive` field sent as `is_active` in identity events
6
+
1
7
  ## [0.0.1] - 2025-12-22
2
8
 
3
9
  - first working version, with streaming from Tap, support for ack and admin password options, and calling two HTTP endpoints
data/README.md CHANGED
@@ -116,7 +116,7 @@ All message types share these properties:
116
116
  - `type` (symbol) – the message type identifier, e.g. `:record`
117
117
  - `id` (integer), aliased as `seq` – a sequential index of the message
118
118
 
119
- The `:record` messages have an `operations` method, which includes an array of add/remove/edit `Operation`s done on some records. Currently Tap event format only includes one single record operation in each event, but it's returned as an array here for symmetry with the `Skyfall::Firehose` stream version.
119
+ The `:record` messages have an `operation` method (aliased as `op`), which returns an `Operation` object with details of an create/update/delete operation done a record. (For symmetry with the `Skyfall::Firehose` stream version, there's also an `operations` method which returns an array.)
120
120
 
121
121
  An `Operation` has such fields (also matching the API of `Skyfall::Firehose::Operation` and `Skyfall::Jetstream::Operation`):
122
122
 
data/lib/tapfall/api.rb CHANGED
@@ -25,6 +25,10 @@ module Tapfall
25
25
  post_request('/repos/remove', { dids: dids })
26
26
  end
27
27
 
28
+ def resolve_did(did)
29
+ get_request("/resolve/#{did}")
30
+ end
31
+
28
32
  private
29
33
 
30
34
  def build_root_url(server)
@@ -49,6 +53,22 @@ module Tapfall
49
53
  end
50
54
  end
51
55
 
56
+ def get_request(path)
57
+ uri = URI(@root_url + path)
58
+
59
+ request = Net::HTTP::Get.new(uri)
60
+
61
+ if @options[:admin_password]
62
+ request.basic_auth('admin', @options[:admin_password])
63
+ end
64
+
65
+ response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => (uri.scheme == 'https')) do |http|
66
+ http.request(request)
67
+ end
68
+
69
+ handle_response(response)
70
+ end
71
+
52
72
  def post_request(path, json_data)
53
73
  uri = URI(@root_url + path)
54
74
 
@@ -64,6 +84,10 @@ module Tapfall
64
84
  http.request(request)
65
85
  end
66
86
 
87
+ handle_response(response)
88
+ end
89
+
90
+ def handle_response(response)
67
91
  status = response.code.to_i
68
92
  message = response.message
69
93
  response_body = (response.content_type == 'application/json') ? JSON.parse(response.body) : response.body
@@ -20,7 +20,7 @@ module Tapfall
20
20
  end
21
21
 
22
22
  def active?
23
- @identity['isActive']
23
+ @identity['isActive'] || @identity['is_active']
24
24
  end
25
25
 
26
26
  def status
@@ -8,8 +8,14 @@ module Tapfall
8
8
  super
9
9
  end
10
10
 
11
+ def operation
12
+ @operation ||= Operation.new(json['record'])
13
+ end
14
+
11
15
  def operations
12
- @operations ||= [Operation.new(json['record'])]
16
+ [operation]
13
17
  end
18
+
19
+ alias op operation
14
20
  end
15
21
  end
@@ -10,7 +10,7 @@ module Tapfall
10
10
  class Tapfall::Stream < Skyfall::Stream
11
11
  extend Forwardable
12
12
 
13
- def_delegators :@api, :add_repo, :add_repos, :remove_repo, :remove_repos
13
+ def_delegators :@api, :add_repo, :add_repos, :remove_repo, :remove_repos, :resolve_did
14
14
 
15
15
  def initialize(server, options = {})
16
16
  super(server)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tapfall
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapfall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuba Suder