aurelian-contacts 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/lib/contacts/yahoo.rb +7 -10
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/contacts/yahoo.rb
CHANGED
@@ -53,11 +53,11 @@ module Contacts
|
|
53
53
|
#
|
54
54
|
class Yahoo
|
55
55
|
AUTH_DOMAIN = "https://api.login.yahoo.com"
|
56
|
-
AUTH_PATH = "/WSLogin/V1/wslogin?appid=#appid
|
56
|
+
AUTH_PATH = "/WSLogin/V1/wslogin?appid=#appid"
|
57
|
+
|
57
58
|
CREDENTIAL_PATH = "/WSLogin/V1/wspwtoken_login?appid=#appid&ts=#ts&token=#token"
|
58
59
|
ADDRESS_BOOK_DOMAIN = "address.yahooapis.com"
|
59
60
|
ADDRESS_BOOK_PATH = "/v1/searchContacts?format=json&fields=all&appid=#appid&WSSID=#wssid"
|
60
|
-
CONFIG_FILE = File.dirname(__FILE__) + '/../config/contacts.yml'
|
61
61
|
|
62
62
|
attr_reader :appid, :secret, :token, :wssid, :cookie
|
63
63
|
|
@@ -68,7 +68,7 @@ module Contacts
|
|
68
68
|
#--
|
69
69
|
# You can check an example of a config file inside config/ directory
|
70
70
|
#
|
71
|
-
def initialize(config_file
|
71
|
+
def initialize(config_file)
|
72
72
|
confs = YAML.load_file(config_file)['yahoo']
|
73
73
|
@appid = confs['appid']
|
74
74
|
@secret = confs['secret']
|
@@ -79,15 +79,12 @@ module Contacts
|
|
79
79
|
# generates that URL. The user must access that URL, and after he has done
|
80
80
|
# authentication, hi will be redirected to your application.
|
81
81
|
#
|
82
|
-
def get_authentication_url(appdata= nil)
|
82
|
+
def get_authentication_url(appdata= nil, send_userhash=1)
|
83
83
|
path = AUTH_PATH.clone
|
84
84
|
path.sub!(/#appid/, @appid)
|
85
|
-
|
86
|
-
timestamp = Time.now.utc.to_i
|
87
|
-
path.sub!(/#ts/, timestamp.to_s)
|
88
|
-
|
89
85
|
path<< "&appdata=#{appdata}" unless appdata.nil?
|
90
|
-
|
86
|
+
path<< "&send_userhash=#{send_userhash}" unless send_userhash.nil?
|
87
|
+
path<< "&ts=#{Time.now.utc.to_i.to_s}"
|
91
88
|
signature = MD5.hexdigest(path + @secret)
|
92
89
|
"#{AUTH_DOMAIN}#{path}&sig=#{signature}"
|
93
90
|
end
|
@@ -137,7 +134,7 @@ module Contacts
|
|
137
134
|
if sig == MD5.hexdigest(path_without_sig + @secret)
|
138
135
|
path.match(/token=(.+?)&/)
|
139
136
|
@token = $1
|
140
|
-
|
137
|
+
true
|
141
138
|
else
|
142
139
|
raise 'Signature not valid. This request may not have been sent from Yahoo.'
|
143
140
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aurelian-contacts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Mislav Marohni\xC4\x87"
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-09-
|
15
|
+
date: 2009-09-14 00:00:00 -07:00
|
16
16
|
default_executable:
|
17
17
|
dependencies: []
|
18
18
|
|