lithic 0.1.0.pre.alpha.15 → 0.1.0.pre.alpha.17

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/README.md +61 -52
  4. data/lib/lithic/client.rb +4 -4
  5. data/lib/lithic/internal/transport/pooled_net_requester.rb +1 -5
  6. data/lib/lithic/internal/type/array_of.rb +9 -0
  7. data/lib/lithic/internal/type/base_model.rb +29 -13
  8. data/lib/lithic/internal/type/base_page.rb +8 -0
  9. data/lib/lithic/internal/type/boolean.rb +4 -0
  10. data/lib/lithic/internal/type/enum.rb +9 -0
  11. data/lib/lithic/internal/type/hash_of.rb +9 -0
  12. data/lib/lithic/internal/type/io_like.rb +4 -0
  13. data/lib/lithic/internal/type/union.rb +10 -1
  14. data/lib/lithic/internal/type/unknown.rb +4 -0
  15. data/lib/lithic/internal.rb +0 -1
  16. data/lib/lithic/models/account.rb +3 -0
  17. data/lib/lithic/models/account_holder.rb +2 -0
  18. data/lib/lithic/models/account_holder_create_params.rb +2 -0
  19. data/lib/lithic/models/account_holder_update_params.rb +2 -0
  20. data/lib/lithic/models/account_update_params.rb +2 -0
  21. data/lib/lithic/models/card.rb +28 -0
  22. data/lib/lithic/models/kyb.rb +2 -0
  23. data/lib/lithic/models/{card_list_response.rb → non_pci_card.rb} +31 -29
  24. data/lib/lithic/models/settlement_report.rb +12 -0
  25. data/lib/lithic/models/transaction.rb +16 -0
  26. data/lib/lithic/resources/cards.rb +16 -16
  27. data/lib/lithic/version.rb +1 -1
  28. data/lib/lithic.rb +2 -17
  29. data/rbi/lib/lithic/client.rbi +4 -4
  30. data/rbi/lib/lithic/internal/type/array_of.rbi +3 -0
  31. data/rbi/lib/lithic/internal/type/base_model.rbi +6 -1
  32. data/rbi/lib/lithic/internal/type/base_page.rbi +2 -0
  33. data/rbi/lib/lithic/internal/type/enum.rbi +3 -0
  34. data/rbi/lib/lithic/internal/type/hash_of.rbi +3 -0
  35. data/rbi/lib/lithic/internal/type/union.rbi +3 -0
  36. data/rbi/lib/lithic/internal.rbi +0 -1
  37. data/rbi/lib/lithic/models/card.rbi +30 -0
  38. data/rbi/lib/lithic/models/{card_list_response.rbi → non_pci_card.rbi} +59 -60
  39. data/rbi/lib/lithic/resources/cards.rbi +8 -8
  40. data/sig/lithic/internal/type/array_of.rbs +2 -0
  41. data/sig/lithic/internal/type/base_model.rbs +4 -0
  42. data/sig/lithic/internal/type/enum.rbs +2 -0
  43. data/sig/lithic/internal/type/hash_of.rbs +2 -0
  44. data/sig/lithic/internal/type/union.rbs +2 -0
  45. data/sig/lithic/models/card.rbs +19 -0
  46. data/sig/lithic/models/{card_list_response.rbs → non_pci_card.rbs} +31 -31
  47. data/sig/lithic/resources/cards.rbs +8 -8
  48. metadata +8 -26
  49. data/lib/lithic/models/card_convert_physical_response.rb +0 -391
  50. data/lib/lithic/models/card_create_response.rb +0 -390
  51. data/lib/lithic/models/card_reissue_response.rb +0 -390
  52. data/lib/lithic/models/card_renew_response.rb +0 -390
  53. data/lib/lithic/models/card_retrieve_response.rb +0 -390
  54. data/lib/lithic/models/card_search_by_pan_response.rb +0 -390
  55. data/lib/lithic/models/card_update_response.rb +0 -390
  56. data/rbi/lib/lithic/models/card_convert_physical_response.rbi +0 -467
  57. data/rbi/lib/lithic/models/card_create_response.rbi +0 -458
  58. data/rbi/lib/lithic/models/card_reissue_response.rbi +0 -458
  59. data/rbi/lib/lithic/models/card_renew_response.rbi +0 -457
  60. data/rbi/lib/lithic/models/card_retrieve_response.rbi +0 -459
  61. data/rbi/lib/lithic/models/card_search_by_pan_response.rbi +0 -461
  62. data/rbi/lib/lithic/models/card_update_response.rbi +0 -458
  63. data/sig/lithic/models/card_convert_physical_response.rbs +0 -257
  64. data/sig/lithic/models/card_create_response.rbs +0 -257
  65. data/sig/lithic/models/card_reissue_response.rbs +0 -257
  66. data/sig/lithic/models/card_renew_response.rbs +0 -257
  67. data/sig/lithic/models/card_retrieve_response.rbs +0 -257
  68. data/sig/lithic/models/card_search_by_pan_response.rbs +0 -257
  69. data/sig/lithic/models/card_update_response.rbs +0 -257
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fafc3f795882ee224abd07c56daed52c0b894f76cbe97f9b6c578b06ba3aa40
4
- data.tar.gz: d04f5e51cdbf0596b57cae1baad86dfd0991ff677396248ff78520d98d3409bd
3
+ metadata.gz: d994bf8972c5500b7885b05e3d656c7dda04419796c1abb50218bbe4144e6a1a
4
+ data.tar.gz: 2f12393da601f3a7877b0b648bf6ff8bbe294cf690889934e9a9883c0ec9bc50
5
5
  SHA512:
