Sha256: 68e440f840827b8949026decc7d746db1fb14abbb64455be0dbee9bda1539b9d
Contents?: true
Size: 755 Bytes
Versions: 3
Compression:
Stored size: 755 Bytes
Contents
module NetFlix class Credentials < Valuable CONFIG_FILENAME = File.join( File.dirname(__FILE__), '..', '..', 'credentials.yml') has_value :key has_value :secret has_value :access_token def valid? (key && secret) != nil end class << self def from_file new(config_file_exists? ? YAML.load(File.open(CONFIG_FILENAME)) : {}) end def config_file_exists? File.exist? CONFIG_FILENAME end end # class methods def to_file! credentials_store = File.new(CONFIG_FILENAME, 'w') credentials_store.puts(self.to_yaml) credentials_store.close end def to_yaml attributes.to_yaml end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
netflix4r-0.0.2 | lib/net_flix/credentials.rb |
netflix4r-0.0.1 | lib/net_flix/credentials.rb |
netflix4r-0.0.0 | lib/net_flix/credentials.rb |