repull 0.2.49 → 0.2.51

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repull/api/airbnb_api.rb +2 -2
  3. data/lib/repull/api/connections_api.rb +2 -2
  4. data/lib/repull/api/conversations_api.rb +2 -2
  5. data/lib/repull/models/account_calendar_access_changed_event.rb +282 -0
  6. data/lib/repull/models/account_calendar_access_changed_payload.rb +268 -0
  7. data/lib/repull/models/account_notifications_missing_event.rb +282 -0
  8. data/lib/repull/models/account_notifications_missing_payload.rb +278 -0
  9. data/lib/repull/models/apply_connection_mappings_request_mappings_inner.rb +1 -1
  10. data/lib/repull/models/connect_status_accounts_inner.rb +23 -2
  11. data/lib/repull/models/conversation_message_status_changed_event.rb +282 -0
  12. data/lib/repull/models/conversation_message_status_changed_payload.rb +233 -0
  13. data/lib/repull/models/get_airbnb_booking_settings200_response_data_advance_notice.rb +14 -3
  14. data/lib/repull/models/get_listing_calendar_sync200_response_channels_inner.rb +33 -1
  15. data/lib/repull/models/guest.rb +35 -2
  16. data/lib/repull/models/guest_contact.rb +37 -5
  17. data/lib/repull/models/guest_phone_type.rb +40 -0
  18. data/lib/repull/models/guest_profile.rb +35 -1
  19. data/lib/repull/models/list_connection_units200_response.rb +10 -1
  20. data/lib/repull/models/list_connection_units200_response_units_inner.rb +1 -1
  21. data/lib/repull/models/message.rb +2 -2
  22. data/lib/repull/models/reservation.rb +11 -1
  23. data/lib/repull/models/reservation_primary_guest.rb +45 -2
  24. data/lib/repull/models/send_message_response.rb +1 -0
  25. data/lib/repull/models/start_connection_import_request.rb +1 -1
  26. data/lib/repull/models/update_airbnb_booking_settings_request_advance_notice.rb +56 -17
  27. data/lib/repull/models/vrbo_calendar_access.rb +204 -0
  28. data/lib/repull/models/vrbo_notifications.rb +192 -0
  29. data/lib/repull/models/webhook_event.rb +6 -0
  30. data/lib/repull/models/webhook_event_type.rb +4 -1
  31. data/lib/repull/version.rb +1 -1
  32. data/lib/repull.rb +9 -0
  33. data/openapi/v1.json +493 -21
  34. metadata +11 -2
@@ -28,8 +28,12 @@ module Repull
28
28
 
29
29
  attr_accessor :country
30
30
 
31
+ # Primary phone contact. May be an Airbnb relay number — check `phoneType`.
31
32
  attr_accessor :phone
32
33
 
34
+ # `airbnb_relay` when `phone` is a temporary Airbnb relay number; `guest` otherwise; `null` when there is no phone.
35
+ attr_accessor :phone_type
36
+
33
37
  attr_accessor :email
34
38
 
35
39
  attr_accessor :total_reservations
@@ -58,6 +62,28 @@ module Repull
58
62
 
59
63
  attr_accessor :reservations_summary
60
64
 
65
+ class EnumAttributeValidator
66
+ attr_reader :datatype
67
+ attr_reader :allowable_values
68
+
69
+ def initialize(datatype, allowable_values)
70
+ @allowable_values = allowable_values.map do |value|
71
+ case datatype.to_s
72
+ when /Integer/i
73
+ value.to_i
74
+ when /Float/i
75
+ value.to_f
76
+ else
77
+ value
78
+ end
79
+ end
80
+ end
81
+
82
+ def valid?(value)
83
+ !value || allowable_values.include?(value)
84
+ end
85
+ end
86
+
61
87
  # Attribute mapping from ruby-style variable name to JSON key.
62
88
  def self.attribute_map
