Top Level Namespace

Defined Under Namespace

Modules: FFFFFF

Instance Method Summary collapse

Instance Method Details

#get_access_tokenObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'bin/0xffffff', line 7

def get_access_token
  token = flickr.get_request_token
  auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'delete')

  puts "Open this url in your process to complete the authication process:"
  puts auth_url
  puts "Copy here the number given when you complete the process."
  verify = gets.strip

  begin
    flickr.get_access_token(token['oauth_token'], token['oauth_token_secret'], verify)
     = flickr.test.
    puts "You are now authenticated as #{.username} with token #{flickr.access_token} and secret #{flickr.access_secret}"

    [flickr.access_token, flickr.access_secret]
  rescue FlickRaw::FailedResponse => e
    puts "Authentication failed : #{e.msg}"
  end
end

#mainObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'bin/0xffffff', line 27

def main
  config = Pit.get("flickr.com")
  token = config['color_uploader_access_token']
  secret = config['color_uploader_access_secret']

  unless token && secret
    token, secret = get_access_token

    Pit.set("flickr.com", :data => {
        "color_uploader_access_token" => token,
        "color_uploader_access_secret" => secret
      })
  end

  flickr.access_token = token
  flickr.access_secret = secret

  FFFFFF::Runner.new(Pathname('~/.0xffffff').expand_path).run
end