guesty-client 0.2.0 → 0.2.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/guesty/conversations/posts/index.rb +13 -3
- data/lib/guesty/version.rb +1 -1
- data/sig/guesty.rbs +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d33d5c820b839d8a0e7dd2aa1153b2d886b436d8828c58f13e465a7708dd074
|
|
4
|
+
data.tar.gz: 51273ad1e523b1681e0e478efd09a1a004c071a7aaaaebf2e2d82e137e0c3e15
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49d588033bf063188d46e45e6c0e059e92c405fc3ee08835283fb024342b53c244ba677c04d19f7d9e85f6104ef2fda3e15119031c61d8503dcf15d4fe6bf008
|
|
7
|
+
data.tar.gz: bedbf42d1afd2cf11d96891901617bf4524bd4711794876acfe2bc716679127d413c14aa244d820d0a4d83f7e1bb21572861eb0b80e56b04498a5a72e193052b
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.2.1] - 2026-11-18
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `Conversations::Posts::Index` keeps the posts Guesty marks `sentBy: channel`: emails the booking channel itself
|
|
10
|
+
sends, such as Airbnb Resolution Center notices. They come back with `sender_kind: "channel"` and the email's text
|
|
11
|
+
(`plainTextBody`) as `body`; `CHANNEL_SENDER` names the value.
|
|
12
|
+
|
|
5
13
|
## [0.2.0] - 2026-11-10
|
|
6
14
|
|
|
7
15
|
Migrates the reservation surface off the legacy `/reservations` resources, which Guesty retires on
|
|
@@ -6,7 +6,8 @@ module Guesty
|
|
|
6
6
|
|
|
7
7
|
LIMIT = 500
|
|
8
8
|
LOG_SENDER = 'log'.freeze #: ::String
|
|
9
|
-
|
|
9
|
+
CHANNEL_SENDER = 'channel'.freeze #: ::String
|
|
10
|
+
SENDERS = ['guest', 'host', LOG_SENDER, CHANNEL_SENDER].freeze #: ::Array[::String]
|
|
10
11
|
SYSTEM_MODULE_TYPES = %w[note aiSummary].freeze #: ::Array[::String]
|
|
11
12
|
INVALID_RESPONSE = 'Guesty posts response has an unexpected shape.'.freeze #: ::String
|
|
12
13
|
|
|
@@ -59,7 +60,16 @@ module Guesty
|
|
|
59
60
|
return false if post[:_id].blank? || post[:createdAt].blank?
|
|
60
61
|
return false if SYSTEM_MODULE_TYPES.include?(post.dig(:module, :type))
|
|
61
62
|
|
|
62
|
-
SENDERS.include?(post[:sentBy]) && (post
|
|
63
|
+
SENDERS.include?(post[:sentBy]) && (body(post).present? || attachments.any?)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# A channel post is an email the booking channel sent, such as an Airbnb Resolution Center notice:
|
|
67
|
+
# `body` holds its HTML and `plainTextBody` its text.
|
|
68
|
+
# @rbs (untyped post) -> ::String
|
|
69
|
+
def body(post)
|
|
70
|
+
return post[:plainTextBody].presence || post[:body] || '' if post[:sentBy] == CHANNEL_SENDER
|
|
71
|
+
|
|
72
|
+
post[:body] || ''
|
|
63
73
|
end
|
|
64
74
|
|
|
65
75
|
# @rbs (untyped post) -> untyped
|
|
@@ -71,7 +81,7 @@ module Guesty
|
|
|
71
81
|
{
|
|
72
82
|
provider_message_id: post[:_id],
|
|
73
83
|
sender_kind: sender_kind(post),
|
|
74
|
-
body: post
|
|
84
|
+
body: body(post),
|
|
75
85
|
attachments:,
|
|
76
86
|
attachment_keys: normalize_attachment_keys(raw_attachments),
|
|
77
87
|
module_type: channel_type(post),
|
data/lib/guesty/version.rb
CHANGED
data/sig/guesty.rbs
CHANGED