repull 0.2.33 → 0.2.35

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repull/api/connect_api.rb +4 -4
  3. data/lib/repull/api/health_api.rb +3 -3
  4. data/lib/repull/api/promotions_api.rb +574 -0
  5. data/lib/repull/models/connect_session_completed_payload.rb +1 -1
  6. data/lib/repull/models/connect_status_accounts_inner.rb +12 -1
  7. data/lib/repull/models/create_connect_session_request.rb +25 -1
  8. data/lib/repull/models/create_connection_request.rb +2 -22
  9. data/lib/repull/models/list_connection_units200_response.rb +12 -1
  10. data/lib/repull/models/list_connection_units200_response_units_inner.rb +1 -0
  11. data/lib/repull/models/listing_address.rb +62 -5
  12. data/lib/repull/models/listing_updated_payload.rb +2 -2
  13. data/lib/repull/models/message.rb +24 -1
  14. data/lib/repull/models/postal_address.rb +216 -0
  15. data/lib/repull/models/promotion.rb +344 -0
  16. data/lib/repull/models/promotion_applies_to.rb +161 -0
  17. data/lib/repull/models/promotion_bulk_request.rb +236 -0
  18. data/lib/repull/models/{plumguide_listing_list_response.rb → promotion_bulk_response.rb} +11 -11
  19. data/lib/repull/models/{calendar_updated_payload.rb → promotion_bulk_response_data_inner.rb} +23 -33
  20. data/lib/repull/models/promotion_bulk_response_data_inner_error.rb +165 -0
  21. data/lib/repull/models/promotion_bulk_response_summary.rb +156 -0
  22. data/lib/repull/models/{plumguide_listing.rb → promotion_catalog.rb} +18 -27
  23. data/lib/repull/models/promotion_catalog_channels_inner.rb +222 -0
  24. data/lib/repull/models/promotion_catalog_entry.rb +265 -0
  25. data/lib/repull/models/promotion_catalog_field.rb +205 -0
  26. data/lib/repull/models/{calendar_updated_payload_range.rb → promotion_catalog_field_options_inner.rb} +16 -16
  27. data/lib/repull/models/promotion_catalog_response.rb +147 -0
  28. data/lib/repull/models/promotion_create_request.rb +258 -0
  29. data/lib/repull/models/promotion_delete_response.rb +147 -0
  30. data/lib/repull/models/promotion_delete_response_data.rb +156 -0
  31. data/lib/repull/models/promotion_discount.rb +191 -0
  32. data/lib/repull/models/promotion_input.rb +241 -0
  33. data/lib/repull/models/promotion_list_response.rb +170 -0
  34. data/lib/repull/models/promotion_refresh_response.rb +170 -0
  35. data/lib/repull/models/promotion_response.rb +147 -0
  36. data/lib/repull/models/{calendar_updated_event.rb → promotion_rules.rb} +113 -104
  37. data/lib/repull/models/promotion_rules_blackout_dates_quota.rb +156 -0
  38. data/lib/repull/models/promotion_rules_booking_window.rb +230 -0
  39. data/lib/repull/models/promotion_rules_last_minute.rb +218 -0
  40. data/lib/repull/models/promotion_rules_stay_window.rb +211 -0
  41. data/lib/repull/models/promotion_type.rb +47 -0
  42. data/lib/repull/models/promotion_update_request.rb +175 -0
  43. data/lib/repull/models/promotion_usage.rb +193 -0
  44. data/lib/repull/models/promotion_usage_revenue.rb +156 -0
  45. data/lib/repull/models/property.rb +12 -2
  46. data/lib/repull/models/reservation_money_line.rb +14 -4
  47. data/lib/repull/models/webhook_event.rb +0 -2
  48. data/lib/repull/models/webhook_event_type.rb +1 -2
  49. data/lib/repull/version.rb +1 -1
  50. data/lib/repull.rb +32 -6
  51. data/openapi/v1.json +1193 -357
  52. data/scripts/regen.sh +1 -1
  53. metadata +34 -8
  54. data/lib/repull/api/plumguide_api.rb +0 -552
