rerout 0.1.0 → 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: f45e9af9b2dfce2933563d97fc0adca857d4cdca00a09fdafe89240fcdc1671f
4
- data.tar.gz: ed1bbdcea909d9be88f5af98fccfcf4090de2ce1d3f30fb060ee81bc091f6369
3
+ metadata.gz: 78cf1ae4573eccdeed6874c837565ea69f415c928c23def1fe506e674be53ec3
4
+ data.tar.gz: aa23cc62bcd1c3f2f80ee460fe691d0241027020e5d7f5d3bfacb2e909263286
5
5
  SHA512:
6
- metadata.gz: 974f74ad677142b918c0d9c367a785f6c2ae6198122ebaf75ee7d6f55e2b698883cbb01636f976d838bec3346cd96bc02e6da7b36da6adf92f49985feeb09650
7
- data.tar.gz: cdc59d4419f34a6e92ccc0765c6aeb03a773c1776bf966a8858bbfc11ea584a5349fdc16e0018fcf7f6aab6dbec93ce250de36dfab849f3f644561ecd1baaa77
6
+ metadata.gz: 4f1e411e4301abfd0009626920e3e974ca4f2b7db05de0d930e2eb9d432b3d71e8c51b5185875c04fdc8edd97cf1cc756e93215cc24e82103086f475714732e0
7
+ data.tar.gz: 1722814f198aca44eded94a7f5c983a7f30a9437a75652046ad61226cd454d005b248fe500a68080c4aa5b98fc0089274fe610089a3ac8f5b2a68832fcfb723b
data/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ All notable changes to the `rerout` gem are documented in this file. The
4
4
  format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.2.0] - 2026-06-02
8
+
9
+ ### Added
10
+
11
+ - Read-only `tags` field on `Rerout::Models::Link` — an array of
12
+ `Rerout::Models::Tag` value objects (`{ id, name, color }`). Populated on
13
+ `get`, `list`, and `update`; an empty array on `create`. Tag writes are not
14
+ supported for API-key clients.
15
+
16
+ ### Notes
17
+
18
+ - The project stats endpoint `/v1/projects/me/stats` (used by
19
+ `project.stats`) is now live.
20
+
7
21
  ## [0.1.0] - 2026-05-20
8
22
 
9
23
  ### Added
@@ -26,4 +40,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
40
  - `Rerout::Error` with stable `code`, `status`, `path`, `timestamp`, `details`
27
41
  plus `rate_limited?` and `server_error?` convenience flags.
28
42
 
43
+ [0.2.0]: https://github.com/ModestNerds-Co/rerout-sdks/releases/tag/ruby-v0.2.0
29
44
  [0.1.0]: https://github.com/ModestNerds-Co/rerout-sdks/releases/tag/ruby-v0.1.0
data/README.md CHANGED
@@ -82,6 +82,7 @@ page = rerout.links.list(cursor: page.next_cursor) if page.next_cursor
82
82
 
83
83
  # Get one
84
84
  link = rerout.links.get('q4')
85
+ link.tags # => [Rerout::Models::Tag, ...] — read-only { id, name, color }
85
86
 
86
87
  # Update — only the fields you set are sent.
87
88
  rerout.links.update('q4', Rerout::UpdateLinkInput.new(is_active: false))
data/lib/rerout/models.rb CHANGED
@@ -5,18 +5,49 @@ module Rerout
5
5
  # frozen struct-like class with `from_hash` for JSON ingestion and value
6
6
  # equality semantics.
7
7
  module Models
8
+ # A label attached to a link — `{ id:, name:, color: }`. Read-only; the API
9
+ # ignores tag writes for API-key clients.
10
+ class Tag
11
+ attr_reader :id, :name, :color
12
+
13
+ def initialize(id:, name:, color:)
14
+ @id = id
15
+ @name = name
16
+ @color = color
17
+ freeze
18
+ end
19
+
20
+ def self.from_hash(hash)
21
+ new(id: hash['id'], name: hash['name'], color: hash['color'])
22
+ end
23
+
24
+ def to_h
25
+ { id: id, name: name, color: color }
26
+ end
27
+
28
+ def ==(other)
29
+ other.is_a?(Tag) && other.id == id && other.name == name && other.color == color
30
+ end
31
+ alias eql? ==
32
+
33
+ def hash
34
+ [self.class, id, name, color].hash
35
+ end
36
+ end
37
+
8
38
  # A short link.
9
39
  class Link
10
40
  ATTRS = %i[
11
41
  code short_url domain_hostname target_url project_id expires_at
12
42
  is_active seo_title seo_description seo_image_url seo_canonical_url
13
- seo_noindex seo_updated_at created_at updated_at
43
+ seo_noindex seo_updated_at tags created_at updated_at
14
44
  ].freeze
15
45
 
16
46
  attr_reader(*ATTRS)
17
47
 
18
48
  def initialize(**attrs)
19
49
  ATTRS.each { |k| instance_variable_set(:"@#{k}", attrs[k]) }
50
+ @tags = (@tags || []).freeze
20
51
  freeze
21
52
  end
22
53
 
@@ -35,13 +66,16 @@ module Rerout
35
66
  seo_canonical_url: hash['seo_canonical_url'],
36
67
  seo_noindex: hash.fetch('seo_noindex', true),
37
68
  seo_updated_at: hash['seo_updated_at'],
69
+ tags: (hash['tags'] || []).map { |t| Tag.from_hash(t) },
38
70
  created_at: hash['created_at'],
39
71
  updated_at: hash['updated_at']
40
72
  )
41
73
  end
42
74
 
43
75
  def to_h
44
- ATTRS.to_h { |k| [k, public_send(k)] }
76
+ ATTRS.to_h do |k|
77
+ [k, k == :tags ? tags.map(&:to_h) : public_send(k)]
78
+ end
45
79
  end
46
80
 
47
81
  def ==(other)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Rerout
4
4
  # Library version. Follows semantic versioning.
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rerout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codecraft Solutions
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-06-02 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: faraday
@@ -128,6 +129,7 @@ metadata:
128
129
  bug_tracker_uri: https://github.com/ModestNerds-Co/rerout-sdks/issues
129
130
  documentation_uri: https://rerout.co/docs
130
131
  rubygems_mfa_required: 'true'
132
+ post_install_message:
131
133
  rdoc_options: []
132
134
  require_paths:
133
135
  - lib
@@ -142,7 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
144
  - !ruby/object:Gem::Version
143
145
  version: '0'
144
146
  requirements: []
145
- rubygems_version: 3.6.9
147
+ rubygems_version: 3.0.3.1
148
+ signing_key:
146
149
  specification_version: 4
147
150
  summary: Official Ruby SDK for the Rerout branded-link API.
148
151
  test_files: []