63
89
  {
@@ -68,6 +94,7 @@ module Repull
68
94
  :'language' => :'language',
69
95
  :'country' => :'country',
70
96
  :'phone' => :'phone',
97
+ :'phone_type' => :'phoneType',
71
98
  :'email' => :'email',
72
99
  :'total_reservations' => :'totalReservations',
73
100
  :'total_revenue' => :'totalRevenue',
@@ -104,6 +131,7 @@ module Repull
104
131
  :'language' => :'String',
105
132
  :'country' => :'String',
106
133
  :'phone' => :'String',
134
+ :'phone_type' => :'GuestPhoneType',
107
135
  :'email' => :'String',
108
136
  :'total_reservations' => :'Integer',
109
137
  :'total_revenue' => :'String',
@@ -127,6 +155,7 @@ module Repull
127
155
  :'language',
128
156
  :'country',
129
157
  :'phone',
158
+ :'phone_type',
130
159
  :'email',
131
160
  :'currency',
132
161
  :'blacklisted_reason',
@@ -180,6 +209,10 @@ module Repull
180
209
  self.phone = attributes[:'phone']
181
210
  end
182
211
 
212
+ if attributes.key?(:'phone_type')
213
+ self.phone_type = attributes[:'phone_type']
214
+ end
215
+
183
216
  if attributes.key?(:'email')
184
217
  self.email = attributes[:'email']
185
218
  end
@@ -266,6 +299,7 @@ module Repull
266
299
  language == o.language &&
267
300
  country == o.country &&
268
301
  phone == o.phone &&
302
+ phone_type == o.phone_type &&
269
303
  email == o.email &&
270
304
  total_reservations == o.total_reservations &&
271
305
  total_revenue == o.total_revenue &&
@@ -290,7 +324,7 @@ module Repull
290
324
  # Calculates hash code according to all attributes.
291
325
  # @return [Integer] Hash code
292
326
  def hash
293
- [id, display_name, display_name_long, avatar_url, language, country, phone, email, total_reservations, total_revenue, currency, is_blacklisted, blacklisted_reason, risk_level, verification_level, created_at, contacts, flags, notes, reservations_summary].hash
327
+ [id, display_name, display_name_long, avatar_url, language, country, phone, phone_type, email, total_reservations, total_revenue, currency, is_blacklisted, blacklisted_reason, risk_level, verification_level, created_at, contacts, flags, notes, reservations_summary].hash
294
328
  end
295
329
 
296
330
  # Builds the object from hash
@@ -24,6 +24,8 @@ module Repull
24
24
  # Vrbo only. Ask the host to add this address on Vrbo as a secondary email, with message and reservation notifications on. It is how new bookings, inquiries and guest messages reach Repull within a minute; without it they arrive at the next scheduled check. Hosted Connect asks for it on its mapping screen, so show it in your own flow when you map with `mapping: \"api\"`.
25
25
  attr_accessor :notification_email
26
26
 
27
+ attr_accessor :calendar
28
+
27
29
  attr_accessor :units
28
30
 
29
31
  attr_accessor :listing_options
@@ -62,6 +64,7 @@ module Repull
62
64
  :'channel' => :'channel',
63
65
  :'status' => :'status',
64
66
  :'notification_email' => :'notification_email',
67
+ :'calendar' => :'calendar',
65
68
  :'units' => :'units',
66
69
  :'listing_options' => :'listing_options',
67
70
  :'missing_capabilities' => :'missing_capabilities',
@@ -86,6 +89,7 @@ module Repull
86
89
  :'channel' => :'String',
87
90
  :'status' => :'String',
88
91
  :'notification_email' => :'String',
92
+ :'calendar' => :'VrboCalendarAccess',
89
93
  :'units' => :'Array<ListConnectionUnits200ResponseUnitsInner>',
90
94
  :'listing_options' => :'Array<ListConnectionUnits200ResponseListingOptionsInner>',
91
95
  :'missing_capabilities' => :'Array<String>',
@@ -132,6 +136,10 @@ module Repull
132
136
  self.notification_email = attributes[:'notification_email']
133
137
  end
134
138
 
139
+ if attributes.key?(:'calendar')
140
+ self.calendar = attributes[:'calendar']
141
+ end
142
+
135
143
  if attributes.key?(:'units')
136
144
  if (value = attributes[:'units']).is_a?(Array)
137
145
  self.units = value
@@ -191,6 +199,7 @@ module Repull
191
199
  channel == o.channel &&
192
200
  status == o.status &&
193
201
  notification_email == o.notification_email &&
202
+ calendar == o.calendar &&
194
203
  units == o.units &&
195
204
  listing_options == o.listing_options &&
196
205
  missing_capabilities == o.missing_capabilities &&
@@ -206,7 +215,7 @@ module Repull
206
215
  # Calculates hash code according to all attributes.
207
216
  # @return [Integer] Hash code
208
217
  def hash
209
- [connection_id, channel, status, notification_email, units, listing_options, missing_capabilities, listing_options_total].hash
218
+ [connection_id, channel, status, notification_email, calendar, units, listing_options, missing_capabilities, listing_options_total].hash
210
219
  end
211
220
 
212
221
  # Builds the object from hash
@@ -25,7 +25,7 @@ module Repull
25
25
 
26
26
  attr_accessor :suggested_listing_id
27
27
 
28
- # Channel details that identify the unit. Booking.com Extranet: `hotel` (property name), `hotelId` (Booking.com property ID), `roomId` (Booking.com room ID), `city`. Vrbo: `headline`, `address`, `vrboStatus`; the Vrbo listing ID is `unit_id`.
28
+ # Channel details that identify the unit. Booking.com Extranet: `hotel` (property name), `hotelId` (Booking.com property ID), `roomId` (Booking.com room ID), `city`. Vrbo: `headline`, `address`, `vrboStatus`, `calendarSync` (whether the unit's prices and availability are pushed to Vrbo) and, while Vrbo says another tool manages the account's calendar, `calendarSyncBlocked: \"calendar_managed_elsewhere\"`; the Vrbo listing ID is `unit_id`.
29
29
  attr_accessor :meta
30
30
 
31
31
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -23,10 +23,10 @@ module Repull
23
23
 
24
24
  attr_accessor :direction
25
25
 
26
- # Delivery state. Inbound messages are `received`. An outbound message is `sending` while it is queued to the channel, `sent` once the channel accepted it, or `failed`. Only `sent` (or `received`) means the guest can see it.
26
+ # Delivery state. Inbound messages are `received`. An outbound message is `sending` while it is handed to the channel, `queued` when the channel was busy and Repull is still delivering it in the background (Vrbo), `sent` once the channel accepted it, or `failed`. Only `sent` (or `received`) means the guest can see it. A change from `queued` is sent as `conversation.message.status_changed`.
27
27
  attr_accessor :status
28
28
 
29
- # Why a message is still `sending` or `failed`, in plain words. `null` otherwise.
29
+ # Why a message is still `sending` or `queued`, or why it `failed`, in plain words. `null` otherwise.
30
30
  attr_accessor :status_reason
31
31
 
32
32
  # Free-form sender role from the channel (e.g. `guest`, `host`, `system`, `airbnb`). Use `direction` for binary inbound/outbound logic.
@@ -82,6 +82,9 @@ module Repull
82
82
  # Door codes for the stay from the PMS's lock manager (today: Guesty Locks Manager), refreshed about every 30 minutes for stays checking in within 14 days that have not checked out. `null` when the reservation's codes are not read from a PMS. `[]` when they are and there is none yet, and for a cancelled stay.
83
83
  attr_accessor :access_codes
84
84
 
85
+ # Airbnb reservations only, when Airbnb sends it: the door code Airbnb suggests — the last 4 digits of the booker's verified phone number, or random digits when there is none. Use it instead of deriving a code from the guest's phone, which Airbnb no longer shares. Omitted on every other reservation.
86
+ attr_accessor :suggested_door_code
87
+
85
88
  # Inline guest summary. May be undefined for owner-blocks / pre-arrival rows.
86
89
  attr_accessor :primary_guest
87
90
 
@@ -138,6 +141,7 @@ module Repull
138
141
  :'unit' => :'unit',
139
142
  :'pms_reservation_id' => :'pmsReservationId',
140
143
  :'access_codes' => :'accessCodes',
144
+ :'suggested_door_code' => :'suggestedDoorCode',
141
145
  :'primary_guest' => :'primaryGuest',
142
146
  :'occupancy' => :'occupancy',
143
147
  :'financials' => :'financials',
@@ -187,6 +191,7 @@ module Repull
187
191
  :'unit' => :'ReservationUnit',
188
192
  :'pms_reservation_id' => :'String',
189
193
  :'access_codes' => :'Array<ReservationAccessCode>',
194
+ :'suggested_door_code' => :'String',
190
195
  :'primary_guest' => :'ReservationPrimaryGuest',
191
196
  :'occupancy' => :'ReservationOccupancy',
192
197
  :'financials' => :'ReservationFinancials',
@@ -343,6 +348,10 @@ module Repull
343
348
  end
344
349
  end
345
350
 
351
+ if attributes.key?(:'suggested_door_code')
352
+ self.suggested_door_code = attributes[:'suggested_door_code']
353
+ end
354
+
346
355
  if attributes.key?(:'primary_guest')
347
356
  self.primary_guest = attributes[:'primary_guest']
348
357
  end
@@ -553,6 +562,7 @@ module Repull
553
562
  unit == o.unit &&
554
563
  pms_reservation_id == o.pms_reservation_id &&
555
564
  access_codes == o.access_codes &&
565
+ suggested_door_code == o.suggested_door_code &&
556
566
  primary_guest == o.primary_guest &&
557
567
  occupancy == o.occupancy &&
558
568
  financials == o.financials &&
@@ -574,7 +584,7 @@ module Repull
574
584
  # Calculates hash code according to all attributes.
575
585
  # @return [Integer] Hash code
576
586
  def hash
577
- [account, id, listing_id, listing_name, guest_id, check_in, check_out, check_in_time, check_out_time, guest_notes, conversation_id, external_thread_id, inquiry_id, status, status_detail, pending_reason, respond_by, source, platform, confirmation_code, unit, pms_reservation_id, access_codes, primary_guest, occupancy, financials, total_price, currency, guest_details, created_at, updated_at, booked_at, guest_name].hash
587
+ [account, id, listing_id, listing_name, guest_id, check_in, check_out, check_in_time, check_out_time, guest_notes, conversation_id, external_thread_id, inquiry_id, status, status_detail, pending_reason, respond_by, source, platform, confirmation_code, unit, pms_reservation_id, access_codes, suggested_door_code, primary_guest, occupancy, financials, total_price, currency, guest_details, created_at, updated_at, booked_at, guest_name].hash
578
588
  end
579
589
 
580
590
  # Builds the object from hash
@@ -26,12 +26,40 @@ module Repull
26
26
  # Primary email contact (or first non-primary if no primary set).
27
27
  attr_accessor :email
28
28
 
29
- # Primary phone contact (or first non-primary if no primary set).
29
+ # Primary phone contact (or first non-primary if no primary set). For an Airbnb stay this may be an Airbnb relay number — check `phoneType`.
30
30
  attr_accessor :phone
31
31
 
32
+ # Present whenever `phone` is. `airbnb_relay` when `phone` is a temporary Airbnb relay number (SMS only, expires 48h after checkout, shared across hosts, never a guest identifier); `guest` otherwise.
33
+ attr_accessor :phone_type
34
+
35
+ # Only next to an Airbnb relay number: when it stops working (checkout + 48 hours). `null` when Airbnb did not give the checkout time with its offset. A cancelled reservation's relay number stops working at cancellation, whatever this says.
36
+ attr_accessor :phone_expires_at
37
+
32
38
  # Guest's preferred language (BCP-47 / ISO 639-1).
33
39
  attr_accessor :language
34
40
 
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
35
63
  # Attribute mapping from ruby-style variable name to JSON key.
36
64
  def self.attribute_map
37
65
  {
@@ -40,6 +68,8 @@ module Repull
40
68
  :'last_name' => :'lastName',
41
69
  :'email' => :'email',
42
70
  :'phone' => :'phone',
71
+ :'phone_type' => :'phoneType',
72
+ :'phone_expires_at' => :'phoneExpiresAt',
43
73
  :'language' => :'language'
44
74
  }
45
75
  end
@@ -62,6 +92,8 @@ module Repull
62
92
  :'last_name' => :'String',
63
93
  :'email' => :'String',
64
94
  :'phone' => :'String',
95
+ :'phone_type' => :'GuestPhoneType',
96
+ :'phone_expires_at' => :'Time',
65
97
  :'language' => :'String'
66
98
  }
