class Transistor::Config
Attributes
host[RW]
id[RW]
secret[RW]
secure[RW]
Public Class Methods
new()
click to toggle source
# File lib/transistor.rb, line 12 def initialize @host = 'api.transistor.fm' @secure = true @tracking_url = 'track.transistor.fm/:entry_id.:format/:url' end
Public Instance Methods
base_url()
click to toggle source
# File lib/transistor.rb, line 18 def base_url if self.secure "https://#{self.host}" else "http://#{self.host}" end end
credentials()
click to toggle source
# File lib/transistor.rb, line 26 def credentials { id: self.id, key: self.secret, algorithm: 'sha256' } end
protocol()
click to toggle source
# File lib/transistor.rb, line 38 def protocol if self.secure 'https' else 'http' end end
tracking_url(entry_id, format, url)
click to toggle source
# File lib/transistor.rb, line 46 def tracking_url(entry_id, format, url) full_url = @tracking_url .gsub(':entry_id', entry_id.to_s) .gsub(':format', format.to_s) .gsub(':url', url) [self.protocol, '://', full_url].join() end
user_agent()
click to toggle source
# File lib/transistor.rb, line 34 def user_agent "Transistor Ruby Client, Version #{Transistor::Version}" end