Class: Ayadn::PinBoard
- Inherits:
-
Object
- Object
- Ayadn::PinBoard
- Defined in:
- lib/ayadn/pinboard.rb
Instance Method Summary collapse
- #ask_credentials ⇒ Object
- #has_credentials_file? ⇒ Boolean
- #load_credentials ⇒ Object
- #pin(data) ⇒ Object
Instance Method Details
#ask_credentials ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ayadn/pinboard.rb', line 9 def ask_credentials begin puts Status.pin_username pin_username = STDIN.gets.chomp() puts Status.pin_password pin_password = STDIN.noecho(&:gets).chomp() rescue Interrupt abort(Status.canceled) rescue => e puts Status.wtf Errors.global_error({error: e, caller: caller, data: [pin_username]}) end save_credentials(encode(pin_username, pin_password)) end |
#has_credentials_file? ⇒ Boolean
5 6 7 |
# File 'lib/ayadn/pinboard.rb', line 5 def has_credentials_file? File.exist?(Ayadn::Settings.config[:paths][:db] + '/ayadn_pinboard.db') end |
#load_credentials ⇒ Object
24 25 26 |
# File 'lib/ayadn/pinboard.rb', line 24 def load_credentials decode(File.read(Ayadn::Settings.config[:paths][:db] + '/ayadn_pinboard.db')) end |
#pin(data) ⇒ Object
28 29 30 31 |
# File 'lib/ayadn/pinboard.rb', line 28 def pin(data) pinboard = Pinboard::Client.new(:username => data.username, :password => data.password) pinboard.add(:url => data.url, :tags => data., :extended => data.text, :description => data.description) end |