6
- metadata.gz: 869dd1a4561a4d622d02dd694ec56173da240e7cd1e4505cb20994af65ab1c27c5c464cbedecabbd7d81474ec4e057fba8647ade3cee8bb133bb488c7d400264
7
- data.tar.gz: ba0ab63186ac15a2d57b4d44d2e6c75e8f7853101076ca17032b152bf3e5223765bea88e77aaf94e37c3fa82508bbcd3e1d9b5a0f46f22bdcdbe0866cf128568
6
+ metadata.gz: 033661aaae27e014d00dc52cbb53c631ba2bfb5e604cc7a73d3a0a9e8fa9f00c9f88f34f288275fb548fac171de6c3920a6e88f76be0ba350f8312037a68b157
7
+ data.tar.gz: 6da37fe057e86fde01f7bbdaec2bbec7c36d9d474dc2c6cdc15cc093bedebe7a161cc222686d6fe53011a2077c8aa77109a8e28931a0087be936ed7ba55b51ae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.17 (2025-04-21)
4
+
5
+ Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/lithic-com/lithic-ruby/compare/v0.1.0-alpha.16...v0.1.0-alpha.17)
6
+
7
+ ### Bug Fixes
8
+
9
+ * **internals:** fix Card schema definition ([1a3d18b](https://github.com/lithic-com/lithic-ruby/commit/1a3d18be7e1817fad98013b032defbaa5663b354))
10
+
11
+ ## 0.1.0-alpha.16 (2025-04-21)
12
+
13
+ Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/lithic-com/lithic-ruby/compare/v0.1.0-alpha.15...v0.1.0-alpha.16)
14
+
15
+ ### Features
16
+
17
+ * implement `#hash` for data containers ([7e1420b](https://github.com/lithic-com/lithic-ruby/commit/7e1420bfec9d254eacd77be001cefbad637c7f63))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **internal:** refresh schemas ([cb47b40](https://github.com/lithic-com/lithic-ruby/commit/cb47b40b1aa544d6e6f8fb3f27153ec03cfd6904))
23
+
24
+
25
+ ### Chores
26
+
27
+ * documentation improvements ([6700ace](https://github.com/lithic-com/lithic-ruby/commit/6700aced32a478a1c301a3b7e3efee908c5d224e))
28
+ * explicitly mark apis public under `Internal` module ([b81d240](https://github.com/lithic-com/lithic-ruby/commit/b81d240b2048754f45ffe14c446490bce83bfce5))
29
+ * update README with recommended editor plugins ([80d5967](https://github.com/lithic-com/lithic-ruby/commit/80d5967d1e747cbd42e66a570f6520e241a64ba8))
30
+
3
31
  ## 0.1.0-alpha.15 (2025-04-18)
4
32
 
5
33
  Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/lithic-com/lithic-ruby/compare/v0.1.0-alpha.14...v0.1.0-alpha.15)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "lithic", "~> 0.1.0.pre.alpha.15"
18
+ gem "lithic", "~> 0.1.0.pre.alpha.17"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -31,11 +31,21 @@ lithic = Lithic::Client.new(
31
31
  environment: "sandbox" # defaults to "production"
32
32
  )
33
33
 
34
- card = lithic.cards.create(type: "SINGLE_USE")
34
+ card = lithic.cards.create(type: :SINGLE_USE)
35
35
 
36
36
  puts(card.token)
37
37
  ```
38
38
 
39
+ ## Sorbet
40
+
41
+ This library is written with [Sorbet type definitions](https://sorbet.org/docs/rbi). However, there is no runtime dependency on the `sorbet-runtime`.
42
+
43
+ When using sorbet, it is recommended to use model classes as below. This provides stronger type checking and tooling integration.
44
+
45
+ ```ruby
46
+ lithic.cards.create(type: :SINGLE_USE)
47
+ ```
48
+
39
49
  ### Pagination
40
50
 
41
51
  List methods in the Lithic API are paginated.
@@ -61,7 +71,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
61
71
 
62
72
  ```ruby
63
73
  begin
64
- card = lithic.cards.create(type: "an_incorrect_type")
74
+ card = lithic.cards.create(type: :an_incorrect_type)
65
75
  rescue Lithic::Errors::APIError => e
66
76
  puts(e.status) # 400
67
77
  end
@@ -119,61 +129,32 @@ lithic = Lithic::Client.new(
119
129
  lithic.cards.list(page_size: 10, request_options: {timeout: 5})
120
130
  ```
121
131
 
122
- ## LSP Support
123
-
124
- ### Solargraph
125
-
126
- This library includes [Solargraph](https://solargraph.org) support for both auto completion and go to definition.
127
-
128
- ```ruby
129
- gem "solargraph", group: :development
130
- ```
131
-
132
- After Solargraph is installed, **you must populate its index** either via the provided editor command, or by running the following in your terminal:
133
-
134
- ```sh
135
- bundle exec solargraph gems
136
- ```
137
-
138
- Note: if you had installed the gem either using a `git:` or `github:` URL, or had vendored the gem using bundler, you will need to set up your [`.solargraph.yml`](https://solargraph.org/guides/configuration) to include the path to the gem's `lib` directory.
139
-
140
- ```yaml
141
- include:
142
- - 'vendor/bundle/ruby/*/gems/lithic-*/lib/**/*.rb'
143
- ```
144
-
145
- Otherwise Solargraph will not be able to provide type information or auto-completion for any non-indexed libraries.
146
-
147
- ### Sorbet
148
-
149
- This library is written with [Sorbet type definitions](https://sorbet.org/docs/rbi). However, there is no runtime dependency on the `sorbet-runtime`.
132
+ ## Model DSL
150
133
 
151
- What this means is that while you can use Sorbet to type check your code statically, and benefit from the [Sorbet Language Server](https://sorbet.org/docs/lsp) in your editor, there is no runtime type checking and execution overhead from Sorbet itself.
134
+ This library uses a simple DSL to represent request parameters and response shapes in `lib/lithic/models`.
152
135
 
153
- Due to limitations with the Sorbet type system, where a method otherwise can take an instance of `Lithic::BaseModel` class, you will need to use the `**` splat operator to pass the arguments:
136
+ With the right [editor plugins](https://shopify.github.io/ruby-lsp), you can ctrl-click on elements of the DSL to navigate around and explore the library.
154
137
 
155
- Please follow Sorbet's [setup guides](https://sorbet.org/docs/adopting) for best experience.
138
+ In all places where a `BaseModel` type is specified, vanilla Ruby `Hash` can also be used. For example, the following are interchangeable as arguments:
156
139
 
157
140
  ```ruby
158
- params = Lithic::Models::CardCreateParams.new(type: "SINGLE_USE")
141
+ # This has tooling readability, for auto-completion, static analysis, and goto definition with supported language services
142
+ params = Lithic::Models::CardCreateParams.new(type: :SINGLE_USE)
159
143
 
160
- lithic.cards.create(**params)
144
+ # This also works
145
+ params = {
146
+ type: :SINGLE_USE
147
+ }
161
148
  ```
162
149
 
163
- Note: **This library emits an intentional warning under the [`tapioca` toolchain](https://github.com/Shopify/tapioca)**. This is normal, and does not impact functionality.
164
-
165
- ### Ruby LSP
150
+ ## Editor support
166
151
 
167
- The Ruby LSP has [best effort support](https://shopify.github.io/ruby-lsp/#guessed-types) for inferring type information from Ruby code, and as such it may not always be able to provide accurate type information.
152
+ A combination of [Shopify LSP](https://shopify.github.io/ruby-lsp) and [Solargraph](https://solargraph.org/) is recommended for non-[Sorbet](https://sorbet.org) users. The former is especially good at go to definition, while the latter has much better auto-completion support.
168
153
 
169
- ## Advanced
154
+ ## Advanced concepts
170
155
 
171
156
  ### Making custom/undocumented requests
172
157
 
173
- This library is typed for convenient access to the documented API.
174
-
175
- If you need to access undocumented endpoints, params, or response properties, the library can still be used.
176
-
177
158
  #### Undocumented request params
178
159
 
179
160
  If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a requests as seen in examples above.
@@ -184,15 +165,15 @@ To make requests to undocumented endpoints, you can make requests using `client.
184
165
 
185
166
  ```ruby
186
167
  response = client.request(
187
- method: :post,
188
- path: '/undocumented/endpoint',
189
- query: {"dog": "woof"},
190
- headers: {"useful-header": "interesting-value"},
191
- body: {"he": "llo"},
192
- )
168
+ method: :post,
169
+ path: '/undocumented/endpoint',
170
+ query: {"dog": "woof"},
171
+ headers: {"useful-header": "interesting-value"},
172
+ body: {"he": "llo"},
173
+ )
193
174
  ```
194
175
 
195
- ### Concurrency & Connection Pooling
176
+ ### Concurrency & connection pooling
196
177
 
197
178
  The `Lithic::Client` instances are thread-safe, and should be re-used across multiple threads. By default, each `Client` have their own HTTP connection pool, with a maximum number of connections equal to thread count.
198
179
 
@@ -202,6 +183,30 @@ Unless otherwise specified, other classes in the SDK do not have locks protectin
202
183
 
203
184
  Currently, `Lithic::Client` instances are only fork-safe if there are no in-flight HTTP requests.
204
185
 
186
+ ### Sorbet
187
+
188
+ #### Enums
189
+
190
+ Sorbet's typed enums require sub-classing of the [`T::Enum` class](https://sorbet.org/docs/tenum) from the `sorbet-runtime` gem.
191
+
192
+ Since this library does not depend on `sorbet-runtime`, it uses a [`T.all` intersection type](https://sorbet.org/docs/intersection-types) with a ruby primitive type to construct a "tagged alias" instead.
193
+
194
+ ```ruby
195
+ module Lithic::Models::AccountFinancialAccountType
196
+ # This alias aids language service driven navigation.
197
+ TaggedSymbol = T.type_alias { T.all(Symbol, Lithic::Models::AccountFinancialAccountType) }
198
+ end
199
+ ```
200
+
201
+ #### Argument passing trick
202
+
203
+ It is possible to pass a compatible model / parameter class to a method that expects keyword arguments by using the `**` splat operator.
204
+
205
+ ```ruby
206
+ params = Lithic::Models::CardCreateParams.new(type: :SINGLE_USE)
207
+ lithic.cards.create(**params)
208
+ ```
209
+
205
210
  ## Versioning
206
211
 
207
212
  This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.
@@ -211,3 +216,7 @@ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` typ
211
216
  ## Requirements
212
217
 
213
218
  Ruby 3.1.0 or higher.
219
+
220
+ ## Contributing
221
+
222
+ See [the contributing documentation](https://github.com/lithic-com/lithic-ruby/tree/main/CONTRIBUTING.md).
data/lib/lithic/client.rb CHANGED
@@ -148,10 +148,10 @@ module Lithic
148
148
  api_key: ENV["LITHIC_API_KEY"],
149
149
  environment: nil,
150
150
  base_url: ENV["LITHIC_BASE_URL"],
151
- max_retries: DEFAULT_MAX_RETRIES,
152
- timeout: DEFAULT_TIMEOUT_IN_SECONDS,
153
- initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,
154
- max_retry_delay: DEFAULT_MAX_RETRY_DELAY
151
+ max_retries: Lithic::Client::DEFAULT_MAX_RETRIES,
152
+ timeout: Lithic::Client::DEFAULT_TIMEOUT_IN_SECONDS,
153
+ initial_retry_delay: Lithic::Client::DEFAULT_INITIAL_RETRY_DELAY,
154
+ max_retry_delay: Lithic::Client::DEFAULT_MAX_RETRY_DELAY
155
155
  )
156
156
  base_url ||= Lithic::Client::ENVIRONMENTS.fetch(environment&.to_sym || :production) do
157
157
  message = "environment must be one of #{Lithic::Client::ENVIRONMENTS.keys}, got #{environment}"
@@ -57,15 +57,11 @@ module Lithic
57
57
  # @return [Array(Net::HTTPGenericRequest, Proc)]
58
58
  def build_request(request, &blk)
59
59
  method, url, headers, body = request.fetch_values(:method, :url, :headers, :body)
60
-
61
- # ensure we construct a URI class of the right scheme
62
- url = URI(url.to_s)
63
-
64
60
  req = Net::HTTPGenericRequest.new(
65
61
  method.to_s.upcase,
66
62
  !body.nil?,
67
63
  method != :head,
68
- url
64
+ URI(url.to_s) # ensure we construct a URI class of the right scheme
69
65
  )
70
66
 
71
67
  headers.each { req[_1] = _2 }
@@ -30,11 +30,15 @@ module Lithic
30
30
  # @option spec [Boolean] :"nil?"
31
31
  def self.[](...) = new(...)
32
32
 
33
+ # @api public
34
+ #
33
35
  # @param other [Object]
34
36
  #
35
37
  # @return [Boolean]
36
38
  def ===(other) = other.is_a?(Array) && other.all?(item_type)
37
39
 
40
+ # @api public
41
+ #
38
42
  # @param other [Object]
39
43
  #
40
44
  # @return [Boolean]
@@ -44,6 +48,11 @@ module Lithic
44
48
  # rubocop:enable Layout/LineLength
45
49
  end
46
50
 
51
+ # @api public
52
+ #
53
+ # @return [Integer]
54
+ def hash = [self.class, item_type].hash
55
+
47
56
  # @api private
48
57
  #
49
58
  # @param value [Array<Object>, Object]
@@ -4,14 +4,6 @@ module Lithic
4
4
  module Internal
5
5
  module Type
6
6
  # @abstract
7
- #
8
- # @example
9
- # # `address` is a `Lithic::Models::Address`
10
- # address => {
11
- # address1: address1,
12
- # city: city,
13
- # country: country
14
- # }
15
7
  class BaseModel
16
8
  extend Lithic::Internal::Type::Converter
17
9
 
@@ -93,11 +85,13 @@ module Lithic
93
85
  state: state
94
86
  )
95
87
  end
96
- rescue StandardError
88
+ rescue StandardError => e
97
89
  cls = self.class.name.split("::").last
98
- # rubocop:disable Layout/LineLength
99
- message = "Failed to parse #{cls}.#{__method__} from #{value.class} to #{target.inspect}. To get the unparsed API response, use #{cls}[:#{__method__}]."
100
- # rubocop:enable Layout/LineLength
90
+ message = [
91
+ "Failed to parse #{cls}.#{__method__} from #{value.class} to #{target.inspect}.",
92
+ "To get the unparsed API response, use #{cls}[#{__method__.inspect}].",
93
+ "Cause: #{e.message}"
94
+ ].join(" ")
101
95
  raise Lithic::Errors::ConversionError.new(message)
102
96
  end
103
97
  end
@@ -165,19 +159,33 @@ module Lithic
165
159
  @mode = nil
166
160
  end
167
161
 
162
+ # @api public
163
+ #
168
164
  # @param other [Object]
169
165
  #
170
166
  # @return [Boolean]
171
167
  def ==(other)
172
168
  other.is_a?(Class) && other <= Lithic::Internal::Type::BaseModel && other.fields == fields
173
169
  end
170
+
171
+ # @api public
172
+ #
173
+ # @return [Integer]
174
+ def hash = fields.hash
174
175
  end
175
176
 
177
+ # @api public
178
+ #
176
179
  # @param other [Object]
177
180
  #
178
181
  # @return [Boolean]
179
182
  def ==(other) = self.class == other.class && @data == other.to_h
180
183
 
184
+ # @api public
185
+ #
186
+ # @return [Integer]
187
+ def hash = [self.class, @data].hash
188
+
181
189
  class << self
182
190
  # @api private
183
191
  #
@@ -291,6 +299,8 @@ module Lithic
291
299
  end
292
300
  end
293
301
 
302
+ # @api public
303
+ #
294
304
  # Returns the raw value associated with the given key, if found. Otherwise, nil is
295
305
  # returned.
296
306
  #
@@ -309,6 +319,8 @@ module Lithic
309
319
  @data[key]
310
320
  end
311
321
 
322
+ # @api public
323
+ #
312
324
  # Returns a Hash of the data underlying this object. O(1)
313
325
  #
314
326
  # Keys are Symbols and values are the raw values from the response. The return
@@ -361,11 +373,15 @@ module Lithic
361
373
  end
362
374
  end
363
375
 
376
+ # @api public
377
+ #
364
378
  # @param a [Object]
365
379
  #
366
380
  # @return [String]
367
381
  def to_json(*a) = Lithic::Internal::Type::Converter.dump(self.class, self).to_json(*a)
368
382
 
383
+ # @api public
384
+ #
369
385
  # @param a [Object]
370
386
  #
371
387
  # @return [String]
@@ -407,7 +423,7 @@ module Lithic
407
423
  end
408
424
  end
409
425
 
410
- # @api private
426
+ # @api public
411
427
  #
412
428
  # @return [String]
413
429
  def to_s = self.class.walk(@data).to_s
@@ -3,19 +3,27 @@
3
3
  module Lithic
4
4
  module Internal
5
5
  module Type
6
+ # @api private
7
+ #
6
8
  # @generic Elem
7
9
  #
8
10
  # This module provides a base implementation for paginated responses in the SDK.
9
11
  module BasePage
10
12
  # rubocop:disable Lint/UnusedMethodArgument
11
13
 
14
+ # @api public
15
+ #
12
16
  # @return [Boolean]
13
17
  def next_page? = (raise NotImplementedError)
14
18
 
19
+ # @api public
20
+ #
15
21
  # @raise [Lithic::Errors::APIError]
16
22
  # @return [Lithic::Internal::Type::BasePage]
17
23
  def next_page = (raise NotImplementedError)
18
24
 
25
+ # @api public
26
+ #
19
27
  # @param blk [Proc]
20
28
  #
21
29
  # @yieldparam [generic<Elem>]
@@ -13,11 +13,15 @@ module Lithic
13
13
 
14
14
  private_class_method :new
15
15
 
16
+ # @api public
17
+ #
16
18
  # @param other [Object]
17
19
  #
18
20
  # @return [Boolean]
19
21
  def self.===(other) = other == true || other == false
20
22
 
23
+ # @api public
24
+ #
21
25
  # @param other [Object]
22
26
  #
23
27
  # @return [Boolean]
@@ -44,11 +44,15 @@ module Lithic
44
44
  # @return [Array<NilClass, Boolean, Integer, Float, Symbol>]
45
45
  def values = constants.map { const_get(_1) }
46
46
 
47
+ # @api public
48
+ #
47
49
  # @param other [Object]
48
50
  #
49
51
  # @return [Boolean]
50
52
  def ===(other) = values.include?(other)
51
53
 
54
+ # @api public
55
+ #
52
56
  # @param other [Object]
53
57
  #
54
58
  # @return [Boolean]
@@ -58,6 +62,11 @@ module Lithic
58
62
  # rubocop:enable Style/CaseEquality
59
63
  end
60
64
 
65
+ # @api public
66
+ #
67
+ # @return [Integer]
68
+ def hash = values.to_set.hash
69
+
61
70
  # @api private
62
71
  #
63
72
  # Unlike with primitives, `Enum` additionally validates that the value is a member
@@ -30,6 +30,8 @@ module Lithic
30
30
  # @option spec [Boolean] :"nil?"
31
31
  def self.[](...) = new(...)
32
32
 
33
+ # @api public
34
+ #
33
35
  # @param other [Object]
34
36
  #
35
37
  # @return [Boolean]
@@ -50,6 +52,8 @@ module Lithic
50
52
  end
51
53
  end
52
54
 
55
+ # @api public
56
+ #
53
57
  # @param other [Object]
54
58
  #
55
59
  # @return [Boolean]
@@ -59,6 +63,11 @@ module Lithic
59
63
  # rubocop:enable Layout/LineLength
60
64
  end
61
65
 
66
+ # @api public
67
+ #
68
+ # @return [Integer]
69
+ def hash = [self.class, item_type].hash
70
+
62
71
  # @api private
63
72
  #
64
73
  # @param value [Hash{Object=>Object}, Object]
@@ -13,6 +13,8 @@ module Lithic
13
13
 
14
14
  private_class_method :new
15
15
 
16
+ # @api public
17
+ #
16
18
  # @param other [Object]
17
19
  #
18
20
  # @return [Boolean]
@@ -25,6 +27,8 @@ module Lithic
25
27
  end
26
28
  end
27
29
 
30
+ # @api public
31
+ #
28
32
  # @param other [Object]
29
33
  #
30
34
  # @return [Boolean]
@@ -29,7 +29,7 @@ module Lithic
29
29
  #
30
30
  # @return [Array<Array(Symbol, Object)>]
31
31
  protected def derefed_variants
32
- @known_variants.map { |key, variant_fn| [key, variant_fn.call] }
32
+ known_variants.map { |key, variant_fn| [key, variant_fn.call] }
33
33
  end
34
34
 
35
35
  # All of the specified variants for this union.
@@ -98,6 +98,8 @@ module Lithic
98
98
  # rubocop:disable Style/HashEachMethods
99
99
  # rubocop:disable Style/CaseEquality
100
100
 
101
+ # @api public
102
+ #
101
103
  # @param other [Object]
102
104
  #
103
105
  # @return [Boolean]
@@ -107,6 +109,8 @@ module Lithic
107
109
  end
108
110
  end
109
111
 
112
+ # @api public
113
+ #
110
114
  # @param other [Object]
111
115
  #
112
116
  # @return [Boolean]
@@ -114,6 +118,11 @@ module Lithic
114
118
  Lithic::Internal::Type::Union === other && other.derefed_variants == derefed_variants
115
119
  end
116
120
 
121
+ # @api public
122
+ #
123
+ # @return [Integer]
124
+ def hash = variants.hash
125
+
117
126
  # @api private
118
127
  #
119
128
  # @param value [Object]
@@ -15,11 +15,15 @@ module Lithic
15
15
 
16
16
  private_class_method :new
17
17
 
18
+ # @api public
19
+ #
18
20
  # @param other [Object]
19
21
  #
20
22
  # @return [Boolean]
21
23
  def self.===(other) = true
22
24
 
25
+ # @api public
26
+ #
23
27
  # @param other [Object]
24
28
  #
25
29
  # @return [Boolean]
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lithic
4
- # @api private
5
4
  module Internal
6
5
  OMIT =
7
6
  Object.new.tap do
@@ -50,6 +50,8 @@ module Lithic
50
50
  optional :account_holder, -> { Lithic::Models::Account::AccountHolder }
51
51
 
52
52
  # @!attribute auth_rule_tokens
53
+ # @deprecated
54
+ #
53
55
  # List of identifiers for the Auth Rule(s) that are applied on the account. This
54
56
  # field is deprecated and will no longer be populated in the `account_holder`
55
57
  # object. The key will be removed from the schema in a future release. Use the
@@ -65,6 +67,7 @@ module Lithic
65
67
  optional :cardholder_currency, String
66
68
 
67
69
  # @!attribute verification_address
70
+ # @deprecated
68
71
  #
69
72
  # @return [Lithic::Models::Account::VerificationAddress, nil]
70
73
  optional :verification_address, -> { Lithic::Models::Account::VerificationAddress }
@@ -23,6 +23,8 @@ module Lithic
23
23
  optional :account_token, String
24
24
 
25
25
  # @!attribute beneficial_owner_entities
26
+ # @deprecated
27
+ #
26
28
  # Deprecated.
27
29
  #
28
30
  # @return [Array<Lithic::Models::AccountHolder::BeneficialOwnerEntity>, nil]
@@ -61,6 +61,8 @@ module Lithic
61
61
  required :workflow, enum: -> { Lithic::Models::AccountHolderCreateParams::Workflow }
62
62
 
63
63
  # @!attribute beneficial_owner_entities
64
+ # @deprecated
65
+ #
64
66
  # Deprecated.
65
67
  #
66
68
  # @return [Array<Lithic::Models::AccountHolderCreateParams::BeneficialOwnerEntity>, nil]
@@ -8,6 +8,8 @@ module Lithic
8
8
  include Lithic::Internal::Type::RequestParameters
9
9
 
10
10
  # @!attribute beneficial_owner_entities
11
+ # @deprecated
12
+ #
11
13
  # Deprecated.
12
14
  #
13
15
  # @return [Array<Lithic::Models::AccountHolderUpdateParams::BeneficialOwnerEntity>, nil]
@@ -40,6 +40,8 @@ module Lithic
40
40
  optional :state, enum: -> { Lithic::Models::AccountUpdateParams::State }
41
41
 
42
42
  # @!attribute verification_address
43
+ # @deprecated
44
+ #
43
45
  # Address used during Address Verification Service (AVS) checks during
44
46
  # transactions if enabled via Auth Rules. This field is deprecated as AVS checks
45
47
  # are no longer supported by Authorization Rules. The field will be removed from
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lithic
4
+ module Models
5
+ # @see Lithic::Resources::Cards#create
6
+ class Card < Lithic::Models::NonPCICard
7
+ # @!attribute cvv
8
+ # Three digit cvv printed on the back of the card.
9
+ #
10
+ # @return [String, nil]
11
+ optional :cvv, String
12
+
13
+ # @!attribute pan
14
+ # Primary Account Number (PAN) (i.e. the card number). Customers must be PCI
15
+ # compliant to have PAN returned as a field in production. Please contact
16
+ # support@lithic.com for questions.
17
+ #
18
+ # @return [String, nil]
19
+ optional :pan, String
20
+
21
+ # @!method initialize(cvv: nil, pan: nil)
22
+ # Card details with potentially PCI sensitive information for Enterprise customers
23
+ #
24
+ # @param cvv [String]
25
+ # @param pan [String]
26
+ end
27
+ end
28
+ end