67
99
  end
@@ -73,6 +105,7 @@ module Repull
73
105
  :'last_name',
74
106
  :'email',
75
107
  :'phone',
108
+ :'phone_expires_at',
76
109
  :'language'
77
110
  ])
78
111
  end
@@ -113,6 +146,14 @@ module Repull
113
146
  self.phone = attributes[:'phone']
114
147
  end
115
148
 
149
+ if attributes.key?(:'phone_type')
150
+ self.phone_type = attributes[:'phone_type']
151
+ end
152
+
153
+ if attributes.key?(:'phone_expires_at')
154
+ self.phone_expires_at = attributes[:'phone_expires_at']
155
+ end
156
+
116
157
  if attributes.key?(:'language')
117
158
  self.language = attributes[:'language']
118
159
  end
@@ -143,6 +184,8 @@ module Repull
143
184
  last_name == o.last_name &&
144
185
  email == o.email &&
145
186
  phone == o.phone &&
187
+ phone_type == o.phone_type &&
188
+ phone_expires_at == o.phone_expires_at &&
146
189
  language == o.language
147
190
  end
148
191
 
@@ -155,7 +198,7 @@ module Repull
155
198
  # Calculates hash code according to all attributes.
156
199
  # @return [Integer] Hash code
157
200
  def hash
