Sha256: aac45b333f09e1199cf1e038ef5c9deb414ffeabebbda790979cb643d44aa5a9

Contents?: true

Size: 744 Bytes

Versions: 10

Compression:

Stored size: 744 Bytes

Contents

class Auphonic::Account
  attr_reader :username, :password

  def self.init_from_system
    auphonic_credentials = Yajl::Parser.parse(File.read(File.expand_path("~/.auphonic")))
    self.new(auphonic_credentials)
  end

  def initialize(options={})
    @username = options["user"]
    @password = options["pass"]
  end

  def production(uuid)
    Auphonic::Production.new(self, uuid)
  end

  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

  def request(url)
    json = open(url, http_basic_authentication: [username, password])
    Yajl::Parser.parse(json.read)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gst-kitchen-0.8.0 lib/gst-kitchen/auphonic/account.rb
gst-kitchen-0.7.0 lib/gst-kitchen/auphonic/account.rb
gst-kitchen-0.6.4 lib/gst-kitchen/auphonic/account.rb
gst-kitchen-0.6.3 lib/gst-kitchen/auphonic/account.rb
gst-kitchen-0.6.2 lib/gst-kitchen/auphonic/account.rb
gst-kitchen-0.6.1 lib/gst-kitchen/auphonic/account.rb
gst-kitchen-0.5.0 lib/gst-kitchen/auphonic/account.rb
gst-kitchen-0.4.1 lib/gst-kitchen/auphonic/account.rb
gst-kitchen-0.4.0 lib/gst-kitchen/auphonic/account.rb
gst-kitchen-0.2.0 lib/gst-kitchen/auphonic/account.rb