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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abb486d40a4bf8d831a35d7096142a0abb0203bc7ebf330d7c5be0f28d720c56
4
- data.tar.gz: b6c5ceeda67b8a09f4da6785e0ba16a6903860337705cd1412aa8af7258d16f5
3
+ metadata.gz: 3d33d5c820b839d8a0e7dd2aa1153b2d886b436d8828c58f13e465a7708dd074
4
+ data.tar.gz: 51273ad1e523b1681e0e478efd09a1a004c071a7aaaaebf2e2d82e137e0c3e15
5
5
  SHA512:
6
- metadata.gz: 4f16f55de71dc90340172b65eb1cabd589387e67cdd5b459ffea7cb9a43a3f6624de1bcf5663c707d81e1fc4b32247ed8a10e0ed7551d3d99e765a809d9f1315
7
- data.tar.gz: 9ad6eb5ddac5b0f54183a8d4a7a5de6aa4708729d8070f2e8d3194ec271e2ece0d2e8da09698432c2b63543e012c172c6350242eea825396cb32e10d8e1e01c1
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
- SENDERS = ['guest', 'host', LOG_SENDER].freeze #: ::Array[::String]
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[:body].present? || attachments.any?)
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[:body] || '',
84
+ body: body(post),
75
85
  attachments:,
76
86
  attachment_keys: normalize_attachment_keys(raw_attachments),
77
87
  module_type: channel_type(post),
@@ -1,3 +1,3 @@
1
1
  module Guesty
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
data/sig/guesty.rbs CHANGED
@@ -294,6 +294,7 @@ module Guesty
294
294
  module Posts
295
295
  class Index
296
296
  LIMIT: ::Integer
297
+ CHANNEL_SENDER: ::String
297
298
 
298
299
  def call: (conversation_id: ::String, ?cursor: ::String?) -> ::Dry::Monads::Result[::Hash[::Symbol, untyped]]
299
300
  alias call! call
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guesty-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guestit