@@ -0,0 +1,156 @@
1
+ =begin
2
+ #Repull API
3
+
4
+ #The unified API for vacation rental tech. Connect to 50+ PMS platforms and 4 OTA channels through one REST API. Built-in AI operations for guest communication, pricing, and listing optimization. ## Designed for AI agents Every error response on this API includes machine-parseable fields so an LLM (Claude in MCP, Cursor, Cline, GPT, etc.) can self-recover without escalating to a human: - `error.code` — stable string identifier (e.g. `invalid_params`, `rate_limit_exceeded`) - `error.message` — human-readable cause - `error.fix` — exact recovery steps (e.g. \"Pass `check_in_after` as ISO 8601: `?check_in_after=2026-01-15`\") - `error.docs_url` — link to the canonical write-up at `https://repull.dev/docs/errors/{code}` - `error.request_id` — id to correlate with server-side logs - `error.field` / `error.value_received` / `error.valid_values` / `error.did_you_mean` — when the error is parameter-specific - `error.retry_after` — seconds to wait before retrying (rate-limit + transient upstream) `Access-Control-Expose-Headers` lists `x-request-id` and the `X-RateLimit-*` family so browsers can read them on cross-origin responses. ## Quick Start 1. Get an API key at https://repull.dev/dashboard 2. Connect a PMS: `POST /v1/connect/{provider}` 3. List properties: `GET /v1/properties` 4. Get reservations: `GET /v1/reservations` ## Authentication All requests require a Bearer token: ``` Authorization: Bearer sk_live_YOUR_API_KEY ``` ## Request Correlation (X-Request-ID) Every response carries an `X-Request-ID` header, e.g. `X-Request-ID: req_01HXY...`. Include this id in support tickets and bug reports — we can trace the full request lifecycle (auth, rate limit, handler, downstream calls, log row) from a single id. You may set the header on the inbound request to forward your own trace id; we will echo it back instead of generating a new one. Accepted format: `^[\\\\w.-]{1,128}$`. The id is also embedded in error envelopes as `request_id` so server-side log diffs work even when the response headers are stripped by an intermediate proxy. ## Rate Limits The public API enforces a per-API-key sliding-window rate limit on top of the per-tier monthly + daily-AI quotas. **Default policy:** 600 requests per 60 seconds, per API key. Sliding window — there is no fixed-minute boundary you can burst across. Every response includes: | Header | Meaning | |---|---| | `X-RateLimit-Limit` | Requests permitted in the current window. | | `X-RateLimit-Remaining` | Requests left in the current window after this call. | | `X-RateLimit-Reset` | Unix epoch (seconds) when the next slot opens. | | `X-RateLimit-Policy` | Machine-readable policy descriptor, e.g. `600;w=60`. | | `Retry-After` | Seconds to wait before retrying. **Only present on 429 responses.** | **On 429 (rate_limit_exceeded):** the response body matches the standard error envelope with `code: \"rate_limit_exceeded\"`, plus `limit`, `window_seconds`, `retry_after`, and `request_id` fields. SDKs MUST honor `Retry-After` and use exponential backoff with jitter on subsequent retries — never a tight loop. Recommended backoff: ``` sleep_ms = (Retry-After * 1000) + random(0..250) ``` Monthly + daily-AI tier quotas (`free`, `starter`, `custom`) are enforced separately and also surface as 429s; they include `tier`, `scope`, and `resetsAt` fields. ## Plan Limits (402 — `listings_limit_exceeded`) The Repull API also enforces a per-tier cap on **active listings**: | Tier | Active listings cap | |---|---| | `free` | 3 | | `starter` | unlimited (10 included, then billed per listing) | | `custom` | unlimited | When a customer's active-listing count is above their tier cap, the API returns **`402 Payment Required`** with `error.code = \"listings_limit_exceeded\"` on every route EXCEPT: - `/v1/health` — uptime probes are never gated. - `/v1/usage/*` — so dashboards can render the over-cap state. - Any `DELETE` — so the customer can trim listings to get back under the cap without paying. Unlike 429, 402 is NOT a \"wait and retry\" condition — `Retry-After` is not set. The only paths back to 200 are: 1. `DELETE` enough listings to come back under the cap, or 2. Upgrade at `https://repull.dev/dashboard/billing`. The server-side usage cache is 60s, so the first 200 after an upgrade may take up to a minute. The envelope mirrors `rate_limit_exceeded` for SDK ergonomics: `tier`, `limit`, `active_listings`, `upgrade_url`, plus the standard `code` / `message` / `fix` / `docs_url` / `request_id`.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Repull
17
+ class PromotionBulkResponseSummary < ApiModelBase
18
+ attr_accessor :succeeded
19
+
20
+ attr_accessor :failed
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'succeeded' => :'succeeded',
26
+ :'failed' => :'failed'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'succeeded' => :'Integer',
44
+ :'failed' => :'Integer'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::PromotionBulkResponseSummary` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::PromotionBulkResponseSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'succeeded')
71
+ self.succeeded = attributes[:'succeeded']
72
+ end
73
+
74
+ if attributes.key?(:'failed')
75
+ self.failed = attributes[:'failed']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ succeeded == o.succeeded &&
100
+ failed == o.failed
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [succeeded, failed].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ attributes = attributes.transform_keys(&:to_sym)
121
+ transformed_hash = {}
122
+ openapi_types.each_pair do |key, type|
123
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = nil
125
+ elsif type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[attribute_map[key]].is_a?(Array)
129
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
130
+ end
131
+ elsif !attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
133
+ end
134
+ end
135
+ new(transformed_hash)
136
+ end
137
+
138
+ # Returns the object in the form of hash
139
+ # @return [Hash] Returns the object in the form of hash
140
+ def to_hash
141
+ hash = {}
142
+ self.class.attribute_map.each_pair do |attr, param|
143
+ value = self.send(attr)
144
+ if value.nil?
145
+ is_nullable = self.class.openapi_nullable.include?(attr)
146
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
147
+ end
148
+
149
+ hash[param] = _to_hash(value)
150
+ end
151
+ hash
152
+ end
153
+
154
+ end
155
+
156
+ end
@@ -14,20 +14,16 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Repull
17
- # A Plumguide listing.
18
- class PlumguideListing < ApiModelBase
19
- attr_accessor :id
17
+ class PromotionCatalog < ApiModelBase
18
+ attr_accessor :listing_id
20
19
 
21
- attr_accessor :name
22
-
23
- attr_accessor :status
20
+ attr_accessor :channels
24
21
 
25
22
  # Attribute mapping from ruby-style variable name to JSON key.
26
23
  def self.attribute_map
27
24
  {
28
- :'id' => :'id',
29
- :'name' => :'name',
30
- :'status' => :'status'
25
+ :'listing_id' => :'listingId',
26
+ :'channels' => :'channels'
31
27
  }
32
28
  end
33
29
 
@@ -44,16 +40,14 @@ module Repull
44
40
  # Attribute type mapping.
45
41
  def self.openapi_types
46
42
  {
47
- :'id' => :'String',
48
- :'name' => :'String',
49
- :'status' => :'String'
43
+ :'listing_id' => :'String',
44
+ :'channels' => :'Array<PromotionCatalogChannelsInner>'
50
45
  }
51
46
  end
52
47
 
53
48
  # List of attributes with nullable: true
54
49
  def self.openapi_nullable
55
50
  Set.new([
56
- :'status'
57
51
  ])
58
52
  end
59
53
 
@@ -61,28 +55,26 @@ module Repull
61
55
  # @param [Hash] attributes Model attributes in the form of hash
62
56
  def initialize(attributes = {})
63
57
  if (!attributes.is_a?(Hash))
64
- fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::PlumguideListing` initialize method"
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::PromotionCatalog` initialize method"
65
59
  end
66
60
 
67
61
  # check to see if the attribute exists and convert string to symbol for hash key
68
62
  acceptable_attribute_map = self.class.acceptable_attribute_map
69
63
  attributes = attributes.each_with_object({}) { |(k, v), h|
70
64
  if (!acceptable_attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::PlumguideListing`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::PromotionCatalog`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
72
66
  end
73
67
  h[k.to_sym] = v
74
68
  }
75
69
 
76
- if attributes.key?(:'id')
77
- self.id = attributes[:'id']
78
- end
79
-
80
- if attributes.key?(:'name')
81
- self.name = attributes[:'name']
70
+ if attributes.key?(:'listing_id')
71
+ self.listing_id = attributes[:'listing_id']
82
72
  end
83
73
 
84
- if attributes.key?(:'status')
85
- self.status = attributes[:'status']
74
+ if attributes.key?(:'channels')
75
+ if (value = attributes[:'channels']).is_a?(Array)
76
+ self.channels = value
77
+ end
86
78
  end
87
79
  end
88
80
 
@@ -106,9 +98,8 @@ module Repull
106
98
  def ==(o)
107
99
  return true if self.equal?(o)
108
100
  self.class == o.class &&
109
- id == o.id &&
110
- name == o.name &&
111
- status == o.status
101
+ listing_id == o.listing_id &&
102
+ channels == o.channels
112
103
  end
113
104
 
114
105
  # @see the `==` method
@@ -120,7 +111,7 @@ module Repull
120
111
  # Calculates hash code according to all attributes.
121
112
  # @return [Integer] Hash code
122
113
  def hash
123
- [id, name, status].hash
114
+ [listing_id, channels].hash
124
115
  end
125
116
 
126
117
  # Builds the object from hash
@@ -0,0 +1,222 @@
1
+ =begin
2
+ #Repull API
3
+
4
+ #The unified API for vacation rental tech. Connect to 50+ PMS platforms and 4 OTA channels through one REST API. Built-in AI operations for guest communication, pricing, and listing optimization. ## Designed for AI agents Every error response on this API includes machine-parseable fields so an LLM (Claude in MCP, Cursor, Cline, GPT, etc.) can self-recover without escalating to a human: - `error.code` — stable string identifier (e.g. `invalid_params`, `rate_limit_exceeded`) - `error.message` — human-readable cause - `error.fix` — exact recovery steps (e.g. \"Pass `check_in_after` as ISO 8601: `?check_in_after=2026-01-15`\") - `error.docs_url` — link to the canonical write-up at `https://repull.dev/docs/errors/{code}` - `error.request_id` — id to correlate with server-side logs - `error.field` / `error.value_received` / `error.valid_values` / `error.did_you_mean` — when the error is parameter-specific - `error.retry_after` — seconds to wait before retrying (rate-limit + transient upstream) `Access-Control-Expose-Headers` lists `x-request-id` and the `X-RateLimit-*` family so browsers can read them on cross-origin responses. ## Quick Start 1. Get an API key at https://repull.dev/dashboard 2. Connect a PMS: `POST /v1/connect/{provider}` 3. List properties: `GET /v1/properties` 4. Get reservations: `GET /v1/reservations` ## Authentication All requests require a Bearer token: ``` Authorization: Bearer sk_live_YOUR_API_KEY ``` ## Request Correlation (X-Request-ID) Every response carries an `X-Request-ID` header, e.g. `X-Request-ID: req_01HXY...`. Include this id in support tickets and bug reports — we can trace the full request lifecycle (auth, rate limit, handler, downstream calls, log row) from a single id. You may set the header on the inbound request to forward your own trace id; we will echo it back instead of generating a new one. Accepted format: `^[\\\\w.-]{1,128}$`. The id is also embedded in error envelopes as `request_id` so server-side log diffs work even when the response headers are stripped by an intermediate proxy. ## Rate Limits The public API enforces a per-API-key sliding-window rate limit on top of the per-tier monthly + daily-AI quotas. **Default policy:** 600 requests per 60 seconds, per API key. Sliding window — there is no fixed-minute boundary you can burst across. Every response includes: | Header | Meaning | |---|---| | `X-RateLimit-Limit` | Requests permitted in the current window. | | `X-RateLimit-Remaining` | Requests left in the current window after this call. | | `X-RateLimit-Reset` | Unix epoch (seconds) when the next slot opens. | | `X-RateLimit-Policy` | Machine-readable policy descriptor, e.g. `600;w=60`. | | `Retry-After` | Seconds to wait before retrying. **Only present on 429 responses.** | **On 429 (rate_limit_exceeded):** the response body matches the standard error envelope with `code: \"rate_limit_exceeded\"`, plus `limit`, `window_seconds`, `retry_after`, and `request_id` fields. SDKs MUST honor `Retry-After` and use exponential backoff with jitter on subsequent retries — never a tight loop. Recommended backoff: ``` sleep_ms = (Retry-After * 1000) + random(0..250) ``` Monthly + daily-AI tier quotas (`free`, `starter`, `custom`) are enforced separately and also surface as 429s; they include `tier`, `scope`, and `resetsAt` fields. ## Plan Limits (402 — `listings_limit_exceeded`) The Repull API also enforces a per-tier cap on **active listings**: | Tier | Active listings cap | |---|---| | `free` | 3 | | `starter` | unlimited (10 included, then billed per listing) | | `custom` | unlimited | When a customer's active-listing count is above their tier cap, the API returns **`402 Payment Required`** with `error.code = \"listings_limit_exceeded\"` on every route EXCEPT: - `/v1/health` — uptime probes are never gated. - `/v1/usage/*` — so dashboards can render the over-cap state. - Any `DELETE` — so the customer can trim listings to get back under the cap without paying. Unlike 429, 402 is NOT a \"wait and retry\" condition — `Retry-After` is not set. The only paths back to 200 are: 1. `DELETE` enough listings to come back under the cap, or 2. Upgrade at `https://repull.dev/dashboard/billing`. The server-side usage cache is 60s, so the first 200 after an upgrade may take up to a minute. The envelope mirrors `rate_limit_exceeded` for SDK ergonomics: `tier`, `limit`, `active_listings`, `upgrade_url`, plus the standard `code` / `message` / `fix` / `docs_url` / `request_id`.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Repull
17
+ class PromotionCatalogChannelsInner < ApiModelBase
18
+ attr_accessor :channel
19
+
20
+ attr_accessor :connected
21
+
22
+ attr_accessor :reason
23
+
24
+ # Booking.com properties the listing has a room on.
25
+ attr_accessor :properties
26
+
27
+ attr_accessor :entries
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'channel' => :'channel',
55
+ :'connected' => :'connected',
56
+ :'reason' => :'reason',
57
+ :'properties' => :'properties',
58
+ :'entries' => :'entries'
59
+ }
60
+ end
61
+
62
+ # Returns attribute mapping this model knows about
63
+ def self.acceptable_attribute_map
64
+ attribute_map
65
+ end
66
+
67
+ # Returns all the JSON keys this model knows about
68
+ def self.acceptable_attributes
69
+ acceptable_attribute_map.values
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'channel' => :'String',
76
+ :'connected' => :'Boolean',
77
+ :'reason' => :'String',
78
+ :'properties' => :'Array<String>',
79
+ :'entries' => :'Array<PromotionCatalogEntry>'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::PromotionCatalogChannelsInner` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ acceptable_attribute_map = self.class.acceptable_attribute_map
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!acceptable_attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::PromotionCatalogChannelsInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'channel')
106
+ self.channel = attributes[:'channel']
107
+ end
108
+
109
+ if attributes.key?(:'connected')
110
+ self.connected = attributes[:'connected']
111
+ end
112
+
113
+ if attributes.key?(:'reason')
114
+ self.reason = attributes[:'reason']
115
+ end
116
+
117
+ if attributes.key?(:'properties')
118
+ if (value = attributes[:'properties']).is_a?(Array)
119
+ self.properties = value
120
+ end
121
+ end
122
+
123
+ if attributes.key?(:'entries')
124
+ if (value = attributes[:'entries']).is_a?(Array)
125
+ self.entries = value
126
+ end
127
+ end
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properties with the reasons
132
+ def list_invalid_properties
133
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
134
+ invalid_properties = Array.new
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ warn '[DEPRECATED] the `valid?` method is obsolete'
142
+ channel_validator = EnumAttributeValidator.new('String', ["airbnb", "booking"])
143
+ return false unless channel_validator.valid?(@channel)
144
+ true
145
+ end
146
+
147
+ # Custom attribute writer method checking allowed values (enum).
148
+ # @param [Object] channel Object to be assigned
149
+ def channel=(channel)
150
+ validator = EnumAttributeValidator.new('String', ["airbnb", "booking"])
151
+ unless validator.valid?(channel)
152
+ fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}."
153
+ end
154
+ @channel = channel
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(o)
160
+ return true if self.equal?(o)
161
+ self.class == o.class &&
162
+ channel == o.channel &&
163
+ connected == o.connected &&
164
+ reason == o.reason &&
165
+ properties == o.properties &&
166
+ entries == o.entries
167
+ end
168
+
169
+ # @see the `==` method
170
+ # @param [Object] Object to be compared
171
+ def eql?(o)
172
+ self == o
173
+ end
174
+
175
+ # Calculates hash code according to all attributes.
176
+ # @return [Integer] Hash code
177
+ def hash
178
+ [channel, connected, reason, properties, entries].hash
179
+ end
180
+
181
+ # Builds the object from hash
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ # @return [Object] Returns the model itself
184
+ def self.build_from_hash(attributes)
185
+ return nil unless attributes.is_a?(Hash)
186
+ attributes = attributes.transform_keys(&:to_sym)
187
+ transformed_hash = {}
188
+ openapi_types.each_pair do |key, type|
189
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
190
+ transformed_hash["#{key}"] = nil
191
+ elsif type =~ /\AArray<(.*)>/i
192
+ # check to ensure the input is an array given that the attribute
193
+ # is documented as an array but the input is not
194
+ if attributes[attribute_map[key]].is_a?(Array)
195
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
196
+ end
197
+ elsif !attributes[attribute_map[key]].nil?
198
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
199
+ end
200
+ end
201
+ new(transformed_hash)
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ end
221
+
222
+ end