158
- [id, first_name, last_name, email, phone, language].hash
201
+ [id, first_name, last_name, email, phone, phone_type, phone_expires_at, language].hash
159
202
  end
160
203
 
161
204
  # Builds the object from hash
@@ -26,6 +26,7 @@ module Repull
26
26
  # The channel the message actually went out on.
27
27
  attr_accessor :channel
28
28
 
29
+ # `sent`: delivered. `queued` (with HTTP `202`): recorded, and still being delivered in the background because the channel was busy (Vrbo) — do not resend; the outcome arrives as the message's `status` on `GET /v1/conversations/{id}/messages` and as `conversation.message.status_changed`.
29
30
  attr_accessor :status
30
31
 
31
32
  attr_accessor :direction
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module Repull
17
17
  class StartConnectionImportRequest < ApiModelBase
18
- # What to import. `listings` = the account's listings and their calendars (pricing and availability). The only scope; the full import runs when an account is connected.
18
+ # What to import. `listings` = the account's listings. New listings come in with their calendar (pricing and availability); on a full-access connection, calendars of listings already in Repull are not re-read. The only scope; the full import runs when an account is connected.
19
19
  attr_accessor :scope
20
20
 
21
21
  class EnumAttributeValidator
@@ -14,16 +14,43 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Repull
17
- # Send `hours`, `allowRequestToBook`, or both. The half you omit keeps the value Airbnb currently holds.
17
+ # Send `hours` (or `sameDayCutoff`), `allowRequestToBook`, or both. The half you omit keeps the value Airbnb currently holds. `hours` and `sameDayCutoff` are the same setting: send one.
18
18
  class UpdateAirbnbBookingSettingsRequestAdvanceNotice < ApiModelBase
