class Auphonic::Account

Attributes

password[R]
username[R]

Public Class Methods

init_from_system() click to toggle source
# File lib/gst-kitchen/auphonic/account.rb, line 5
def init_from_system
  auphonic_credentials = if File.exist?(local_config)
                           Yajl::Parser.parse File.read(local_config)
                         else
                           Yajl::Parser.parse File.read(user_config)
                         end

  self.new(auphonic_credentials)
end
local_config() click to toggle source
# File lib/gst-kitchen/auphonic/account.rb, line 19
def local_config
  File.join(Dir.getwd, '.auphonic')
end
new(options={}) click to toggle source
# File lib/gst-kitchen/auphonic/account.rb, line 24
def initialize(options={})
  @username = options["user"]
  @password = options["pass"]
end
user_config() click to toggle source
# File lib/gst-kitchen/auphonic/account.rb, line 15
def user_config
  File.expand_path("~/.auphonic")
end

Public Instance Methods

production(uuid) click to toggle source
# File lib/gst-kitchen/auphonic/account.rb, line 29
def production(uuid)
  Auphonic::Production.new(self, uuid)
end
productions() click to toggle source
# File lib/gst-kitchen/auphonic/account.rb, line 33
def productions
  request("https://auphonic.com/api/productions.json")["data"].map do |meta|
    production = Auphonic::Production.new(self)
    production.meta = meta
    production
  end
end

Private Instance Methods

request(url) click to toggle source
# File lib/gst-kitchen/auphonic/account.rb, line 44
def request(url)
  json = open(url, http_basic_authentication: [username, password])
  Yajl::Parser.parse(json.read)
end