leal 0.0.9

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 (127) hide show
  1. checksums.yaml +7 -0
  2. data/.fern/metadata.json +10 -0
  3. data/.fernignore +1 -0
  4. data/.rubocop.yml +103 -0
  5. data/CONTRIBUTING.md +120 -0
  6. data/LICENSE +21 -0
  7. data/README.md +185 -0
  8. data/Rakefile +20 -0
  9. data/custom.gemspec.rb +16 -0
  10. data/lib/leal/cards/client.rb +193 -0
  11. data/lib/leal/cards/types/create_cards_request.rb +13 -0
  12. data/lib/leal/cards/types/create_cards_request_card.rb +33 -0
  13. data/lib/leal/cards/types/create_cards_response.rb +45 -0
  14. data/lib/leal/cards/types/get_cards_request.rb +13 -0
  15. data/lib/leal/cards/types/get_cards_response.rb +45 -0
  16. data/lib/leal/cards/types/list_cards_request.rb +13 -0
  17. data/lib/leal/cards/types/list_cards_response_item.rb +45 -0
  18. data/lib/leal/cards/types/update_cards_request.rb +15 -0
  19. data/lib/leal/cards/types/update_cards_request_card.rb +33 -0
  20. data/lib/leal/cards/types/update_cards_response.rb +45 -0
  21. data/lib/leal/client.rb +62 -0
  22. data/lib/leal/customer_cards/client.rb +203 -0
  23. data/lib/leal/customer_cards/types/get_customer_cards_request.rb +15 -0
  24. data/lib/leal/customer_cards/types/get_customer_cards_response.rb +43 -0
  25. data/lib/leal/customer_cards/types/list_customer_cards_request.rb +13 -0
  26. data/lib/leal/customer_cards/types/list_customer_cards_response_item.rb +37 -0
  27. data/lib/leal/customer_cards/types/redeem_customer_cards_request.rb +17 -0
  28. data/lib/leal/customer_cards/types/redeem_customer_cards_response.rb +13 -0
  29. data/lib/leal/customer_cards/types/redeem_customer_cards_response_redemption.rb +21 -0
  30. data/lib/leal/customer_cards/types/stamp_customer_cards_request.rb +19 -0
  31. data/lib/leal/customer_cards/types/stamp_customer_cards_response.rb +43 -0
  32. data/lib/leal/customers/client.rb +217 -0
  33. data/lib/leal/customers/types/create_customers_request.rb +17 -0
  34. data/lib/leal/customers/types/create_customers_request_customer.rb +23 -0
  35. data/lib/leal/customers/types/create_customers_response.rb +35 -0
  36. data/lib/leal/customers/types/get_customers_request.rb +13 -0
  37. data/lib/leal/customers/types/get_customers_response.rb +35 -0
  38. data/lib/leal/customers/types/list_customers_request.rb +21 -0
  39. data/lib/leal/customers/types/list_customers_response.rb +13 -0
  40. data/lib/leal/customers/types/list_customers_response_pagination.rb +17 -0
  41. data/lib/leal/customers/types/update_customers_request.rb +15 -0
  42. data/lib/leal/customers/types/update_customers_request_customer.rb +23 -0
  43. data/lib/leal/customers/types/update_customers_response.rb +35 -0
  44. data/lib/leal/environment.rb +7 -0
  45. data/lib/leal/errors/api_error.rb +8 -0
  46. data/lib/leal/errors/client_error.rb +17 -0
  47. data/lib/leal/errors/redirect_error.rb +8 -0
  48. data/lib/leal/errors/response_error.rb +42 -0
  49. data/lib/leal/errors/server_error.rb +11 -0
  50. data/lib/leal/errors/timeout_error.rb +8 -0
  51. data/lib/leal/internal/errors/constraint_error.rb +10 -0
  52. data/lib/leal/internal/errors/type_error.rb +10 -0
  53. data/lib/leal/internal/http/base_request.rb +51 -0
  54. data/lib/leal/internal/http/raw_client.rb +265 -0
  55. data/lib/leal/internal/iterators/cursor_item_iterator.rb +28 -0
  56. data/lib/leal/internal/iterators/cursor_page_iterator.rb +63 -0
  57. data/lib/leal/internal/iterators/item_iterator.rb +65 -0
  58. data/lib/leal/internal/iterators/offset_item_iterator.rb +30 -0
  59. data/lib/leal/internal/iterators/offset_page_iterator.rb +103 -0
  60. data/lib/leal/internal/json/request.rb +41 -0
  61. data/lib/leal/internal/json/serializable.rb +25 -0
  62. data/lib/leal/internal/multipart/multipart_encoder.rb +141 -0
  63. data/lib/leal/internal/multipart/multipart_form_data.rb +78 -0
  64. data/lib/leal/internal/multipart/multipart_form_data_part.rb +51 -0
  65. data/lib/leal/internal/multipart/multipart_request.rb +40 -0
  66. data/lib/leal/internal/types/array.rb +47 -0
  67. data/lib/leal/internal/types/boolean.rb +34 -0
  68. data/lib/leal/internal/types/enum.rb +56 -0
  69. data/lib/leal/internal/types/hash.rb +36 -0
  70. data/lib/leal/internal/types/model/field.rb +38 -0
  71. data/lib/leal/internal/types/model.rb +208 -0
  72. data/lib/leal/internal/types/type.rb +35 -0
  73. data/lib/leal/internal/types/union.rb +161 -0
  74. data/lib/leal/internal/types/unknown.rb +15 -0
  75. data/lib/leal/internal/types/utils.rb +116 -0
  76. data/lib/leal/locations/client.rb +225 -0
  77. data/lib/leal/locations/types/create_locations_request.rb +13 -0
  78. data/lib/leal/locations/types/create_locations_request_location.rb +13 -0
  79. data/lib/leal/locations/types/create_locations_response.rb +25 -0
  80. data/lib/leal/locations/types/delete_locations_request.rb +13 -0
  81. data/lib/leal/locations/types/get_locations_request.rb +13 -0
  82. data/lib/leal/locations/types/get_locations_response.rb +25 -0
  83. data/lib/leal/locations/types/list_locations_request.rb +11 -0
  84. data/lib/leal/locations/types/list_locations_response_item.rb +25 -0
  85. data/lib/leal/locations/types/update_locations_request.rb +15 -0
  86. data/lib/leal/locations/types/update_locations_request_location.rb +13 -0
  87. data/lib/leal/locations/types/update_locations_response.rb +25 -0
  88. data/lib/leal/posters/client.rb +232 -0
  89. data/lib/leal/posters/types/create_posters_request.rb +13 -0
  90. data/lib/leal/posters/types/create_posters_request_poster.rb +23 -0
  91. data/lib/leal/posters/types/create_posters_response.rb +37 -0
  92. data/lib/leal/posters/types/delete_posters_request.rb +13 -0
  93. data/lib/leal/posters/types/get_posters_request.rb +13 -0
  94. data/lib/leal/posters/types/get_posters_response.rb +37 -0
  95. data/lib/leal/posters/types/list_posters_request.rb +15 -0
  96. data/lib/leal/posters/types/list_posters_response_item.rb +37 -0
  97. data/lib/leal/posters/types/update_posters_request.rb +15 -0
  98. data/lib/leal/posters/types/update_posters_request_poster.rb +21 -0
  99. data/lib/leal/posters/types/update_posters_response.rb +37 -0
  100. data/lib/leal/rewards/client.rb +233 -0
  101. data/lib/leal/rewards/types/create_rewards_request.rb +13 -0
  102. data/lib/leal/rewards/types/create_rewards_request_reward.rb +21 -0
  103. data/lib/leal/rewards/types/create_rewards_response.rb +29 -0
  104. data/lib/leal/rewards/types/delete_rewards_request.rb +13 -0
  105. data/lib/leal/rewards/types/get_rewards_request.rb +13 -0
  106. data/lib/leal/rewards/types/get_rewards_response.rb +29 -0
  107. data/lib/leal/rewards/types/list_rewards_request.rb +15 -0
  108. data/lib/leal/rewards/types/list_rewards_response_item.rb +29 -0
  109. data/lib/leal/rewards/types/update_rewards_request.rb +15 -0
  110. data/lib/leal/rewards/types/update_rewards_request_reward.rb +19 -0
  111. data/lib/leal/rewards/types/update_rewards_response.rb +29 -0
  112. data/lib/leal/status/client.rb +53 -0
  113. data/lib/leal/status/types/check_status_response.rb +23 -0
  114. data/lib/leal/status/types/check_status_response_rate_limit.rb +15 -0
  115. data/lib/leal/stores/client.rb +130 -0
  116. data/lib/leal/stores/types/get_stores_request.rb +11 -0
  117. data/lib/leal/stores/types/get_stores_response.rb +31 -0
  118. data/lib/leal/stores/types/list_stores_response_item.rb +31 -0
  119. data/lib/leal/stores/types/update_stores_request.rb +13 -0
  120. data/lib/leal/stores/types/update_stores_request_account.rb +13 -0
  121. data/lib/leal/stores/types/update_stores_response.rb +31 -0
  122. data/lib/leal/types/error.rb +13 -0
  123. data/lib/leal/types/error_errors.rb +14 -0
  124. data/lib/leal/version.rb +5 -0
  125. data/lib/leal.rb +120 -0
  126. data/reference.md +2414 -0
  127. metadata +168 -0
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module CustomerCards
5
+ module Types
6
+ class RedeemCustomerCardsRequest < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :customer_id, -> { Integer }, optional: false, nullable: false
10
+
11
+ field :id, -> { Integer }, optional: false, nullable: false
12
+
13
+ field :reward_id, -> { Integer }, optional: false, nullable: false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module CustomerCards
5
+ module Types
6
+ class RedeemCustomerCardsResponse < Internal::Types::Model
7
+ field :redemption, -> { Leal::CustomerCards::Types::RedeemCustomerCardsResponseRedemption }, optional: false, nullable: false
8
+
9
+ field :success, -> { Internal::Types::Boolean }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module CustomerCards
5
+ module Types
6
+ class RedeemCustomerCardsResponseRedemption < Internal::Types::Model
7
+ field :id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :redeemed_at, -> { String }, optional: false, nullable: false
10
+
11
+ field :reward_id, -> { Integer }, optional: false, nullable: false
12
+
13
+ field :reward_name, -> { String }, optional: false, nullable: false
14
+
15
+ field :stamps_remaining, -> { Integer }, optional: false, nullable: false
16
+
17
+ field :stamps_spent, -> { Integer }, optional: false, nullable: false
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module CustomerCards
5
+ module Types
6
+ class StampCustomerCardsRequest < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :customer_id, -> { Integer }, optional: false, nullable: false
10
+
11
+ field :id, -> { Integer }, optional: false, nullable: false
12
+
13
+ field :skip_notifications, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
+
15
+ field :stamps, -> { Integer }, optional: false, nullable: false
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module CustomerCards
5
+ module Types
6
+ class StampCustomerCardsResponse < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :apple_wallet_url, -> { String }, optional: false, nullable: false
10
+
11
+ field :available_rewards, -> { Internal::Types::Array[String] }, optional: false, nullable: false
12
+
13
+ field :card_id, -> { Integer }, optional: false, nullable: false
14
+
15
+ field :card_name, -> { String }, optional: false, nullable: false
16
+
17
+ field :created_at, -> { String }, optional: false, nullable: false
18
+
19
+ field :customer_id, -> { Integer }, optional: false, nullable: false
20
+
21
+ field :google_wallet_url, -> { String }, optional: false, nullable: false
22
+
23
+ field :id, -> { Integer }, optional: false, nullable: false
24
+
25
+ field :issued_at, -> { String }, optional: false, nullable: false
26
+
27
+ field :pass_installed, -> { Internal::Types::Boolean }, optional: false, nullable: false
28
+
29
+ field :progress_percentage, -> { Integer }, optional: false, nullable: false
30
+
31
+ field :stamps_count, -> { Integer }, optional: false, nullable: false
32
+
33
+ field :stamps_remaining, -> { Integer }, optional: false, nullable: false
34
+
35
+ field :status, -> { String }, optional: false, nullable: false
36
+
37
+ field :updated_at, -> { String }, optional: false, nullable: false
38
+
39
+ field :uuid, -> { String }, optional: false, nullable: false
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,217 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ class Client
6
+ # @param client [Leal::Internal::Http::RawClient]
7
+ #
8
+ # @return [void]
9
+ def initialize(client:)
10
+ @client = client
11
+ end
12
+
13
+ # Returns a paginated list of customers for the store. Use the `search` parameter to filter
14
+ # by name, email, phone, card code (barcode), or external reference ID. Alternatively, pass
15
+ # `source` AND `external_id` together to perform an exact lookup by an external reference -
16
+ # the response will contain at most one customer.
17
+ #
18
+ # @param request_options [Hash]
19
+ # @param params [Hash]
20
+ # @option request_options [String] :base_url
21
+ # @option request_options [Hash{String => Object}] :additional_headers
22
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
23
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
24
+ # @option request_options [Integer] :timeout_in_seconds
25
+ # @option params [Integer] :account_id
26
+ # @option params [String, nil] :search
27
+ # @option params [String, nil] :source
28
+ # @option params [String, nil] :external_id
29
+ # @option params [Integer, nil] :page
30
+ # @option params [Integer, nil] :items
31
+ #
32
+ # @example
33
+ # client.customers.list(account_id: 1)
34
+ #
35
+ # @return [Leal::Customers::Types::ListCustomersResponse]
36
+ def list(request_options: {}, **params)
37
+ params = Leal::Internal::Types::Utils.normalize_keys(params)
38
+ query_params = {}
39
+ query_params["search"] = params[:search] if params.key?(:search)
40
+ query_params["source"] = params[:source] if params.key?(:source)
41
+ query_params["external_id"] = params[:external_id] if params.key?(:external_id)
42
+ query_params["page"] = params[:page] if params.key?(:page)
43
+ query_params["items"] = params[:items] if params.key?(:items)
44
+
45
+ request = Leal::Internal::JSON::Request.new(
46
+ base_url: request_options[:base_url],
47
+ method: "GET",
48
+ path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/customers",
49
+ query: query_params,
50
+ request_options: request_options
51
+ )
52
+ begin
53
+ response = @client.send(request)
54
+ rescue Net::HTTPRequestTimeout
55
+ raise Leal::Errors::TimeoutError
56
+ end
57
+ code = response.code.to_i
58
+ if code.between?(200, 299)
59
+ Leal::Customers::Types::ListCustomersResponse.load(response.body)
60
+ else
61
+ error_class = Leal::Errors::ResponseError.subclass_for_code(code)
62
+ raise error_class.new(response.body, code: code)
63
+ end
64
+ end
65
+
66
+ # Creates a new customer for the store. Requires `first_name` and at least one of `email` or `phone`.
67
+ # Optionally enroll the customer in a loyalty card by passing `card_id`, and trigger delivery of
68
+ # card links (email/SMS) by passing `send_card_links`. When a card with initial stamps is assigned,
69
+ # those stamps are automatically applied as a welcome bonus.
70
+ #
71
+ # Pass `metadata` to attach arbitrary key/value data, and `external_references` to link the
72
+ # customer to records in other systems (e.g. Square, Shopify). External references are upserted
73
+ # by `(source, external_id)` so this endpoint is safe to call with the same references twice.
74
+ #
75
+ # @param request_options [Hash]
76
+ # @param params [Leal::Customers::Types::CreateCustomersRequest]
77
+ # @option request_options [String] :base_url
78
+ # @option request_options [Hash{String => Object}] :additional_headers
79
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
80
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
81
+ # @option request_options [Integer] :timeout_in_seconds
82
+ # @option params [Integer] :account_id
83
+ #
84
+ # @example
85
+ # client.customers.create(
86
+ # account_id: 1,
87
+ # customer: {
88
+ # first_name: "first_name"
89
+ # }
90
+ # )
91
+ #
92
+ # @return [Leal::Customers::Types::CreateCustomersResponse]
93
+ def create(request_options: {}, **params)
94
+ params = Leal::Internal::Types::Utils.normalize_keys(params)
95
+ request_data = Leal::Customers::Types::CreateCustomersRequest.new(params).to_h
96
+ non_body_param_names = %w[account_id]
97
+ body = request_data.except(*non_body_param_names)
98
+
99
+ request = Leal::Internal::JSON::Request.new(
100
+ base_url: request_options[:base_url],
101
+ method: "POST",
102
+ path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/customers",
103
+ body: body,
104
+ request_options: request_options
105
+ )
106
+ begin
107
+ response = @client.send(request)
108
+ rescue Net::HTTPRequestTimeout
109
+ raise Leal::Errors::TimeoutError
110
+ end
111
+ code = response.code.to_i
112
+ if code.between?(200, 299)
113
+ Leal::Customers::Types::CreateCustomersResponse.load(response.body)
114
+ else
115
+ error_class = Leal::Errors::ResponseError.subclass_for_code(code)
116
+ raise error_class.new(response.body, code: code)
117
+ end
118
+ end
119
+
120
+ # Returns detailed information about a single customer, including all of their
121
+ # enrolled loyalty cards with stamp progress and wallet pass URLs (`apple_wallet_url`
122
+ # and `google_wallet_url`) for each card. Also includes `metadata` and
123
+ # `external_references` so you can sync state with external systems.
124
+ #
125
+ # @param request_options [Hash]
126
+ # @param params [Hash]
127
+ # @option request_options [String] :base_url
128
+ # @option request_options [Hash{String => Object}] :additional_headers
129
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
130
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
131
+ # @option request_options [Integer] :timeout_in_seconds
132
+ # @option params [Integer] :account_id
133
+ # @option params [Integer] :id
134
+ #
135
+ # @example
136
+ # client.customers.get(
137
+ # account_id: 1,
138
+ # id: 1
139
+ # )
140
+ #
141
+ # @return [Leal::Customers::Types::GetCustomersResponse]
142
+ def get(request_options: {}, **params)
143
+ params = Leal::Internal::Types::Utils.normalize_keys(params)
144
+ request = Leal::Internal::JSON::Request.new(
145
+ base_url: request_options[:base_url],
146
+ method: "GET",
147
+ path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/customers/#{URI.encode_uri_component(params[:id].to_s)}",
148
+ request_options: request_options
149
+ )
150
+ begin
151
+ response = @client.send(request)
152
+ rescue Net::HTTPRequestTimeout
153
+ raise Leal::Errors::TimeoutError
154
+ end
155
+ code = response.code.to_i
156
+ if code.between?(200, 299)
157
+ Leal::Customers::Types::GetCustomersResponse.load(response.body)
158
+ else
159
+ error_class = Leal::Errors::ResponseError.subclass_for_code(code)
160
+ raise error_class.new(response.body, code: code)
161
+ end
162
+ end
163
+
164
+ # Updates an existing customer's details. To add stamps or redeem rewards, use the
165
+ # customer cards endpoints instead.
166
+ #
167
+ # `metadata` is shallow-merged into the existing metadata. `external_references` are upserted
168
+ # by `(source, external_id)` - to remove a reference, omit it from subsequent calls and use
169
+ # a separate `DELETE` workflow (not yet exposed via API; manage in dashboard for now).
170
+ #
171
+ # @param request_options [Hash]
172
+ # @param params [Leal::Customers::Types::UpdateCustomersRequest]
173
+ # @option request_options [String] :base_url
174
+ # @option request_options [Hash{String => Object}] :additional_headers
175
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
176
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
177
+ # @option request_options [Integer] :timeout_in_seconds
178
+ # @option params [Integer] :account_id
179
+ # @option params [Integer] :id
180
+ #
181
+ # @example
182
+ # client.customers.update(
183
+ # account_id: 1,
184
+ # id: 1,
185
+ # customer: {}
186
+ # )
187
+ #
188
+ # @return [Leal::Customers::Types::UpdateCustomersResponse]
189
+ def update(request_options: {}, **params)
190
+ params = Leal::Internal::Types::Utils.normalize_keys(params)
191
+ request_data = Leal::Customers::Types::UpdateCustomersRequest.new(params).to_h
192
+ non_body_param_names = %w[account_id id]
193
+ body = request_data.except(*non_body_param_names)
194
+
195
+ request = Leal::Internal::JSON::Request.new(
196
+ base_url: request_options[:base_url],
197
+ method: "PATCH",
198
+ path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/customers/#{URI.encode_uri_component(params[:id].to_s)}",
199
+ body: body,
200
+ request_options: request_options
201
+ )
202
+ begin
203
+ response = @client.send(request)
204
+ rescue Net::HTTPRequestTimeout
205
+ raise Leal::Errors::TimeoutError
206
+ end
207
+ code = response.code.to_i
208
+ if code.between?(200, 299)
209
+ Leal::Customers::Types::UpdateCustomersResponse.load(response.body)
210
+ else
211
+ error_class = Leal::Errors::ResponseError.subclass_for_code(code)
212
+ raise error_class.new(response.body, code: code)
213
+ end
214
+ end
215
+ end
216
+ end
217
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class CreateCustomersRequest < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :card_id, -> { Integer }, optional: true, nullable: false
10
+
11
+ field :customer, -> { Leal::Customers::Types::CreateCustomersRequestCustomer }, optional: false, nullable: false
12
+
13
+ field :send_card_links, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class CreateCustomersRequestCustomer < Internal::Types::Model
7
+ field :birthday, -> { String }, optional: true, nullable: false
8
+
9
+ field :email, -> { String }, optional: true, nullable: false
10
+
11
+ field :external_references, -> { Internal::Types::Array[String] }, optional: true, nullable: false
12
+
13
+ field :first_name, -> { String }, optional: false, nullable: false
14
+
15
+ field :last_name, -> { String }, optional: true, nullable: false
16
+
17
+ field :metadata, -> { Internal::Types::Hash[String, Object] }, optional: true, nullable: false
18
+
19
+ field :phone, -> { String }, optional: true, nullable: false
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class CreateCustomersResponse < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :birthday, -> { String }, optional: false, nullable: false
10
+
11
+ field :created_at, -> { String }, optional: false, nullable: false
12
+
13
+ field :customer_cards, -> { Internal::Types::Array[String] }, optional: false, nullable: false
14
+
15
+ field :email, -> { String }, optional: false, nullable: false
16
+
17
+ field :external_references, -> { Internal::Types::Array[String] }, optional: false, nullable: false
18
+
19
+ field :first_name, -> { String }, optional: false, nullable: false
20
+
21
+ field :id, -> { Integer }, optional: false, nullable: false
22
+
23
+ field :last_name, -> { String }, optional: false, nullable: false
24
+
25
+ field :metadata, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
26
+
27
+ field :phone, -> { String }, optional: false, nullable: false
28
+
29
+ field :stamp_count, -> { Integer }, optional: false, nullable: false
30
+
31
+ field :updated_at, -> { String }, optional: false, nullable: false
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class GetCustomersRequest < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :id, -> { Integer }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class GetCustomersResponse < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :birthday, -> { String }, optional: false, nullable: false
10
+
11
+ field :created_at, -> { String }, optional: false, nullable: false
12
+
13
+ field :customer_cards, -> { Internal::Types::Array[String] }, optional: false, nullable: false
14
+
15
+ field :email, -> { String }, optional: false, nullable: false
16
+
17
+ field :external_references, -> { Internal::Types::Array[String] }, optional: false, nullable: false
18
+
19
+ field :first_name, -> { String }, optional: false, nullable: false
20
+
21
+ field :id, -> { Integer }, optional: false, nullable: false
22
+
23
+ field :last_name, -> { String }, optional: false, nullable: false
24
+
25
+ field :metadata, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
26
+
27
+ field :phone, -> { String }, optional: false, nullable: false
28
+
29
+ field :stamp_count, -> { Integer }, optional: false, nullable: false
30
+
31
+ field :updated_at, -> { String }, optional: false, nullable: false
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class ListCustomersRequest < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :search, -> { String }, optional: true, nullable: false
10
+
11
+ field :source, -> { String }, optional: true, nullable: false
12
+
13
+ field :external_id, -> { String }, optional: true, nullable: false
14
+
15
+ field :page, -> { Integer }, optional: true, nullable: false
16
+
17
+ field :items, -> { Integer }, optional: true, nullable: false
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class ListCustomersResponse < Internal::Types::Model
7
+ field :customers, -> { Internal::Types::Array[String] }, optional: false, nullable: false
8
+
9
+ field :pagination, -> { Leal::Customers::Types::ListCustomersResponsePagination }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class ListCustomersResponsePagination < Internal::Types::Model
7
+ field :count, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :items, -> { Integer }, optional: false, nullable: false
10
+
11
+ field :page, -> { Integer }, optional: false, nullable: false
12
+
13
+ field :pages, -> { Integer }, optional: false, nullable: false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class UpdateCustomersRequest < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :id, -> { Integer }, optional: false, nullable: false
10
+
11
+ field :customer, -> { Leal::Customers::Types::UpdateCustomersRequestCustomer }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class UpdateCustomersRequestCustomer < Internal::Types::Model
7
+ field :birthday, -> { String }, optional: true, nullable: false
8
+
9
+ field :email, -> { String }, optional: true, nullable: false
10
+
11
+ field :external_references, -> { Internal::Types::Array[String] }, optional: true, nullable: false
12
+
13
+ field :first_name, -> { String }, optional: true, nullable: false
14
+
15
+ field :last_name, -> { String }, optional: true, nullable: false
16
+
17
+ field :metadata, -> { Internal::Types::Hash[String, Object] }, optional: true, nullable: false
18
+
19
+ field :phone, -> { String }, optional: true, nullable: false
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Customers
5
+ module Types
6
+ class UpdateCustomersResponse < Internal::Types::Model
7
+ field :account_id, -> { Integer }, optional: false, nullable: false
8
+
9
+ field :birthday, -> { String }, optional: false, nullable: false
10
+
11
+ field :created_at, -> { String }, optional: false, nullable: false
12
+
13
+ field :customer_cards, -> { Internal::Types::Array[String] }, optional: false, nullable: false
14
+
15
+ field :email, -> { String }, optional: false, nullable: false
16
+
17
+ field :external_references, -> { Internal::Types::Array[String] }, optional: false, nullable: false
18
+
19
+ field :first_name, -> { String }, optional: false, nullable: false
20
+
21
+ field :id, -> { Integer }, optional: false, nullable: false
22
+
23
+ field :last_name, -> { String }, optional: false, nullable: false
24
+
25
+ field :metadata, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
26
+
27
+ field :phone, -> { String }, optional: false, nullable: false
28
+
29
+ field :stamp_count, -> { Integer }, optional: false, nullable: false
30
+
31
+ field :updated_at, -> { String }, optional: false, nullable: false
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ class Environment
5
+ PRODUCTION = "https://app.getleal.com"
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Errors
5
+ class ApiError < StandardError
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Errors
5
+ class ClientError < ResponseError
6
+ end
7
+
8
+ class UnauthorizedError < ClientError
9
+ end
10
+
11
+ class ForbiddenError < ClientError
12
+ end
13
+
14
+ class NotFoundError < ClientError
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leal
4
+ module Errors
5
+ class RedirectError < ResponseError
6
+ end
7
+ end
8
+ end