Sha256: 92b8cab7dd4fed4d2fcedc93e57ae088bfa753546b9db211dea2aca06cf563d8
Contents?: true
Size: 887 Bytes
Versions: 3
Compression:
Stored size: 887 Bytes
Contents
module WebTranslateIt # A few useful functions class Util # Return a string representing the gem version # For example "1.4.4" def self.version hash = YAML.load_file File.join(File.dirname(__FILE__), '..', '..' '/version.yml') [hash[:major], hash[:minor], hash[:patch]].join('.') end # Yields a HTTP connection over SSL to Web Translate It. # This is used for the connections to the API throughout the library. # Use it like so: # # WebTranslateIt::Util.http_connection do |http| # request = Net::HTTP::Get.new(api_url) # response = http.request(request) # end # def self.http_connection http = Net::HTTP.new('webtranslateit.com', 443) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.read_timeout = 10 yield http end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
web_translate_it-1.4.7 | lib/web_translate_it/util.rb |
web_translate_it-1.4.6 | lib/web_translate_it/util.rb |
web_translate_it-1.4.5 | lib/web_translate_it/util.rb |