19
+ # Counted back from 11:59 PM on the check-in day (listing time): `0` = same-day bookings until midnight, `1` = until 11 PM, `24` = no same-day bookings.
19
20
  attr_accessor :hours
20
21
 
22
+ # The last time a same-day booking is accepted, whole hours in the listing's time (`23:00` = 11 PM, `00:00` = midnight). Converted to `hours` (`23:00` = 1).
23
+ attr_accessor :same_day_cutoff
24
+
21
25
  attr_accessor :allow_request_to_book
22
26
 
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
23
49
  # Attribute mapping from ruby-style variable name to JSON key.
24
50
  def self.attribute_map
25
51
  {
26
52
  :'hours' => :'hours',
53
+ :'same_day_cutoff' => :'sameDayCutoff',
27
54
  :'allow_request_to_book' => :'allowRequestToBook'
28
55
  }
29
56
  end
@@ -42,6 +69,7 @@ module Repull
42
69
  def self.openapi_types
43
70
  {
44
71
  :'hours' => :'Integer',
72
+ :'same_day_cutoff' => :'String',
45
73
  :'allow_request_to_book' => :'Boolean'
46
74
  }
47
75
  end
@@ -50,6 +78,7 @@ module Repull
50
78
  def self.openapi_nullable
51
79
  Set.new([
52
80
  :'hours',
81
+ :'same_day_cutoff',
53
82
  :'allow_request_to_book'
54
83
  ])
