invoist 1.0.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.
data/sig/invoist.rbs ADDED
@@ -0,0 +1,273 @@
1
+ # The public API of the invoist gem. The response types are in
2
+ # sig/invoist/models.rbs, generated from openapi.yaml.
3
+ module Invoist
4
+ VERSION: String
5
+ USER_AGENT: String
6
+
7
+ def self.new: (api_key: String, ?base_url: String, ?timeout: Numeric, ?max_retries: Integer,
8
+ ?transport: Transport::_Transport?, ?sleeper: Client::_Sleeper?) -> Client
9
+
10
+ # Anything Upload.wrap understands.
11
+ type file_input = Upload | String | _ToPath | _Reader | Hash[Symbol | String, untyped]
12
+ type month = String | _Strftime
13
+ type date = String | _Strftime
14
+
15
+ interface _Reader
16
+ def read: () -> String
17
+ end
18
+
19
+ interface _ToPath
20
+ def to_path: () -> String
21
+ end
22
+
23
+ interface _Strftime
24
+ def strftime: (String) -> String
25
+ end
26
+
27
+ class Client
28
+ interface _Sleeper
29
+ def call: (Numeric seconds) -> untyped
30
+ end
31
+
32
+ DEFAULT_BASE_URL: String
33
+ DEFAULT_TIMEOUT: Integer
34
+ DEFAULT_MAX_RETRIES: Integer
35
+ DEFAULT_WAIT_TIMEOUT: Integer
36
+ DEFAULT_POLL_INTERVAL: Integer
37
+
38
+ attr_reader bills: Bills
39
+ attr_reader held_emails: HeldEmails
40
+
41
+ def initialize: (api_key: String, ?base_url: String, ?timeout: Numeric, ?max_retries: Integer,
42
+ ?transport: Transport::_Transport?, ?sleeper: _Sleeper?) -> void
43
+ def base_url: () -> String
44
+ def timeout: () -> Numeric
45
+ def max_retries: () -> Integer
46
+ def inspect: () -> String
47
+
48
+ def extract: (file_input file, ?idempotency_key: String?) -> Models::ExtractResult
49
+ def extract_batch: (Array[file_input] files) -> Models::BatchResult
50
+ def list_documents: (?limit: Integer?, ?offset: Integer?, ?status: String?, ?flagged: bool?, ?q: String?,
51
+ ?category: String?) -> Array[Models::DocumentListItem]
52
+ def get_document: (String id) -> Models::DocumentDetail
53
+ def get_document_file: (String id) -> Download
54
+ def wait_for_extraction: (String id, ?timeout: Numeric, ?poll_interval: Numeric) -> Models::Extraction
55
+ def extract_and_wait: (file_input file, ?timeout: Numeric, ?poll_interval: Numeric,
56
+ ?idempotency_key: String?) -> Models::ExtractResult
57
+ def list_review_queue: (?status: String?) -> Array[Models::ReviewQueueListItem]
58
+ def resolve_review_item: (String id, ?status: String) -> Models::ReviewQueueItem
59
+ alias resolve_review_queue_item resolve_review_item
60
+ def list_categories: () -> Array[Models::Category]
61
+ def get_usage: () -> Models::Usage
62
+ def get_stats: () -> Models::StatsOverview
63
+ def list_webhook_endpoints: () -> Models::WebhookEndpointList
64
+ def create_webhook_endpoint: (url: String, ?events: Array[String]?, ?description: String?)
65
+ -> Models::WebhookEndpointWithSecret
66
+ def delete_webhook_endpoint: (String id) -> nil
67
+
68
+ private
69
+
70
+ def validate!: (untyped api_key, untyped timeout, untyped max_retries) -> void
71
+ def list: [T] (untyped body, String key, untyped model) -> Array[T]
72
+ def monotonic: () -> Float
73
+ end
74
+
75
+ class Bills
76
+ def initialize: (HTTP http) -> void
77
+ def list: (?paid: bool?, ?month: month?, ?sender: String?, ?q: String?, ?limit: Integer?, ?offset: Integer?)
78
+ -> Array[Models::Bill]
79
+ def get: (String id) -> Models::BillDetail
80
+ def get_file: (String id) -> Download
81
+ def summary: (?today: date?, ?days: Integer?) -> Models::BillsSummary
82
+ def stats: (?month: month?, ?sender: String?) -> Models::BillsStats
83
+ def mark_paid: (String id) -> Models::BillRecord
84
+ def mark_unpaid: (String id) -> Models::BillRecord
85
+ def inspect: () -> String
86
+
87
+ private
88
+
89
+ def record: (untyped body) -> Models::BillRecord
90
+ end
91
+
92
+ class HeldEmails
93
+ def initialize: (HTTP http) -> void
94
+ def list: () -> Array[Models::HeldEmail]
95
+ def inspect: () -> String
96
+ end
97
+
98
+ class Error < StandardError
99
+ attr_reader status: Integer
100
+ attr_reader code: String
101
+ attr_reader request_id: String?
102
+ attr_reader body: String?
103
+ attr_reader retry_after: Integer?
104
+
105
+ def initialize: (String message, status: Integer, code: String, ?request_id: String?, ?body: String?,
106
+ ?retry_after: Integer?) -> void
107
+ def self.from_response: (status: Integer, body: String?, ?headers: Hash[String, String?]) -> Error
108
+ def self.integer_seconds: (untyped value) -> Integer?
109
+ def auth_error?: () -> bool
110
+ def permission_error?: () -> bool
111
+ def not_found?: () -> bool
112
+ def rate_limited?: () -> bool
113
+ def retryable?: () -> bool
114
+ def inspect: () -> String
115
+ end
116
+
117
+ module Model
118
+ def self.included: (Module base) -> void
119
+ def self.coerce: (untyped value, untyped type) -> untyped
120
+ def self.dump: (untyped value) -> untyped
121
+
122
+ module ClassMethods
123
+ def from_h: (Hash[String | Symbol, untyped]? hash) -> untyped
124
+ def nested_types: () -> Hash[Symbol, untyped]
125
+ end
126
+
127
+ def []: (Symbol | String key) -> untyped
128
+ def to_h: () -> Hash[Symbol, untyped]
129
+ | [K, V] () { (Symbol, untyped) -> [K, V] } -> Hash[K, V]
130
+ def to_json: (*untyped) -> String
131
+ end
132
+
133
+ module Transport
134
+ interface _Transport
135
+ def call: (Request request) -> Response
136
+ end
137
+
138
+ class Request < Data
139
+ attr_reader http_method: String
140
+ attr_reader url: String
141
+ attr_reader headers: Hash[String, String]
142
+ attr_reader body: String?
143
+ attr_reader timeout: Numeric
144
+
145
+ def initialize: (http_method: String, url: String, headers: Hash[String, String], body: String?,
146
+ timeout: Numeric) -> void
147
+ def self.new: (http_method: String, url: String, headers: Hash[String, String], body: String?,
148
+ timeout: Numeric) -> instance
149
+ end
150
+
151
+ class Response < Data
152
+ attr_reader status: Integer
153
+ attr_reader headers: Hash[String, String | Array[String]]
154
+ attr_reader body: String
155
+
156
+ def initialize: (status: Integer, headers: Hash[String, String | Array[String]], body: String) -> void
157
+ def self.new: (status: Integer, headers: Hash[String, String | Array[String]], body: String) -> instance
158
+ def header: (String name) -> String?
159
+ end
160
+
161
+ class NetHTTP
162
+ def call: (Request request) -> Response
163
+
164
+ private
165
+
166
+ def connection: (URI::Generic uri, Numeric timeout) -> Net::HTTP
167
+ end
168
+ end
169
+
170
+ class Download < Data
171
+ attr_reader data: String
172
+ attr_reader content_type: String
173
+ attr_reader filename: String?
174
+
175
+ def initialize: (data: String, content_type: String, filename: String?) -> void
176
+ def self.new: (data: String, content_type: String, filename: String?) -> instance
177
+ def self.filename_from: (String? header) -> String?
178
+ def size: () -> Integer
179
+ def save: (String | _ToPath path) -> Integer
180
+ def inspect: () -> String
181
+ end
182
+
183
+ class Upload
184
+ CONTENT_TYPES: Hash[String, String]
185
+
186
+ attr_reader data: String
187
+ attr_reader filename: String
188
+ attr_reader content_type: String
189
+
190
+ def initialize: (String data, filename: String, ?content_type: String?) -> void
191
+ def self.wrap: (file_input input) -> Upload
192
+ def self.guess_content_type: (String filename) -> String
193
+ def inspect: () -> String
194
+ end
195
+
196
+ class Multipart
197
+ attr_reader body: String
198
+ attr_reader content_type: String
199
+
200
+ def initialize: (Array[[String, Upload]] parts) -> void
201
+
202
+ private
203
+
204
+ def escape: (untyped value) -> String
205
+ end
206
+
207
+ module Params
208
+ def self.boolean: (String name, bool? value) -> String?
209
+ def self.month: (String name, month? value) -> String?
210
+ def self.date: (String name, date? value) -> String?
211
+ def self.integer: (String name, Integer? value) -> Integer?
212
+ def self.id: (untyped value) -> String
213
+ def self.local: [T] (T value) -> (T | Time)
214
+ end
215
+
216
+ class HTTP
217
+ TIMEOUT_ERRORS: Array[Class]
218
+ NETWORK_ERRORS: Array[Class]
219
+ BASE_DELAY: Float
220
+ MAX_DELAY: Float
221
+ JITTER: Float
222
+ MAX_RETRY_AFTER: Integer
223
+
224
+ attr_reader base_url: String
225
+ attr_reader timeout: Numeric
226
+ attr_reader max_retries: Integer
227
+
228
+ def initialize: (api_key: String, base_url: String, timeout: Numeric, max_retries: Integer,
229
+ transport: Transport::_Transport, sleeper: Client::_Sleeper) -> void
230
+ def json: (String verb, String path, ?query: Hash[Symbol, untyped]?, ?body: untyped,
231
+ ?headers: Hash[String, String]) -> untyped
232
+ def multipart: (String path, Multipart form, ?headers: Hash[String, String]) -> untyped
233
+ def binary: (String path) -> Download
234
+ def sleep: (Numeric seconds) -> untyped
235
+ def retry_delay: (Integer attempt, ?Transport::Response? response) -> Float
236
+ def url: (String path, ?Hash[Symbol, untyped]? query) -> String
237
+
238
+ private
239
+
240
+ def retry?: (Error error, Integer attempt) -> bool
241
+ end
242
+
243
+ module Webhook
244
+ DOCUMENT_CREATED: String
245
+ EXTRACTION_COMPLETED: String
246
+ EXTRACTION_FAILED: String
247
+ REVIEW_ITEM_CREATED: String
248
+ REVIEW_ITEM_RESOLVED: String
249
+ DOCUMENT_REQUEST_FULFILLED: String
250
+ EVENT_TYPES: Array[String]
251
+ SIGNATURE_HEADER: String
252
+ EVENT_HEADER: String
253
+ DELIVERY_HEADER: String
254
+ DEFAULT_TOLERANCE: Integer
255
+
256
+ class Event < Data
257
+ include Invoist::Model
258
+ extend Invoist::Model::ClassMethods
259
+
260
+ attr_reader id: String
261
+ attr_reader type: String
262
+ attr_reader created_at: String
263
+ attr_reader data: Hash[String, untyped]
264
+
265
+ def initialize: (id: String, type: String, created_at: String, data: Hash[String, untyped]) -> void
266
+ def self.new: (id: String, type: String, created_at: String, data: Hash[String, untyped]) -> instance
267
+ end
268
+
269
+ def self.verify: (String | _Reader payload, String? signature_header, String secret, ?tolerance: Integer,
270
+ ?now: (Integer | Time)?) -> Event
271
+ def self.sign: (String payload, String secret, ?timestamp: Integer) -> String
272
+ end
273
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: invoist
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Invoist
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: 'Send Invoist an invoice, receipt or bill and get its details back as
13
+ data: sender, totals, tax, line items, due date and anything worth a second look.
14
+ Covers business workspaces (extraction, documents, review queue, webhooks) and households
15
+ (bills, what is due, held emails), with typed responses, automatic retries and webhook
16
+ signature checks. Uses only Ruby''s standard library.'
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - CHANGELOG.md
22
+ - LICENSE
23
+ - README.md
24
+ - SECURITY.md
25
+ - lib/invoist.rb
26
+ - lib/invoist/bills.rb
27
+ - lib/invoist/client.rb
28
+ - lib/invoist/download.rb
29
+ - lib/invoist/error.rb
30
+ - lib/invoist/http.rb
31
+ - lib/invoist/model.rb
32
+ - lib/invoist/models.rb
33
+ - lib/invoist/params.rb
34
+ - lib/invoist/transport.rb
35
+ - lib/invoist/upload.rb
36
+ - lib/invoist/version.rb
37
+ - lib/invoist/webhook.rb
38
+ - sig/invoist.rbs
39
+ - sig/invoist/models.rbs
40
+ homepage: https://invoi.st/docs
41
+ licenses:
42
+ - MIT
43
+ metadata:
44
+ homepage_uri: https://invoi.st/docs
45
+ documentation_uri: https://rubydoc.info/gems/invoist
46
+ source_code_uri: https://github.com/invoisthq/invoist-ruby
47
+ changelog_uri: https://github.com/invoisthq/invoist-ruby/blob/main/CHANGELOG.md
48
+ bug_tracker_uri: https://github.com/invoisthq/invoist-ruby/issues
49
+ rubygems_mfa_required: 'true'
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '3.3'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubygems_version: 4.0.20
65
+ specification_version: 4
66
+ summary: 'The official Ruby client for the Invoist API: invoices and bills in, clean
67
+ data out.'
68
+ test_files: []