Class: Texd::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/texd/client.rb

Defined Under Namespace

Classes: CompilationError, InputError, QueueError, ReferenceError, RenderError

Constant Summary collapse

ERRORS_BY_CATEGORY =
{
  "input"       => InputError,
  "compilation" => CompilationError,
  "queue"       => QueueError,
  "reference"   => ReferenceError,
}.freeze
USER_AGENT =
"texd-ruby/#{VERSION} Ruby/#{RUBY_VERSION}"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Client

Returns a new instance of Client.



81
82
83
# File 'lib/texd/client.rb', line 81

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



79
80
81
# File 'lib/texd/client.rb', line 79

def config
  @config
end

Instance Method Details

#render(upload_ios, **params) ⇒ Object



89
90
91
92
93
94
95
# File 'lib/texd/client.rb', line 89

def render(upload_ios, **params)
  params = config.default_render_params.merge(params)

  http("/render", params: params) { |uri|
    Net::HTTP::Post::Multipart.new uri, upload_ios
  }
end

#statusObject



85
86
87
# File 'lib/texd/client.rb', line 85

def status
  http("/status") { |uri| Net::HTTP::Get.new(uri) }
end