Class: Ayadn::PinBoard
Instance Method Summary collapse
- #ask_credentials ⇒ Object
- #has_credentials_file? ⇒ Boolean
-
#initialize ⇒ PinBoard
constructor
A new instance of PinBoard.
- #load_credentials ⇒ Object
- #pin(data) ⇒ Object
Constructor Details
Instance Method Details
#ask_credentials ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ayadn/pinboard.rb', line 13 def ask_credentials begin @status.pin_username pin_username = STDIN.gets.chomp() @status.pin_password pin_password = STDIN.noecho(&:gets).chomp() rescue Interrupt @status.canceled exit rescue => e @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
9 10 11 |
# File 'lib/ayadn/pinboard.rb', line 9 def has_credentials_file? File.exist?(Ayadn::Settings.config[:paths][:auth] + '/pinboard.data') end |
#load_credentials ⇒ Object
29 30 31 |
# File 'lib/ayadn/pinboard.rb', line 29 def load_credentials decode(File.read(Ayadn::Settings.config[:paths][:auth] + '/pinboard.data')) end |
#pin(data) ⇒ Object
33 34 35 36 |
# File 'lib/ayadn/pinboard.rb', line 33 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 |