class TextRazor::Request
Constants
- HTTPS_URL
- HTTP_URL
- OPTIONS_MAPPING
Public Class Methods
post(text, options)
click to toggle source
# File lib/textrazor/request.rb, line 24 def self.post(text, options) ::RestClient.post url, build_query(text, options), accept_encoding: 'gzip' end
url()
click to toggle source
# File lib/textrazor/request.rb, line 28 def self.url TextRazor.configuration.secure ? HTTPS_URL : HTTP_URL end
Private Class Methods
build_query(text, options)
click to toggle source
# File lib/textrazor/request.rb, line 34 def self.build_query(text, options) query = {"text" => text, "apiKey" => options.delete(:api_key)} options.each do |key, value| value = value.join(",") if value.is_a?(Array) query[OPTIONS_MAPPING[key]] = value end query end