Class: Auphonic::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/gst-kitchen/auphonic/account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Account

Returns a new instance of Account.



24
25
26
27
# File 'lib/gst-kitchen/auphonic/account.rb', line 24

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

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



2
3
4
# File 'lib/gst-kitchen/auphonic/account.rb', line 2

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



2
3
4
# File 'lib/gst-kitchen/auphonic/account.rb', line 2

def username
  @username
end

Class Method Details

.init_from_systemObject



5
6
7
8
9
10
11
12
13
# 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_configObject



19
20
21
# File 'lib/gst-kitchen/auphonic/account.rb', line 19

def local_config
  File.join(Dir.getwd, '.auphonic')
end

.user_configObject



15
16
17
# File 'lib/gst-kitchen/auphonic/account.rb', line 15

def user_config
  File.expand_path("~/.auphonic")
end

Instance Method Details

#production(uuid) ⇒ Object



29
30
31
# File 'lib/gst-kitchen/auphonic/account.rb', line 29

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

#productionsObject



33
34
35
36
37
38
39
# 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