Skip to content

Commit 4b50bad

Browse files
committed
doc: RubyDoc
1 parent 5717665 commit 4b50bad

1 file changed

Lines changed: 46 additions & 2 deletions

File tree

lib/lingodotdev.rb

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,61 @@
4646
# This ensures backwards compatibility if OpenSSL behavior changes
4747
end
4848

49+
# Ruby SDK for Lingo.dev localization and translation API.
50+
#
51+
# This module provides a simple and powerful interface for localizing content
52+
# in Ruby applications. It supports text, object (Hash), and chat message
53+
# localization with batch operations, progress tracking, and concurrent processing.
54+
#
55+
# @example Basic usage
56+
# engine = LingoDotDev::Engine.new(api_key: 'your-api-key')
57+
# result = engine.localize_text('Hello world', target_locale: 'es')
58+
# puts result # => "Hola mundo"
59+
#
60+
# @see Engine
4961
module LingoDotDev
62+
# Base error class for all SDK errors.
5063
class Error < StandardError; end
64+
65+
# Error raised for invalid arguments.
5166
class ArgumentError < Error; end
67+
68+
# Error raised for API request failures.
5269
class APIError < Error; end
70+
71+
# Error raised for server-side errors (5xx responses).
5372
class ServerError < APIError; end
73+
74+
# Error raised for authentication failures.
5475
class AuthenticationError < APIError; end
76+
77+
# Error raised for validation failures (invalid input or configuration).
5578
class ValidationError < ArgumentError; end
5679

80+
# Configuration for the Lingo.dev Engine.
81+
#
82+
# Holds API credentials and batch processing settings.
5783
class Configuration
58-
attr_accessor :api_key, :api_url, :batch_size, :ideal_batch_item_size
59-
84+
# @return [String] the Lingo.dev API key
85+
attr_accessor :api_key
86+
87+
# @return [String] the API endpoint URL
88+
attr_accessor :api_url
89+
90+
# @return [Integer] maximum number of items per batch (1-250)
91+
attr_accessor :batch_size
92+
93+
# @return [Integer] target word count per batch item (1-2500)
94+
attr_accessor :ideal_batch_item_size
95+
96+
# Creates a new Configuration instance.
97+
#
98+
# @param api_key [String] your Lingo.dev API key (required)
99+
# @param api_url [String] the API endpoint URL (default: 'https://engine.lingo.dev')
100+
# @param batch_size [Integer] maximum items per batch, 1-250 (default: 25)
101+
# @param ideal_batch_item_size [Integer] target word count per batch item, 1-2500 (default: 250)
102+
#
103+
# @raise [ValidationError] if any parameter is invalid
60104
def initialize(api_key:, api_url: 'https://engine.lingo.dev', batch_size: 25, ideal_batch_item_size: 250)
61105
@api_key = api_key
62106
@api_url = api_url

0 commit comments

Comments
 (0)