flickr_authentication 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWMwZmU0MzA1MmIzNmY1NzA4ZTMzNzAzNjVjYjY2MDc0NGU3M2MzOA==
5
+ data.tar.gz: !binary |-
6
+ NGU3NzE5N2I5NGNhNzhjMDEwYjhlMDQyMTRiMTFhMjcyZTRlODJhYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MTQxZmMxYjk5NWM4OWJjNDUyYmYwODcxZDA2YjBmZWQzNzU2N2QxYWYxMjM4
10
+ MDNkODdkZWViZGE0YTA3YTcwNDNkY2MzYTNkZmMwOTU0MWI0OTljMzc0M2M2
11
+ YWEyNzQ4MGViYTE1Mzk5NWNmYTFmODYzMjM0MDJkZGIxMjQ4MTU=
12
+ data.tar.gz: !binary |-
13
+ ZGI5OWM5MmM1MzA5ZDhjYTBmNDNjMDBhNzk3YWRjNDhhNTBiYWM3OTI2NTVk
14
+ ZTQ0MGUyZWJkYWViMjk5MTU1OTlkZWIwOTIwYTI3YTFlMGE3ZTNkYmNjOGYy
15
+ ZmVkZDAwZjZhMDdmNjFmM2Y1MzY3ZTg1ZWRjNzljZDAxODY4NzQ=
@@ -19,8 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency('launchy', '0.4.0')
22
- spec.add_dependency('flickraw', '0.8.4')
22
+ spec.add_dependency('flickraw', '0.9.8')
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "pry"
26
27
  end
@@ -20,28 +20,41 @@ class FlickrAuthentication
20
20
  if File.exists?(auth_file)
21
21
  puts "authenticating with #{auth_file}"
22
22
  data = YAML.load_file(auth_file)
23
- auth = flickr.auth.checkToken :auth_token => data["api_token"]
23
+
24
+ flickr.access_token = data['access_token']
25
+ flickr.access_secret = data['access_secret']
26
+
27
+ begin
28
+ flickr.test.login
29
+ rescue Exception => e
30
+ puts "There are bad credentials in #{@auth_file}. Delete it and try again."
31
+ end
32
+
24
33
  else
25
- frob = flickr.auth.getFrob
26
- auth_url = FlickRaw.auth_url :frob => frob, :perms => "write"
34
+ token = flickr.get_request_token
35
+ auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'write')
27
36
 
28
37
  puts " "
29
38
  puts "opening your browser..."
30
39
  sleep 1
31
- puts "Come back and press Enter when you are finished"
40
+ puts "Come back and press enter the given number when you are finished"
32
41
  sleep 2
33
42
  Launchy.open(auth_url)
34
43
 
35
- STDIN.getc
36
-
37
- # Authentication
38
- auth = flickr.auth.getToken :frob => frob
39
- login = flickr.test.login
44
+ verify = gets.strip
40
45
 
41
- puts auth.token
42
- data = {}
43
- data["api_token"] = auth.token
44
- File.open(auth_file, "w"){|f| YAML.dump(data, f) }
46
+ begin
47
+ flickr.get_access_token(token['oauth_token'], token['oauth_token_secret'], verify)
48
+ login = flickr.test.login
49
+ puts "You are now authenticated as #{login.username} with token #{flickr.access_token} and secret #{flickr.access_secret}"
50
+ # Write the YML File
51
+ data = {}
52
+ data["access_token"] = flickr.access_token
53
+ data["access_secret"] = flickr.access_secret
54
+ File.open(auth_file, "w"){|f| YAML.dump(data, f) }
55
+ rescue FlickRaw::FailedResponse => e
56
+ puts "Authentication failed : #{e.msg}"
57
+ end
45
58
  end
46
59
 
47
60
  flickr #return the flickr object
@@ -1,3 +1,3 @@
1
1
  class FlickrAuthentication
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickr_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Stephen Schor
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-23 00:00:00.000000000 Z
11
+ date: 2014-07-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: launchy
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
@@ -30,23 +27,20 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: flickraw
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '='
36
32
  - !ruby/object:Gem::Version
37
- version: 0.8.4
33
+ version: 0.9.8
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '='
44
39
  - !ruby/object:Gem::Version
45
- version: 0.8.4
40
+ version: 0.9.8
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,20 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
74
79
  requirements:
75
80
  - - ! '>='
76
81
  - !ruby/object:Gem::Version
@@ -94,27 +99,26 @@ files:
94
99
  homepage: https://github.com/nodanaonlyzuul/flickr_authentication
95
100
  licenses:
96
101
  - MIT
102
+ metadata: {}
97
103
  post_install_message:
98
104
  rdoc_options: []
99
105
  require_paths:
100
106
  - lib
101
107
  required_ruby_version: !ruby/object:Gem::Requirement
102
- none: false
103
108
  requirements:
104
109
  - - ! '>='
105
110
  - !ruby/object:Gem::Version
106
111
  version: '0'
107
112
  required_rubygems_version: !ruby/object:Gem::Requirement
108
- none: false
109
113
  requirements:
110
114
  - - ! '>='
111
115
  - !ruby/object:Gem::Version
112
116
  version: '0'
113
117
  requirements: []
114
118
  rubyforge_project:
115
- rubygems_version: 1.8.24
119
+ rubygems_version: 2.2.2
116
120
  signing_key:
117
- specification_version: 3
121
+ specification_version: 4
118
122
  summary: A library that simplifies the authentication and storing of credentials for
119
123
  applicartions that use the Flickr API
120
124
  test_files: []