lunchmoney 0.10.0

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 (142) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.github/dependabot.yml +18 -0
  4. data/.github/workflows/build_and_publish_yard_docs.yml +47 -0
  5. data/.github/workflows/ci.yml +58 -0
  6. data/.github/workflows/dependabot-rbi-updater.yml +43 -0
  7. data/.github/workflows/publish_gem.yml +31 -0
  8. data/.gitignore +62 -0
  9. data/.rubocop.yml +45 -0
  10. data/.ruby-version +1 -0
  11. data/.toys/.toys.rb +10 -0
  12. data/.toys/ci.rb +22 -0
  13. data/.toys/rbi.rb +60 -0
  14. data/.toys/rubocop.rb +10 -0
  15. data/.toys/spoom.rb +15 -0
  16. data/.toys/typecheck.rb +5 -0
  17. data/.yardopts +2 -0
  18. data/Appraisals +22 -0
  19. data/Gemfile +25 -0
  20. data/Gemfile.lock +174 -0
  21. data/LICENSE +21 -0
  22. data/README.md +57 -0
  23. data/bin/console +16 -0
  24. data/bin/rubocop +27 -0
  25. data/bin/setup +8 -0
  26. data/bin/spoom +27 -0
  27. data/bin/srb +27 -0
  28. data/bin/tapioca +27 -0
  29. data/bin/toys +27 -0
  30. data/bin/yard +27 -0
  31. data/lib/lunchmoney/api.rb +147 -0
  32. data/lib/lunchmoney/api_call.rb +109 -0
  33. data/lib/lunchmoney/assets/asset.rb +89 -0
  34. data/lib/lunchmoney/assets/asset_calls.rb +96 -0
  35. data/lib/lunchmoney/budget/budget.rb +74 -0
  36. data/lib/lunchmoney/budget/budget_calls.rb +82 -0
  37. data/lib/lunchmoney/budget/config.rb +38 -0
  38. data/lib/lunchmoney/budget/data.rb +42 -0
  39. data/lib/lunchmoney/categories/category/category.rb +52 -0
  40. data/lib/lunchmoney/categories/category/child_category.rb +42 -0
  41. data/lib/lunchmoney/categories/category_calls.rb +195 -0
  42. data/lib/lunchmoney/configuration.rb +26 -0
  43. data/lib/lunchmoney/crypto/crypto/crypto.rb +43 -0
  44. data/lib/lunchmoney/crypto/crypto/crypto_base.rb +65 -0
  45. data/lib/lunchmoney/crypto/crypto_calls.rb +49 -0
  46. data/lib/lunchmoney/data_object.rb +25 -0
  47. data/lib/lunchmoney/errors.rb +19 -0
  48. data/lib/lunchmoney/exceptions.rb +19 -0
  49. data/lib/lunchmoney/plaid_accounts/plaid_account.rb +73 -0
  50. data/lib/lunchmoney/plaid_accounts/plaid_account_calls.rb +38 -0
  51. data/lib/lunchmoney/recurring_expenses/recurring_expense/recurring_expense.rb +65 -0
  52. data/lib/lunchmoney/recurring_expenses/recurring_expense/recurring_expense_base.rb +29 -0
  53. data/lib/lunchmoney/recurring_expenses/recurring_expense_calls.rb +28 -0
  54. data/lib/lunchmoney/tags/tag/tag.rb +20 -0
  55. data/lib/lunchmoney/tags/tag/tag_base.rb +21 -0
  56. data/lib/lunchmoney/tags/tag_calls.rb +20 -0
  57. data/lib/lunchmoney/transactions/transaction/child_transaction.rb +31 -0
  58. data/lib/lunchmoney/transactions/transaction/split.rb +24 -0
  59. data/lib/lunchmoney/transactions/transaction/transaction.rb +156 -0
  60. data/lib/lunchmoney/transactions/transaction/transaction_base.rb +52 -0
  61. data/lib/lunchmoney/transactions/transaction/transaction_modification_base.rb +30 -0
  62. data/lib/lunchmoney/transactions/transaction/update_transaction.rb +43 -0
  63. data/lib/lunchmoney/transactions/transaction_calls.rb +218 -0
  64. data/lib/lunchmoney/user/user.rb +36 -0
  65. data/lib/lunchmoney/user/user_calls.rb +19 -0
  66. data/lib/lunchmoney/validators.rb +43 -0
  67. data/lib/lunchmoney/version.rb +7 -0
  68. data/lib/lunchmoney.rb +54 -0
  69. data/lunchmoney.gemspec +34 -0
  70. data/sorbet/config +5 -0
  71. data/sorbet/rbi/annotations/.gitattributes +1 -0
  72. data/sorbet/rbi/annotations/activesupport.rbi +410 -0
  73. data/sorbet/rbi/annotations/faraday.rbi +17 -0
  74. data/sorbet/rbi/annotations/mocha.rbi +34 -0
  75. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  76. data/sorbet/rbi/annotations/webmock.rbi +9 -0
  77. data/sorbet/rbi/dsl/.gitattributes +1 -0
  78. data/sorbet/rbi/dsl/active_support/callbacks.rbi +22 -0
  79. data/sorbet/rbi/gems/.gitattributes +1 -0
  80. data/sorbet/rbi/gems/activesupport@7.1.3.rbi +18004 -0
  81. data/sorbet/rbi/gems/addressable@2.8.6.rbi +1993 -0
  82. data/sorbet/rbi/gems/appraisal@2.5.0.rbi +621 -0
  83. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  84. data/sorbet/rbi/gems/base64@0.2.0.rbi +508 -0
  85. data/sorbet/rbi/gems/bigdecimal@3.1.6.rbi +77 -0
  86. data/sorbet/rbi/gems/coderay@1.1.3.rbi +3426 -0
  87. data/sorbet/rbi/gems/concurrent-ruby@1.2.3.rbi +11590 -0
  88. data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +8 -0
  89. data/sorbet/rbi/gems/crack@0.4.5.rbi +144 -0
  90. data/sorbet/rbi/gems/dotenv@2.8.1.rbi +234 -0
  91. data/sorbet/rbi/gems/drb@2.2.0.rbi +1346 -0
  92. data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
  93. data/sorbet/rbi/gems/faraday-net_http@3.1.0.rbi +146 -0
  94. data/sorbet/rbi/gems/faraday@2.9.0.rbi +2911 -0
  95. data/sorbet/rbi/gems/hashdiff@1.1.0.rbi +352 -0
  96. data/sorbet/rbi/gems/i18n@1.14.1.rbi +2325 -0
  97. data/sorbet/rbi/gems/json@2.7.1.rbi +1561 -0
  98. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  99. data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
  100. data/sorbet/rbi/gems/minitest@5.21.2.rbi +2197 -0
  101. data/sorbet/rbi/gems/mocha@2.1.0.rbi +3934 -0
  102. data/sorbet/rbi/gems/mutex_m@0.2.0.rbi +93 -0
  103. data/sorbet/rbi/gems/net-http@0.4.1.rbi +4068 -0
  104. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  105. data/sorbet/rbi/gems/parallel@1.24.0.rbi +280 -0
  106. data/sorbet/rbi/gems/parser@3.3.0.5.rbi +5472 -0
  107. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  108. data/sorbet/rbi/gems/prism@0.19.0.rbi +29883 -0
  109. data/sorbet/rbi/gems/pry-sorbet@0.2.1.rbi +966 -0
  110. data/sorbet/rbi/gems/pry@0.14.2.rbi +10077 -0
  111. data/sorbet/rbi/gems/public_suffix@5.0.4.rbi +935 -0
  112. data/sorbet/rbi/gems/racc@1.7.3.rbi +161 -0
  113. data/sorbet/rbi/gems/rack@3.0.8.rbi +5183 -0
  114. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
  115. data/sorbet/rbi/gems/rake@13.1.0.rbi +3027 -0
  116. data/sorbet/rbi/gems/rbi@0.1.6.rbi +2922 -0
  117. data/sorbet/rbi/gems/regexp_parser@2.9.0.rbi +3771 -0
  118. data/sorbet/rbi/gems/rexml@3.2.6.rbi +4781 -0
  119. data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +7117 -0
  120. data/sorbet/rbi/gems/rubocop-minitest@0.34.5.rbi +2576 -0
  121. data/sorbet/rbi/gems/rubocop-rails@2.23.1.rbi +9175 -0
  122. data/sorbet/rbi/gems/rubocop-shopify@2.14.0.rbi +8 -0
  123. data/sorbet/rbi/gems/rubocop-sorbet@0.7.6.rbi +1510 -0
  124. data/sorbet/rbi/gems/rubocop@1.60.1.rbi +57356 -0
  125. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  126. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  127. data/sorbet/rbi/gems/spoom@1.2.4.rbi +3777 -0
  128. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23136 -0
  129. data/sorbet/rbi/gems/tapioca@0.12.0.rbi +3506 -0
  130. data/sorbet/rbi/gems/thor@1.3.0.rbi +4312 -0
  131. data/sorbet/rbi/gems/toys-core@0.15.4.rbi +9462 -0
  132. data/sorbet/rbi/gems/toys@0.15.4.rbi +243 -0
  133. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5917 -0
  134. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +65 -0
  135. data/sorbet/rbi/gems/uri@0.13.0.rbi +2327 -0
  136. data/sorbet/rbi/gems/vcr@6.2.0.rbi +3036 -0
  137. data/sorbet/rbi/gems/webmock@3.19.1.rbi +1768 -0
  138. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  139. data/sorbet/rbi/gems/yard@0.9.34.rbi +18084 -0
  140. data/sorbet/shims/module.rbi +6 -0
  141. data/sorbet/tapioca/require.rb +10 -0
  142. metadata +228 -0
