class Plotly::Client
Attributes
conn[R]
Public Class Methods
new(username, api_key)
click to toggle source
@param username [String] @param api_key [String]
# File lib/plotly/client.rb, line 11 def initialize(username, api_key) @conn = Faraday.new( url: 'https://api.plot.ly/v2', headers: build_headers(username, api_key) ) end
Private Instance Methods
build_headers(username, api_key)
click to toggle source
@param username [String] @param api_key [String] @return [Hash] HTTP headers
# File lib/plotly/client.rb, line 23 def build_headers(username, api_key) encoded_auth = Base64.encode64("#{username}:#{api_key}") { 'plotly-client-platform' => "Ruby #{Plotly::VERSION}", 'content-type' => 'application/json', authorization: "Basic #{encoded_auth}" } end