Method: Transcriptic::API#initialize
- Defined in:
- lib/transcriptic/api.rb
#initialize(options = {}) ⇒ API
Returns a new instance of API.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/transcriptic/api.rb', line 15 def initialize(={}) @api_key = .delete(:api_key) || ENV['TRANSCRIPTIC_API_KEY'] user_pass = ":#{@api_key}" = { :headers => {}, :host => 'transcriptic.com', :nonblock => false, :scheme => 'https' }.merge() [:headers] = { 'Accept' => 'application/json', 'Accept-Encoding' => 'gzip', 'Accept-Language' => 'en-US, en;q=0.8', 'Authorization' => "Token token=\"#{@api_key}\"", 'User-Agent' => "transcriptic-cli/#{Transcriptic::API::VERSION}", 'X-Transcriptic-API-Version' => '1', 'X-Ruby-Version' => RUBY_VERSION, 'X-Ruby-Platform' => RUBY_PLATFORM }.merge([:headers]) @connection = Excon.new("#{options[:scheme]}://#{options[:host]}", ) end |