Class: Instapaper::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/instapaper_download.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email, password) ⇒ Account

Returns a new instance of Account.



55
56
57
58
# File 'lib/instapaper_download.rb', line 55

def initialize(email, password)
  @email = email
  @password = password
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



54
55
56
# File 'lib/instapaper_download.rb', line 54

def email
  @email
end

#passwordObject (readonly)

Returns the value of attribute password.



54
55
56
# File 'lib/instapaper_download.rb', line 54

def password
  @password
end

Class Method Details

.from_config_file(config_file = ConfigFile.new) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/instapaper_download.rb', line 59

def self.from_config_file(config_file = ConfigFile.new)
  config = {}
  config = config_file.read_from_file if config_file.exists?
  unless config[:email] and config[:password]
    print "Please enter instapaper email address: "
    email = gets.chomp
    print "Please enter instapaper password: "
    `stty -echo`
    password = gets.chomp
    `stty echo`
    config[:email] = email
    config[:password] = password
    config_file.save_to_file_if_necessary(config)
  end
  return Account.new(config[:email], config[:password])
end