class EMTypographer
Constants
- TYPOGRAPHER_REQUEST_URI
Public Class Methods
apply(text)
click to toggle source
# File lib/e_m_typographer.rb, line 8 def self.apply(text) response = send_typographer_post_request(text) JSON.parse(response.body)['result'] if response && response.body['result'] end
Private Class Methods
send_typographer_post_request(text)
click to toggle source
# File lib/e_m_typographer.rb, line 16 def self.send_typographer_post_request(text) return unless text.is_a?(String) && text[0] request = Net::HTTP.new(TYPOGRAPHER_REQUEST_URI.host, TYPOGRAPHER_REQUEST_URI.port) request.post(TYPOGRAPHER_REQUEST_URI.path, "text=#{text}") end