enconvert 0.0.1

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.
@@ -0,0 +1,130 @@
1
+ # frozen_string_literal: true
2
+
3
+ # V2 response types, returned as plain read-only Structs with snake_case
4
+ # readers. Fields documented as optional may be `nil` — the API omits
5
+ # unset fields entirely (response_model_exclude_none) and every mapper
6
+ # guards each access.
7
+ module Enconvert
8
+ class V2
9
+ # ------------------------------------------------------------------
10
+ # Enumerations (documented as frozen constants; not runtime-enforced —
11
+ # the wire values are plain strings, mirroring the Node SDK's
12
+ # compile-time-only string union types).
13
+ # ------------------------------------------------------------------
14
+ module Enums
15
+ PERCEIVE_OUTPUTS = %w[
16
+ markdown markdown_fit html_cleaned html_raw screenshot screenshot_full_page
17
+ pdf links images structured
18
+ ].freeze
19
+ PERCEIVE_EXTRACT_NAMES = %w[
20
+ tables prices contacts metadata main_content headings structured_data technologies all
21
+ ].freeze
22
+ PERCEIVE_RESOURCE_TYPES = %w[
23
+ image media font stylesheet script xhr fetch websocket manifest other
24
+ ].freeze
25
+ PERCEIVE_CACHE_MODES = %w[enabled bypass refresh].freeze
26
+ PERCEIVE_STATUSES = %w[queued processing completed failed].freeze
27
+ PERCEIVE_EXTRACTION_TIERS = %w[heuristic css llm].freeze
28
+ PERCEIVE_BATCH_OUTPUT_MODES = %w[manifest zip].freeze
29
+ PERCEIVE_BATCH_STATUSES = %w[queued processing completed failed partial].freeze
30
+ DISCOVER_MODES = %w[sitemap crawl hybrid].freeze
31
+ LOOKUP_CATEGORIES = %w[web news images scholar patents maps].freeze
32
+ LOOKUP_TIME_FILTERS = %w[hour day week month year].freeze
33
+ CSS_FIELD_TYPES = %w[text attribute html regex nested list nested_list].freeze
34
+ DISTILL_EXTRACTION_TIERS = %w[css llm mixed none].freeze
35
+ INGEST_MODES = %w[urls sitemap crawl files].freeze
36
+ INGEST_STATUSES = %w[queued discovering processing completed failed canceled].freeze
37
+ WATCH_DIFF_MODES = %w[auto text structured tables metadata].freeze
38
+ WATCHER_STATUSES = %w[active paused deleted].freeze
39
+ end
40
+
41
+ V2Tokens = Struct.new(:input, :output, keyword_init: true)
42
+
43
+ # A rendered output stored server-side, addressed by signed URL.
44
+ V2OutputArtifact = Struct.new(:url, :object_key, :size_bytes, :content_type, :expires_in, keyword_init: true)
45
+
46
+ PerceiveResult = Struct.new(
47
+ :operation_id, :status, :url, :url_final, :content_hash, :render_quality, :cache_hit,
48
+ :outputs, :structured, :extraction_tier, :tokens, :cost_cents, :duration_ms, :error, :warnings,
49
+ keyword_init: true
50
+ )
51
+
52
+ PerceiveBatchResult = Struct.new(
53
+ :job_id, :status, :output_mode, :total, :completed, :failed, :pending, :zip, :items, :warnings,
54
+ keyword_init: true
55
+ )
56
+
57
+ DiscoverResult = Struct.new(
58
+ :url, :mode, :total, :urls, :pages_crawled, :truncated, :robots_respected, :sources, :warnings,
59
+ keyword_init: true
60
+ )
61
+
62
+ # One search hit, optionally carrying its full perceive result.
63
+ LookupItem = Struct.new(
64
+ :title, :url, :snippet, :position, :source, :date, :image_url, :thumbnail_url, :extra, :perceive,
65
+ keyword_init: true
66
+ )
67
+
68
+ LookupResult = Struct.new(
69
+ :lookup_id, :query, :category, :country, :locale, :time_filter, :total, :results,
70
+ :perceive_top, :perceive_operation_ids, :answer_box, :knowledge_graph, :credits, :cost_cents, :warnings,
71
+ keyword_init: true
72
+ )
73
+
74
+ DistillItem = Struct.new(
75
+ :url, :url_final, :status, :data, :extraction_tier, :fields_from_css, :fields_from_llm,
76
+ :render_quality, :tokens, :cost_cents, :error, :warnings,
77
+ keyword_init: true
78
+ )
79
+
80
+ DistillResult = Struct.new(
81
+ :operation_id, :total, :completed, :failed, :results, :total_cost_cents, :warnings,
82
+ keyword_init: true
83
+ )
84
+
85
+ IngestJob = Struct.new(
86
+ :job_id, :status, :mode, :pages_discovered, :pages_processed, :pages_failed, :total_chunks,
87
+ :output_url, :error_message, :webhook_url, :webhook_delivered, :created_at, :completed_at, :warnings,
88
+ keyword_init: true
89
+ )
90
+
91
+ # Compact job row from list_ingest_jobs (webhook_url replaced by a flag).
92
+ IngestJobSummary = Struct.new(
93
+ :job_id, :status, :mode, :pages_discovered, :pages_processed, :pages_failed, :total_chunks,
94
+ :output_url, :error_message, :webhook_configured, :webhook_delivered, :created_at, :completed_at,
95
+ keyword_init: true
96
+ )
97
+
98
+ IngestJobList = Struct.new(:jobs, :skip, :limit, :has_more, keyword_init: true)
99
+
100
+ WebhookSecret = Struct.new(
101
+ :secret, :signature_header, :timestamp_header, :signature_scheme, :replay_tolerance_seconds, :rotated,
102
+ keyword_init: true
103
+ )
104
+
105
+ WebhookRetryResult = Struct.new(:job_id, :delivered, :attempts, :status_code, :detail, keyword_init: true)
106
+
107
+ Watcher = Struct.new(
108
+ :watcher_id, :url, :status, :frequency_minutes, :diff_mode, :track_fields, :webhook_url,
109
+ :notify_email, :consecutive_errors, :checks_count, :last_check_at, :next_check_at,
110
+ :last_change_at, :created_at, :updated_at,
111
+ keyword_init: true
112
+ )
113
+
114
+ # Compact watcher row from list_watchers.
115
+ WatcherSummary = Struct.new(
116
+ :watcher_id, :url, :status, :frequency_minutes, :checks_count, :consecutive_errors,
117
+ :last_check_at, :next_check_at, :last_change_at, :created_at,
118
+ keyword_init: true
119
+ )
120
+
121
+ WatcherList = Struct.new(:watchers, :skip, :limit, :has_more, keyword_init: true)
122
+
123
+ WatcherSnapshot = Struct.new(
124
+ :checked_at, :has_changes, :similarity, :render_quality, :change_count, :changes,
125
+ keyword_init: true
126
+ )
127
+
128
+ WatcherSnapshotList = Struct.new(:watcher_id, :snapshots, :limit, keyword_init: true)
129
+ end
130
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Enconvert
4
+ VERSION = "0.0.1"
5
+ end
data/lib/enconvert.rb ADDED
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "enconvert/version"
4
+ require_relative "enconvert/errors"
5
+ require_relative "enconvert/formats"
6
+ require_relative "enconvert/internal"
7
+ require_relative "enconvert/results"
8
+ require_relative "enconvert/v2_results"
9
+ require_relative "enconvert/v2"
10
+ require_relative "enconvert/client"
11
+
12
+ # Enconvert — Ruby SDK for the Enconvert file conversion API.
13
+ #
14
+ # @example
15
+ # client = Enconvert::Client.new(api_key: "sk_...")
16
+ # result = client.convert_url_to_pdf("https://example.com", save_to: "page.pdf")
17
+ # puts result.presigned_url
18
+ module Enconvert
19
+ # The 43 implemented `{input}-to-{output}` conversion endpoints.
20
+ # See Enconvert::Formats for the full format tables and helpers.
21
+ IMPLEMENTED_CONVERSIONS = Formats::IMPLEMENTED_CONVERSIONS
22
+
23
+ # List the output formats the API implements for a given input format.
24
+ #
25
+ # @example
26
+ # Enconvert.valid_outputs_for("json") # => ["csv", "toml", "xml", "yaml"]
27
+ def self.valid_outputs_for(input_format)
28
+ Formats.valid_outputs_for(input_format)
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: enconvert
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Enconvert
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-07-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'Enconvert reads any web page or file into agent-ready Markdown, JSON,
14
+ or screenshots -- every read scored 0.0-1.0 for render quality, so blocked or empty-shell
15
+ pages never pass as real content. V2 API: perceive, discover, lookup, distill, ingest
16
+ (URLs or files), and watch. Also converts 40+ file and document formats -- URL-to-PDF/screenshot/markdown,
17
+ whole-site batch conversion, image conversion (jpeg/png/svg/heic/webp), and document
18
+ conversion (docx/pptx/xlsx/odt/html/markdown/csv/json/xml/yaml/toml).'
19
+ email:
20
+ - support@enconvert.com
21
+ executables: []
22
+ extensions: []
23
+ extra_rdoc_files: []
24
+ files:
25
+ - LICENSE
26
+ - README.md
27
+ - enconvert.gemspec
28
+ - lib/enconvert.rb
29
+ - lib/enconvert/client.rb
30
+ - lib/enconvert/errors.rb
31
+ - lib/enconvert/formats.rb
32
+ - lib/enconvert/internal.rb
33
+ - lib/enconvert/results.rb
34
+ - lib/enconvert/v2.rb
35
+ - lib/enconvert/v2_results.rb
36
+ - lib/enconvert/version.rb
37
+ homepage: https://enconvert.com
38
+ licenses:
39
+ - MIT
40
+ metadata:
41
+ homepage_uri: https://enconvert.com
42
+ source_code_uri: https://github.com/conversionapi/ruby-sdk
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 3.0.0
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubygems_version: 3.5.22
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Ruby SDK for Enconvert -- read any page or file into agent-ready Markdown,
62
+ JSON, or screenshots, every read scored. V2 perception + file conversion.
63
+ test_files: []