55
84
  end
@@ -74,6 +103,10 @@ module Repull
74
103
  self.hours = attributes[:'hours']
75
104
  end
76
105
 
106
+ if attributes.key?(:'same_day_cutoff')
107
+ self.same_day_cutoff = attributes[:'same_day_cutoff']
108
+ end
109
+
77
110
  if attributes.key?(:'allow_request_to_book')
78
111
  self.allow_request_to_book = attributes[:'allow_request_to_book']
79
112
  end
@@ -84,12 +117,9 @@ module Repull
84
117
  def list_invalid_properties
85
118
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
86
119
  invalid_properties = Array.new
87
- if !@hours.nil? && @hours > 168
88
- invalid_properties.push('invalid value for "hours", must be smaller than or equal to 168.')
89
- end
90
-
91
- if !@hours.nil? && @hours < 0
92
- invalid_properties.push('invalid value for "hours", must be greater than or equal to 0.')
120
+ pattern = Regexp.new(/^([01][0-9]|2[0-3]):00$/)
121
+ if !@same_day_cutoff.nil? && @same_day_cutoff !~ pattern
122
+ invalid_properties.push("invalid value for \"same_day_cutoff\", must conform to the pattern #{pattern}.")
93
123
  end
94
124
 
95
125
  invalid_properties
@@ -99,23 +129,31 @@ module Repull
99
129
  # @return true if the model is valid
100
130
  def valid?
101
131
  warn '[DEPRECATED] the `valid?` method is obsolete'
102
- return false if !@hours.nil? && @hours > 168
103
- return false if !@hours.nil? && @hours < 0
132
+ hours_validator = EnumAttributeValidator.new('Integer', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 48, 72, 168])
133
+ return false unless hours_validator.valid?(@hours)
134
+ return false if !@same_day_cutoff.nil? && @same_day_cutoff !~ Regexp.new(/^([01][0-9]|2[0-3]):00$/)
104
135
  true
105
136
  end
106
137
 
107
- # Custom attribute writer method with validation
108
- # @param [Object] hours Value to be assigned
138
+ # Custom attribute writer method checking allowed values (enum).
139
+ # @param [Object] hours Object to be assigned
109
140
  def hours=(hours)
110
- if !hours.nil? && hours > 168
111
- fail ArgumentError, 'invalid value for "hours", must be smaller than or equal to 168.'
141
+ validator = EnumAttributeValidator.new('Integer', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 48, 72, 168])
142
+ unless validator.valid?(hours)
143
+ fail ArgumentError, "invalid value for \"hours\", must be one of #{validator.allowable_values}."
112
144
  end
145
+ @hours = hours
146
+ end
113
147
 
114
- if !hours.nil? && hours < 0
115
- fail ArgumentError, 'invalid value for "hours", must be greater than or equal to 0.'
148
+ # Custom attribute writer method with validation
149
+ # @param [Object] same_day_cutoff Value to be assigned
150
+ def same_day_cutoff=(same_day_cutoff)
151
+ pattern = Regexp.new(/^([01][0-9]|2[0-3]):00$/)
152
+ if !same_day_cutoff.nil? && same_day_cutoff !~ pattern
153
+ fail ArgumentError, "invalid value for \"same_day_cutoff\", must conform to the pattern #{pattern}."
116
154
  end
117
155
 
118
- @hours = hours
156
+ @same_day_cutoff = same_day_cutoff
119
157
  end
120
158
 
121
159
  # Checks equality by comparing each attribute.
@@ -124,6 +162,7 @@ module Repull
124
162
  return true if self.equal?(o)
125
163
  self.class == o.class &&
126
164
  hours == o.hours &&
165
+ same_day_cutoff == o.same_day_cutoff &&
127
166
  allow_request_to_book == o.allow_request_to_book
128
167
  end
129
168
 
@@ -136,7 +175,7 @@ module Repull
136
175
  # Calculates hash code according to all attributes.
137
176
  # @return [Integer] Hash code
138
177
  def hash
139
- [hours, allow_request_to_book].hash
178
+ [hours, same_day_cutoff, allow_request_to_book].hash
140
179
  end
141
180
 
142
181
  # Builds the object from hash