@@ -0,0 +1,935 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `public_suffix` gem.
5
+ # Please instead update this file by running `bin/tapioca gem public_suffix`.
6
+
7
+ # PublicSuffix is a Ruby domain name parser based on the Public Suffix List.
8
+ #
9
+ # The [Public Suffix List](https://publicsuffix.org) is a cross-vendor initiative
10
+ # to provide an accurate list of domain name suffixes.
11
+ #
12
+ # The Public Suffix List is an initiative of the Mozilla Project,
13
+ # but is maintained as a community resource. It is available for use in any software,
14
+ # but was originally created to meet the needs of browser manufacturers.
15
+ #
16
+ # source://public_suffix//lib/public_suffix/domain.rb#9
17
+ module PublicSuffix
18
+ class << self
19
+ # private
20
+ #
21
+ # source://public_suffix//lib/public_suffix.rb#149
22
+ def decompose(name, rule); end
23
+
24
+ # Attempt to parse the name and returns the domain, if valid.
25
+ #
26
+ # This method doesn't raise. Instead, it returns nil if the domain is not valid for whatever reason.
27
+ #
28
+ # @param name [#to_s] The domain name or fully qualified domain name to parse.
29
+ # @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
30
+ # @param ignore_private [Boolean]
31
+ # @return [String]
32
+ #
33
+ # source://public_suffix//lib/public_suffix.rb#140
34
+ def domain(name, **options); end
35
+
36
+ # Pretend we know how to deal with user input.
37
+ #
38
+ # source://public_suffix//lib/public_suffix.rb#164
39
+ def normalize(name); end
40
+
41
+ # Parses +name+ and returns the {PublicSuffix::Domain} instance.
42
+ #
43
+ # @example Parse a valid domain
44
+ # PublicSuffix.parse("google.com")
45
+ # # => #<PublicSuffix::Domain:0x007fec2e51e588 @sld="google", @tld="com", @trd=nil>
46
+ # @example Parse a valid subdomain
47
+ # PublicSuffix.parse("www.google.com")
48
+ # # => #<PublicSuffix::Domain:0x007fec276d4cf8 @sld="google", @tld="com", @trd="www">
49
+ # @example Parse a fully qualified domain
50
+ # PublicSuffix.parse("google.com.")
51
+ # # => #<PublicSuffix::Domain:0x007fec257caf38 @sld="google", @tld="com", @trd=nil>
52
+ # @example Parse a fully qualified domain (subdomain)
53
+ # PublicSuffix.parse("www.google.com.")
54
+ # # => #<PublicSuffix::Domain:0x007fec27b6bca8 @sld="google", @tld="com", @trd="www">
55
+ # @example Parse an invalid (unlisted) domain
56
+ # PublicSuffix.parse("x.yz")
57
+ # # => #<PublicSuffix::Domain:0x007fec2f49bec0 @sld="x", @tld="yz", @trd=nil>
58
+ # @example Parse an invalid (unlisted) domain with strict checking (without applying the default * rule)
59
+ # PublicSuffix.parse("x.yz", default_rule: nil)
60
+ # # => PublicSuffix::DomainInvalid: `x.yz` is not a valid domain
61
+ # @example Parse an URL (not supported, only domains)
62
+ # PublicSuffix.parse("http://www.google.com")
63
+ # # => PublicSuffix::DomainInvalid: http://www.google.com is not expected to contain a scheme
64
+ # @param name [#to_s] The domain name or fully qualified domain name to parse.
65
+ # @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
66
+ # @param ignore_private [Boolean]
67
+ # @raise [PublicSuffix::DomainInvalid] If domain is not a valid domain.
68
+ # @raise [PublicSuffix::DomainNotAllowed] If a rule for +domain+ is found, but the rule doesn't allow +domain+.
69
+ # @return [PublicSuffix::Domain]
70
+ #
71
+ # source://public_suffix//lib/public_suffix.rb#67
72
+ def parse(name, list: T.unsafe(nil), default_rule: T.unsafe(nil), ignore_private: T.unsafe(nil)); end
73
+
74
+ # Checks whether +domain+ is assigned and allowed, without actually parsing it.
75
+ #
76
+ # This method doesn't care whether domain is a domain or subdomain.
77
+ # The validation is performed using the default {PublicSuffix::List}.
78
+ #
79
+ # @example Validate a valid domain
80
+ # PublicSuffix.valid?("example.com")
81
+ # # => true
82
+ # @example Validate a valid subdomain
83
+ # PublicSuffix.valid?("www.example.com")
84
+ # # => true
85
+ # @example Validate a not-listed domain
86
+ # PublicSuffix.valid?("example.tldnotlisted")
87
+ # # => true
88
+ # @example Validate a not-listed domain with strict checking (without applying the default * rule)
89
+ # PublicSuffix.valid?("example.tldnotlisted")
90
+ # # => true
91
+ # PublicSuffix.valid?("example.tldnotlisted", default_rule: nil)
92
+ # # => false
93
+ # @example Validate a fully qualified domain
94
+ # PublicSuffix.valid?("google.com.")
95
+ # # => true
96
+ # PublicSuffix.valid?("www.google.com.")
97
+ # # => true
98
+ # @example Check an URL (which is not a valid domain)
99
+ # PublicSuffix.valid?("http://www.example.com")
100
+ # # => false
101
+ # @param name [#to_s] The domain name or fully qualified domain name to validate.
102
+ # @param ignore_private [Boolean]
103
+ # @return [Boolean]
104
+ #
105
+ # source://public_suffix//lib/public_suffix.rb#123
106
+ def valid?(name, list: T.unsafe(nil), default_rule: T.unsafe(nil), ignore_private: T.unsafe(nil)); end
107
+ end
108
+ end
109
+
110
+ # source://public_suffix//lib/public_suffix.rb#26
111
+ PublicSuffix::BANG = T.let(T.unsafe(nil), String)
112
+
113
+ # source://public_suffix//lib/public_suffix.rb#25
114
+ PublicSuffix::DOT = T.let(T.unsafe(nil), String)
115
+
116
+ # Domain represents a domain name, composed by a TLD, SLD and TRD.
117
+ #
118
+ # source://public_suffix//lib/public_suffix/domain.rb#12
119
+ class PublicSuffix::Domain
120
+ # Creates and returns a new {PublicSuffix::Domain} instance.
121
+ #
122
+ # @example Initialize with a TLD and SLD
123
+ # PublicSuffix::Domain.new("com", "example")
124
+ # # => #<PublicSuffix::Domain @tld="com", @trd=nil>
125
+ # @example Initialize with a TLD
126
+ # PublicSuffix::Domain.new("com")
127
+ # # => #<PublicSuffix::Domain @tld="com">
128
+ # @example Initialize with a TLD, SLD and TRD
129
+ # PublicSuffix::Domain.new("com", "example", "wwww")
130
+ # # => #<PublicSuffix::Domain @tld="com", @trd=nil, @sld="example">
131
+ # @overload initialize
132
+ # @overload initialize
133
+ # @overload initialize
134
+ # @return [Domain] a new instance of Domain
135
+ # @yield [self] Yields on self.
136
+ # @yieldparam self [PublicSuffix::Domain] The newly creates instance
137
+ #
138
+ # source://public_suffix//lib/public_suffix/domain.rb#65
139
+ def initialize(*args); end
140
+
141
+ # Returns a domain-like representation of this object
142
+ # if the object is a {#domain?}, <tt>nil</tt> otherwise.
143
+ #
144
+ # PublicSuffix::Domain.new("com").domain
145
+ # # => nil
146
+ #
147
+ # PublicSuffix::Domain.new("com", "google").domain
148
+ # # => "google.com"
149
+ #
150
+ # PublicSuffix::Domain.new("com", "google", "www").domain
151
+ # # => "www.google.com"
152
+ #
153
+ # This method doesn't validate the input. It handles the domain
154
+ # as a valid domain name and simply applies the necessary transformations.
155
+ #
156
+ # This method returns a FQD, not just the domain part.
157
+ # To get the domain part, use <tt>#sld</tt> (aka second level domain).
158
+ #
159
+ # PublicSuffix::Domain.new("com", "google", "www").domain
160
+ # # => "google.com"
161
+ #
162
+ # PublicSuffix::Domain.new("com", "google", "www").sld
163
+ # # => "google"
164
+ #
165
+ # @return [String]
166
+ # @see #domain?
167
+ # @see #subdomain
168
+ #
169
+ # source://public_suffix//lib/public_suffix/domain.rb#137
170
+ def domain; end
171
+
172
+ # Checks whether <tt>self</tt> looks like a domain.
173
+ #
174
+ # This method doesn't actually validate the domain.
175
+ # It only checks whether the instance contains
176
+ # a value for the {#tld} and {#sld} attributes.
177
+ #
178
+ # @example
179
+ #
180
+ # PublicSuffix::Domain.new("com").domain?
181
+ # # => false
182
+ #
183
+ # PublicSuffix::Domain.new("com", "google").domain?
184
+ # # => true
185
+ #
186
+ # PublicSuffix::Domain.new("com", "google", "www").domain?
187
+ # # => true
188
+ #
189
+ # # This is an invalid domain, but returns true
190
+ # # because this method doesn't validate the content.
191
+ # PublicSuffix::Domain.new("com", nil).domain?
192
+ # # => true
193
+ # @return [Boolean]
194
+ # @see #subdomain?
195
+ #
196
+ # source://public_suffix//lib/public_suffix/domain.rb#198
197
+ def domain?; end
198
+
199
+ # Returns the full domain name.
200
+ #
201
+ # @example Gets the domain name of a domain
202
+ # PublicSuffix::Domain.new("com", "google").name
203
+ # # => "google.com"
204
+ # @example Gets the domain name of a subdomain
205
+ # PublicSuffix::Domain.new("com", "google", "www").name
206
+ # # => "www.google.com"
207
+ # @return [String]
208
+ #
209
+ # source://public_suffix//lib/public_suffix/domain.rb#105
210
+ def name; end
211
+
212
+ # Returns the value of attribute sld.
213
+ #
214
+ # source://public_suffix//lib/public_suffix/domain.rb#33
215
+ def sld; end
216
+
217
+ # Returns a subdomain-like representation of this object
218
+ # if the object is a {#subdomain?}, <tt>nil</tt> otherwise.
219
+ #
220
+ # PublicSuffix::Domain.new("com").subdomain
221
+ # # => nil
222
+ #
223
+ # PublicSuffix::Domain.new("com", "google").subdomain
224
+ # # => nil
225
+ #
226
+ # PublicSuffix::Domain.new("com", "google", "www").subdomain
227
+ # # => "www.google.com"
228
+ #
229
+ # This method doesn't validate the input. It handles the domain
230
+ # as a valid domain name and simply applies the necessary transformations.
231
+ #
232
+ # This method returns a FQD, not just the subdomain part.
233
+ # To get the subdomain part, use <tt>#trd</tt> (aka third level domain).
234
+ #
235
+ # PublicSuffix::Domain.new("com", "google", "www").subdomain
236
+ # # => "www.google.com"
237
+ #
238
+ # PublicSuffix::Domain.new("com", "google", "www").trd
239
+ # # => "www"
240
+ #
241
+ # @return [String]
242
+ # @see #subdomain?
243
+ # @see #domain
244
+ #
245
+ # source://public_suffix//lib/public_suffix/domain.rb#169
246
+ def subdomain; end
247
+
248
+ # Checks whether <tt>self</tt> looks like a subdomain.
249
+ #
250
+ # This method doesn't actually validate the subdomain.
251
+ # It only checks whether the instance contains
252
+ # a value for the {#tld}, {#sld} and {#trd} attributes.
253
+ # If you also want to validate the domain,
254
+ # use {#valid_subdomain?} instead.
255
+ #
256
+ # @example
257
+ #
258
+ # PublicSuffix::Domain.new("com").subdomain?
259
+ # # => false
260
+ #
261
+ # PublicSuffix::Domain.new("com", "google").subdomain?
262
+ # # => false
263
+ #
264
+ # PublicSuffix::Domain.new("com", "google", "www").subdomain?
265
+ # # => true
266
+ #
267
+ # # This is an invalid domain, but returns true
268
+ # # because this method doesn't validate the content.
269
+ # PublicSuffix::Domain.new("com", "example", nil).subdomain?
270
+ # # => true
271
+ # @return [Boolean]
272
+ # @see #domain?
273
+ #
274
+ # source://public_suffix//lib/public_suffix/domain.rb#229
275
+ def subdomain?; end
276
+
277
+ # Returns the value of attribute tld.
278
+ #
279
+ # source://public_suffix//lib/public_suffix/domain.rb#33
280
+ def tld; end
281
+
282
+ # Returns an array containing the domain parts.
283
+ #
284
+ # @example
285
+ #
286
+ # PublicSuffix::Domain.new("google.com").to_a
287
+ # # => [nil, "google", "com"]
288
+ #
289
+ # PublicSuffix::Domain.new("www.google.com").to_a
290
+ # # => [nil, "google", "com"]
291
+ # @return [Array<String, nil>]
292
+ #
293
+ # source://public_suffix//lib/public_suffix/domain.rb#89
294
+ def to_a; end
295
+
296
+ # Returns a string representation of this object.
297
+ #
298
+ # @return [String]
299
+ #
300
+ # source://public_suffix//lib/public_suffix/domain.rb#73
301
+ def to_s; end
302
+
303
+ # Returns the value of attribute trd.
304
+ #
305
+ # source://public_suffix//lib/public_suffix/domain.rb#33
306
+ def trd; end
307
+
308
+ class << self
309
+ # Splits a string into the labels, that is the dot-separated parts.
310
+ #
311
+ # The input is not validated, but it is assumed to be a valid domain name.
312
+ #
313
+ # @example
314
+ #
315
+ # name_to_labels('example.com')
316
+ # # => ['example', 'com']
317
+ #
318
+ # name_to_labels('example.co.uk')
319
+ # # => ['example', 'co', 'uk']
320
+ # @param name [String, #to_s] The domain name to split.
321
+ # @return [Array<String>]
322
+ #
323
+ # source://public_suffix//lib/public_suffix/domain.rb#28
324
+ def name_to_labels(name); end
325
+ end
326
+ end
327
+
328
+ # Raised when trying to parse an invalid name.
329
+ # A name is considered invalid when no rule is found in the definition list.
330
+ #
331
+ # @example
332
+ #
333
+ # PublicSuffix.parse("nic.test")
334
+ # # => PublicSuffix::DomainInvalid
335
+ #
336
+ # PublicSuffix.parse("http://www.nic.it")
337
+ # # => PublicSuffix::DomainInvalid
338
+ #
339
+ # source://public_suffix//lib/public_suffix/errors.rb#25
340
+ class PublicSuffix::DomainInvalid < ::PublicSuffix::Error; end
341
+
342
+ # Raised when trying to parse a name that matches a suffix.
343
+ #
344
+ # @example
345
+ #
346
+ # PublicSuffix.parse("nic.do")
347
+ # # => PublicSuffix::DomainNotAllowed
348
+ #
349
+ # PublicSuffix.parse("www.nic.do")
350
+ # # => PublicSuffix::Domain
351
+ #
352
+ # source://public_suffix//lib/public_suffix/errors.rb#38
353
+ class PublicSuffix::DomainNotAllowed < ::PublicSuffix::DomainInvalid; end
354
+
355
+ # source://public_suffix//lib/public_suffix/errors.rb#11
356
+ class PublicSuffix::Error < ::StandardError; end
357
+
358
+ # A {PublicSuffix::List} is a collection of one
359
+ # or more {PublicSuffix::Rule}.
360
+ #
361
+ # Given a {PublicSuffix::List},
362
+ # you can add or remove {PublicSuffix::Rule},
363
+ # iterate all items in the list or search for the first rule
364
+ # which matches a specific domain name.
365
+ #
366
+ # # Create a new list
367
+ # list = PublicSuffix::List.new
368
+ #
369
+ # # Push two rules to the list
370
+ # list << PublicSuffix::Rule.factory("it")
371
+ # list << PublicSuffix::Rule.factory("com")
372
+ #
373
+ # # Get the size of the list
374
+ # list.size
375
+ # # => 2
376
+ #
377
+ # # Search for the rule matching given domain
378
+ # list.find("example.com")
379
+ # # => #<PublicSuffix::Rule::Normal>
380
+ # list.find("example.org")
381
+ # # => nil
382
+ #
383
+ # You can create as many {PublicSuffix::List} you want.
384
+ # The {PublicSuffix::List.default} rule list is used
385
+ # to tokenize and validate a domain.
386
+ #
387
+ # source://public_suffix//lib/public_suffix/list.rb#40
388
+ class PublicSuffix::List
389
+ # Initializes an empty {PublicSuffix::List}.
390
+ #
391
+ # @return [List] a new instance of List
392
+ # @yield [self] Yields on self.
393
+ # @yieldparam self [PublicSuffix::List] The newly created instance.
394
+ #
395
+ # source://public_suffix//lib/public_suffix/list.rb#106
396
+ def initialize; end
397
+
398
+ # Adds the given object to the list and optionally refreshes the rule index.
399
+ #
400
+ # @param rule [PublicSuffix::Rule::*] the rule to add to the list
401
+ # @return [self]
402
+ #
403
+ # source://public_suffix//lib/public_suffix/list.rb#141
404
+ def <<(rule); end
405
+
406
+ # Checks whether two lists are equal.
407
+ #
408
+ # List <tt>one</tt> is equal to <tt>two</tt>, if <tt>two</tt> is an instance of
409
+ # {PublicSuffix::List} and each +PublicSuffix::Rule::*+
410
+ # in list <tt>one</tt> is available in list <tt>two</tt>, in the same order.
411
+ #
412
+ # @param other [PublicSuffix::List] the List to compare
413
+ # @return [Boolean]
414
+ #
415
+ # source://public_suffix//lib/public_suffix/list.rb#120
416
+ def ==(other); end
417
+
418
+ # Adds the given object to the list and optionally refreshes the rule index.
419
+ #
420
+ # @param rule [PublicSuffix::Rule::*] the rule to add to the list
421
+ # @return [self]
422
+ #
423
+ # source://public_suffix//lib/public_suffix/list.rb#141
424
+ def add(rule); end
425
+
426
+ # Removes all rules.
427
+ #
428
+ # @return [self]
429
+ #
430
+ # source://public_suffix//lib/public_suffix/list.rb#164
431
+ def clear; end
432
+
433
+ # Gets the default rule.
434
+ #
435
+ # @return [PublicSuffix::Rule::*]
436
+ # @see PublicSuffix::Rule.default_rule
437
+ #
438
+ # source://public_suffix//lib/public_suffix/list.rb#226
439
+ def default_rule; end
440
+
441
+ # Iterates each rule in the list.
442
+ #
443
+ # source://public_suffix//lib/public_suffix/list.rb#128
444
+ def each(&block); end
445
+
446
+ # Checks whether the list is empty.
447
+ #
448
+ # @return [Boolean]
449
+ #
450
+ # source://public_suffix//lib/public_suffix/list.rb#157
451
+ def empty?; end
452
+
453
+ # Checks whether two lists are equal.
454
+ #
455
+ # List <tt>one</tt> is equal to <tt>two</tt>, if <tt>two</tt> is an instance of
456
+ # {PublicSuffix::List} and each +PublicSuffix::Rule::*+
457
+ # in list <tt>one</tt> is available in list <tt>two</tt>, in the same order.
458
+ #
459
+ # @param other [PublicSuffix::List] the List to compare
460
+ # @return [Boolean]
461
+ #
462
+ # source://public_suffix//lib/public_suffix/list.rb#120
463
+ def eql?(other); end
464
+
465
+ # Finds and returns the rule corresponding to the longest public suffix for the hostname.
466
+ #
467
+ # @param name [#to_s] the hostname
468
+ # @param default [PublicSuffix::Rule::*] the default rule to return in case no rule matches
469
+ # @return [PublicSuffix::Rule::*]
470
+ #
471
+ # source://public_suffix//lib/public_suffix/list.rb#174
472
+ def find(name, default: T.unsafe(nil), **options); end
473
+
474
+ # Gets the number of rules in the list.
475
+ #
476
+ # @return [Integer]
477
+ #
478
+ # source://public_suffix//lib/public_suffix/list.rb#150
479
+ def size; end
480
+
481
+ protected
482
+
483
+ # Returns the value of attribute rules.
484
+ #
485
+ # source://public_suffix//lib/public_suffix/list.rb#233
486
+ def rules; end
487
+
488
+ private
489
+
490
+ # source://public_suffix//lib/public_suffix/list.rb#238
491
+ def entry_to_rule(entry, value); end
492
+
493
+ # source://public_suffix//lib/public_suffix/list.rb#242
494
+ def rule_to_entry(rule); end
495
+
496
+ # Selects all the rules matching given hostame.
497
+ #
498
+ # If `ignore_private` is set to true, the algorithm will skip the rules that are flagged as
499
+ # private domain. Note that the rules will still be part of the loop.
500
+ # If you frequently need to access lists ignoring the private domains,
501
+ # you should create a list that doesn't include these domains setting the
502
+ # `private_domains: false` option when calling {.parse}.
503
+ #
504
+ # Note that this method is currently private, as you should not rely on it. Instead,
505
+ # the public interface is {#find}. The current internal algorithm allows to return all
506
+ # matching rules, but different data structures may not be able to do it, and instead would
507
+ # return only the match. For this reason, you should rely on {#find}.
508
+ #
509
+ # @param name [#to_s] the hostname
510
+ # @param ignore_private [Boolean]
511
+ # @return [Array<PublicSuffix::Rule::*>]
512
+ #
513
+ # source://public_suffix//lib/public_suffix/list.rb#199
514
+ def select(name, ignore_private: T.unsafe(nil)); end
515
+
516
+ class << self
517
+ # Gets the default rule list.
518
+ #
519
+ # Initializes a new {PublicSuffix::List} parsing the content
520
+ # of {PublicSuffix::List.default_list_content}, if required.
521
+ #
522
+ # @return [PublicSuffix::List]
523
+ #
524
+ # source://public_suffix//lib/public_suffix/list.rb#50
525
+ def default(**options); end
526
+
527
+ # Sets the default rule list to +value+.
528
+ #
529
+ # @param value [PublicSuffix::List] the new list
530
+ # @return [PublicSuffix::List]
531
+ #
532
+ # source://public_suffix//lib/public_suffix/list.rb#58
533
+ def default=(value); end
534
+
535
+ # Parse given +input+ treating the content as Public Suffix List.
536
+ #
537
+ # See http://publicsuffix.org/format/ for more details about input format.
538
+ #
539
+ # @param input [#each_line] the list to parse
540
+ # @param private_domains [Boolean] whether to ignore the private domains section
541
+ # @return [PublicSuffix::List]
542
+ #
543
+ # source://public_suffix//lib/public_suffix/list.rb#69
544
+ def parse(input, private_domains: T.unsafe(nil)); end
545
+ end
546
+ end
547
+
548
+ # source://public_suffix//lib/public_suffix/list.rb#42
549
+ PublicSuffix::List::DEFAULT_LIST_PATH = T.let(T.unsafe(nil), String)
550
+
551
+ # A Rule is a special object which holds a single definition
552
+ # of the Public Suffix List.
553
+ #
554
+ # There are 3 types of rules, each one represented by a specific
555
+ # subclass within the +PublicSuffix::Rule+ namespace.
556
+ #
557
+ # To create a new Rule, use the {PublicSuffix::Rule#factory} method.
558
+ #
559
+ # PublicSuffix::Rule.factory("ar")
560
+ # # => #<PublicSuffix::Rule::Normal>
561
+ #
562
+ # source://public_suffix//lib/public_suffix/rule.rb#22
563
+ module PublicSuffix::Rule
564
+ class << self
565
+ # The default rule to use if no rule match.
566
+ #
567
+ # The default rule is "*". From https://publicsuffix.org/list/:
568
+ #
569
+ # > If no rules match, the prevailing rule is "*".
570
+ #
571
+ # @return [PublicSuffix::Rule::Wildcard] The default rule.
572
+ #
573
+ # source://public_suffix//lib/public_suffix/rule.rb#344
574
+ def default; end
575
+
576
+ # Takes the +name+ of the rule, detects the specific rule class
577
+ # and creates a new instance of that class.
578
+ # The +name+ becomes the rule +value+.
579
+ #
580
+ # @example Creates a Normal rule
581
+ # PublicSuffix::Rule.factory("ar")
582
+ # # => #<PublicSuffix::Rule::Normal>
583
+ # @example Creates a Wildcard rule
584
+ # PublicSuffix::Rule.factory("*.ar")
585
+ # # => #<PublicSuffix::Rule::Wildcard>
586
+ # @example Creates an Exception rule
587
+ # PublicSuffix::Rule.factory("!congresodelalengua3.ar")
588
+ # # => #<PublicSuffix::Rule::Exception>
589
+ # @param content [#to_s] the content of the rule
590
+ # @return [PublicSuffix::Rule::*] A rule instance.
591
+ #
592
+ # source://public_suffix//lib/public_suffix/rule.rb#326
593
+ def factory(content, private: T.unsafe(nil)); end
594
+ end
595
+ end
596
+
597
+ # = Abstract rule class
598
+ #
599
+ # This represent the base class for a Rule definition
600
+ # in the {Public Suffix List}[https://publicsuffix.org].
601
+ #
602
+ # This is intended to be an Abstract class
603
+ # and you shouldn't create a direct instance. The only purpose
604
+ # of this class is to expose a common interface
605
+ # for all the available subclasses.
606
+ #
607
+ # * {PublicSuffix::Rule::Normal}
608
+ # * {PublicSuffix::Rule::Exception}
609
+ # * {PublicSuffix::Rule::Wildcard}
610
+ #
611
+ # ## Properties
612
+ #
613
+ # A rule is composed by 4 properties:
614
+ #
615
+ # value - A normalized version of the rule name.
616
+ # The normalization process depends on rule tpe.
617
+ #
618
+ # Here's an example
619
+ #
620
+ # PublicSuffix::Rule.factory("*.google.com")
621
+ # #<PublicSuffix::Rule::Wildcard:0x1015c14b0
622
+ # @value="google.com"
623
+ # >
624
+ #
625
+ # ## Rule Creation
626
+ #
627
+ # The best way to create a new rule is passing the rule name
628
+ # to the <tt>PublicSuffix::Rule.factory</tt> method.
629
+ #
630
+ # PublicSuffix::Rule.factory("com")
631
+ # # => PublicSuffix::Rule::Normal
632
+ #
633
+ # PublicSuffix::Rule.factory("*.com")
634
+ # # => PublicSuffix::Rule::Wildcard
635
+ #
636
+ # This method will detect the rule type and create an instance
637
+ # from the proper rule class.
638
+ #
639
+ # ## Rule Usage
640
+ #
641
+ # A rule describes the composition of a domain name and explains how to tokenize
642
+ # the name into tld, sld and trd.
643
+ #
644
+ # To use a rule, you first need to be sure the name you want to tokenize
645
+ # can be handled by the current rule.
646
+ # You can use the <tt>#match?</tt> method.
647
+ #
648
+ # rule = PublicSuffix::Rule.factory("com")
649
+ #
650
+ # rule.match?("google.com")
651
+ # # => true
652
+ #
653
+ # rule.match?("google.com")
654
+ # # => false
655
+ #
656
+ # Rule order is significant. A name can match more than one rule.
657
+ # See the {Public Suffix Documentation}[http://publicsuffix.org/format/]
658
+ # to learn more about rule priority.
659
+ #
660
+ # When you have the right rule, you can use it to tokenize the domain name.
661
+ #
662
+ # rule = PublicSuffix::Rule.factory("com")
663
+ #
664
+ # rule.decompose("google.com")
665
+ # # => ["google", "com"]
666
+ #
667
+ # rule.decompose("www.google.com")
668
+ # # => ["www.google", "com"]
669
+ #
670
+ # @abstract
671
+ #
672
+ # source://public_suffix//lib/public_suffix/rule.rb#102
673
+ class PublicSuffix::Rule::Base
674
+ # Initializes a new rule.
675
+ #
676
+ # @param value [String]
677
+ # @param private [Boolean]
678
+ # @return [Base] a new instance of Base
679
+ #
680
+ # source://public_suffix//lib/public_suffix/rule.rb#126
681
+ def initialize(value:, length: T.unsafe(nil), private: T.unsafe(nil)); end
682
+
683
+ # Checks whether this rule is equal to <tt>other</tt>.
684
+ #
685
+ # @param other [PublicSuffix::Rule::*] The rule to compare
686
+ # @return [Boolean] true if this rule and other are instances of the same class
687
+ # and has the same value, false otherwise.
688
+ #
689
+ # source://public_suffix//lib/public_suffix/rule.rb#137
690
+ def ==(other); end
691
+
692
+ # @abstract
693
+ # @param domain [#to_s] The domain name to decompose
694
+ # @raise [NotImplementedError]
695
+ # @return [Array<String, nil>]
696
+ #
697
+ # source://public_suffix//lib/public_suffix/rule.rb#180
698
+ def decompose(*_arg0); end
699
+
700
+ # Checks whether this rule is equal to <tt>other</tt>.
701
+ #
702
+ # @param other [PublicSuffix::Rule::*] The rule to compare
703
+ # @return [Boolean] true if this rule and other are instances of the same class
704
+ # and has the same value, false otherwise.
705
+ #
706
+ # source://public_suffix//lib/public_suffix/rule.rb#137
707
+ def eql?(other); end
708
+
709
+ # @return [String] the length of the rule
710
+ #
711
+ # source://public_suffix//lib/public_suffix/rule.rb#108
712
+ def length; end
713
+
714
+ # Checks if this rule matches +name+.
715
+ #
716
+ # A domain name is said to match a rule if and only if
717
+ # all of the following conditions are met:
718
+ #
719
+ # - When the domain and rule are split into corresponding labels,
720
+ # that the domain contains as many or more labels than the rule.
721
+ # - Beginning with the right-most labels of both the domain and the rule,
722
+ # and continuing for all labels in the rule, one finds that for every pair,
723
+ # either they are identical, or that the label from the rule is "*".
724
+ #
725
+ # @example
726
+ # PublicSuffix::Rule.factory("com").match?("example.com")
727
+ # # => true
728
+ # PublicSuffix::Rule.factory("com").match?("example.net")
729
+ # # => false
730
+ # @param name [String] the domain name to check
731
+ # @return [Boolean]
732
+ # @see https://publicsuffix.org/list/
733
+ #
734
+ # source://public_suffix//lib/public_suffix/rule.rb#163
735
+ def match?(name); end
736
+
737
+ # @abstract
738
+ # @raise [NotImplementedError]
739
+ #
740
+ # source://public_suffix//lib/public_suffix/rule.rb#173
741
+ def parts; end
742
+
743
+ # @return [Boolean] true if the rule is a private domain
744
+ #
745
+ # source://public_suffix//lib/public_suffix/rule.rb#111
746
+ def private; end
747
+
748
+ # @return [String] the rule definition
749
+ #
750
+ # source://public_suffix//lib/public_suffix/rule.rb#105
751
+ def value; end
752
+
753
+ class << self
754
+ # Initializes a new rule from the content.
755
+ #
756
+ # @param content [String] the content of the rule
757
+ # @param private [Boolean]
758
+ #
759
+ # source://public_suffix//lib/public_suffix/rule.rb#118
760
+ def build(content, private: T.unsafe(nil)); end
761
+ end
762
+ end
763
+
764
+ # @api internal
765
+ #
766
+ # source://public_suffix//lib/public_suffix/rule.rb#25
767
+ class PublicSuffix::Rule::Entry < ::Struct
768
+ # Returns the value of attribute length
769
+ #
770
+ # @return [Object] the current value of length
771
+ def length; end
772
+
773
+ # Sets the attribute length
774
+ #
775
+ # @param value [Object] the value to set the attribute length to.
776
+ # @return [Object] the newly set value
777
+ def length=(_); end
778
+
779
+ # Returns the value of attribute private
780
+ #
781
+ # @return [Object] the current value of private
782
+ def private; end
783
+
784
+ # Sets the attribute private
785
+ #
786
+ # @param value [Object] the value to set the attribute private to.
787
+ # @return [Object] the newly set value
788
+ def private=(_); end
789
+
790
+ # Returns the value of attribute type
791
+ #
792
+ # @return [Object] the current value of type
793
+ def type; end
794
+
795
+ # Sets the attribute type
796
+ #
797
+ # @param value [Object] the value to set the attribute type to.
798
+ # @return [Object] the newly set value
799
+ def type=(_); end
800
+
801
+ class << self
802
+ def [](*_arg0); end
803
+ def inspect; end
804
+ def keyword_init?; end
805
+ def members; end
806
+ def new(*_arg0); end
807
+ end
808
+ end
809
+
810
+ # Exception represents an exception rule (e.g. !parliament.uk).
811
+ #
812
+ # source://public_suffix//lib/public_suffix/rule.rb#265
813
+ class PublicSuffix::Rule::Exception < ::PublicSuffix::Rule::Base
814
+ # Decomposes the domain name according to rule properties.
815
+ #
816
+ # @param domain [#to_s] The domain name to decompose
817
+ # @return [Array<String>] The array with [trd + sld, tld].
818
+ #
819
+ # source://public_suffix//lib/public_suffix/rule.rb#286
820
+ def decompose(domain); end
821
+
822
+ # dot-split rule value and returns all rule parts
823
+ # in the order they appear in the value.
824
+ # The leftmost label is not considered a label.
825
+ #
826
+ # See http://publicsuffix.org/format/:
827
+ # If the prevailing rule is a exception rule,
828
+ # modify it by removing the leftmost label.
829
+ #
830
+ # @return [Array<String>]
831
+ #
832
+ # source://public_suffix//lib/public_suffix/rule.rb#301
833
+ def parts; end
834
+
835
+ # Gets the original rule definition.
836
+ #
837
+ # @return [String] The rule definition.
838
+ #
839
+ # source://public_suffix//lib/public_suffix/rule.rb#278
840
+ def rule; end
841
+
842
+ class << self
843
+ # Initializes a new rule from the content.
844
+ #
845
+ # @param content [#to_s] the content of the rule
846
+ # @param private [Boolean]
847
+ #
848
+ # source://public_suffix//lib/public_suffix/rule.rb#271
849
+ def build(content, private: T.unsafe(nil)); end
850
+ end
851
+ end
852
+
853
+ # Normal represents a standard rule (e.g. com).
854
+ #
855
+ # source://public_suffix//lib/public_suffix/rule.rb#187
856
+ class PublicSuffix::Rule::Normal < ::PublicSuffix::Rule::Base
857
+ # Decomposes the domain name according to rule properties.
858
+ #
859
+ # @param domain [#to_s] The domain name to decompose
860
+ # @return [Array<String>] The array with [trd + sld, tld].
861
+ #
862
+ # source://public_suffix//lib/public_suffix/rule.rb#200
863
+ def decompose(domain); end
864
+
865
+ # dot-split rule value and returns all rule parts
866
+ # in the order they appear in the value.
867
+ #
868
+ # @return [Array<String>]
869
+ #
870
+ # source://public_suffix//lib/public_suffix/rule.rb#210
871
+ def parts; end
872
+
873
+ # Gets the original rule definition.
874
+ #
875
+ # @return [String] The rule definition.
876
+ #
877
+ # source://public_suffix//lib/public_suffix/rule.rb#192
878
+ def rule; end
879
+ end
880
+
881
+ # Wildcard represents a wildcard rule (e.g. *.co.uk).
882
+ #
883
+ # source://public_suffix//lib/public_suffix/rule.rb#217
884
+ class PublicSuffix::Rule::Wildcard < ::PublicSuffix::Rule::Base
885
+ # Initializes a new rule.
886
+ #
887
+ # @param value [String]
888
+ # @param length [Integer]
889
+ # @param private [Boolean]
890
+ # @return [Wildcard] a new instance of Wildcard
891
+ #
892
+ # source://public_suffix//lib/public_suffix/rule.rb#232
893
+ def initialize(value:, length: T.unsafe(nil), private: T.unsafe(nil)); end
894
+
895
+ # Decomposes the domain name according to rule properties.
896
+ #
897
+ # @param domain [#to_s] The domain name to decompose
898
+ # @return [Array<String>] The array with [trd + sld, tld].
899
+ #
900
+ # source://public_suffix//lib/public_suffix/rule.rb#248
901
+ def decompose(domain); end
902
+
903
+ # dot-split rule value and returns all rule parts
904
+ # in the order they appear in the value.
905
+ #
906
+ # @return [Array<String>]
907
+ #
908
+ # source://public_suffix//lib/public_suffix/rule.rb#258
909
+ def parts; end
910
+
911
+ # Gets the original rule definition.
912
+ #
913
+ # @return [String] The rule definition.
914
+ #
915
+ # source://public_suffix//lib/public_suffix/rule.rb#240
916
+ def rule; end
917
+
918
+ class << self
919
+ # Initializes a new rule from the content.
920
+ #
921
+ # @param content [String] the content of the rule
922
+ # @param private [Boolean]
923
+ #
924
+ # source://public_suffix//lib/public_suffix/rule.rb#223
925
+ def build(content, private: T.unsafe(nil)); end
926
+ end
927
+ end
928
+
929
+ # source://public_suffix//lib/public_suffix.rb#27
930
+ PublicSuffix::STAR = T.let(T.unsafe(nil), String)
931
+
932
+ # @return [String] the current library version
933
+ #
934
+ # source://public_suffix//lib/public_suffix/version.rb#12
935
+ PublicSuffix::VERSION = T.let(T.unsafe(nil), String)