grosser-rpx_now 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -1
- data/README.markdown +6 -0
- data/VERSION +1 -0
- data/lib/rpx_now.rb +14 -1
- data/rpx_now.gemspec +21 -21
- data/spec/rpx_now_spec.rb +16 -1
- metadata +4 -5
- data/VERSION.yml +0 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
0.5.9
|
2
|
+
-----
|
3
|
+
* Switched from Get to Post requests
|
4
|
+
|
1
5
|
0.5.0
|
2
6
|
----
|
3
7
|
* ApiError is raised when API KEY was invalid (before did only return nil)
|
@@ -20,4 +24,4 @@
|
|
20
24
|
|
21
25
|
0.3
|
22
26
|
----
|
23
|
-
* RPXNow::ServerError will be thrown when something is invalid/goes wrong, so watch out (not for invalid tokens in user_data)...
|
27
|
+
* RPXNow::ServerError will be thrown when something is invalid/goes wrong, so watch out (not for invalid tokens in user_data)...
|
data/README.markdown
CHANGED
@@ -92,6 +92,10 @@ A identifyer can only belong to one user (in doubt the last one it was mapped to
|
|
92
92
|
Retrieve all contacts for a given user:
|
93
93
|
RPXNow.contacts(identifier).each {|c| puts "#{c['displayName']}: #{c['emails']}}
|
94
94
|
|
95
|
+
###Status updates (PRX Pro)
|
96
|
+
Send a status update to provider (a tweet/facebook-status/...) :
|
97
|
+
RPXNow.set_status(identifier, "I just registered at yourdomain.com ...")
|
98
|
+
|
95
99
|
TODO
|
96
100
|
====
|
97
101
|
- add provider / credentials helpers ?
|
@@ -99,8 +103,10 @@ TODO
|
|
99
103
|
Author
|
100
104
|
======
|
101
105
|
###Contributors
|
106
|
+
- [Amunds](http://github.com/Amunds)
|
102
107
|
- [DBA](http://github.com/DBA)
|
103
108
|
- [dbalatero](http://github.com/dbalatero)
|
109
|
+
- [jackdempsey](http://jackndempsey.blogspot.com/)
|
104
110
|
|
105
111
|
[Michael Grosser](http://pragmatig.wordpress.com)
|
106
112
|
grosser.michael@gmail.com
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.5.9
|
data/lib/rpx_now.rb
CHANGED
@@ -28,6 +28,19 @@ module RPXNow
|
|
28
28
|
if block_given? then yield(data) else read_user_data_from_response(data) end
|
29
29
|
end
|
30
30
|
|
31
|
+
# set the users status
|
32
|
+
def set_status(identifier, status, *args)
|
33
|
+
api_key, version, options = extract_key_version_and_options!(args)
|
34
|
+
options = {:identifier => identifier, :status => status, :apiKey => api_key}.merge options
|
35
|
+
|
36
|
+
begin
|
37
|
+
data = secure_json_post("/api/v#{version}/set_status", options)
|
38
|
+
rescue ServerError
|
39
|
+
return nil if $!.to_s=~/Data not found/
|
40
|
+
raise
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
31
44
|
# maps an identifier to an primary-key (e.g. user.id)
|
32
45
|
def map(identifier, primary_key, *args)
|
33
46
|
api_key, version, options = extract_key_version_and_options!(args)
|
@@ -149,7 +162,7 @@ EOF
|
|
149
162
|
def post(path, data)
|
150
163
|
require 'net/http'
|
151
164
|
require 'net/https'
|
152
|
-
request = Net::HTTP::
|
165
|
+
request = Net::HTTP::Post.new(path)
|
153
166
|
request.form_data = data.map{|k,v| [k.to_s,v]}#symbol keys -> string because of ruby 1.9.x bug http://redmine.ruby-lang.org/issues/show/1351
|
154
167
|
make_request(request)
|
155
168
|
end
|
data/rpx_now.gemspec
CHANGED
@@ -2,33 +2,33 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rpx_now}
|
5
|
-
s.version = "0.5.
|
5
|
+
s.version = "0.5.9"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Michael Grosser"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-09-10}
|
10
10
|
s.email = %q{grosser.michael@gmail.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"README.markdown"
|
13
13
|
]
|
14
14
|
s.files = [
|
15
15
|
"CHANGELOG",
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
"MIGRATION",
|
17
|
+
"README.markdown",
|
18
|
+
"Rakefile",
|
19
|
+
"VERSION",
|
20
|
+
"certs/ssl_cert.pem",
|
21
|
+
"init.rb",
|
22
|
+
"lib/rpx_now.rb",
|
23
|
+
"lib/rpx_now/contacts_collection.rb",
|
24
|
+
"lib/rpx_now/user_integration.rb",
|
25
|
+
"lib/rpx_now/user_proxy.rb",
|
26
|
+
"rpx_now.gemspec",
|
27
|
+
"spec/fixtures/get_contacts_response.json",
|
28
|
+
"spec/rpx_now/contacts_collection_spec.rb",
|
29
|
+
"spec/rpx_now/user_proxy_spec.rb",
|
30
|
+
"spec/rpx_now_spec.rb",
|
31
|
+
"spec/spec_helper.rb"
|
32
32
|
]
|
33
33
|
s.homepage = %q{http://github.com/grosser/rpx_now}
|
34
34
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -37,9 +37,9 @@ Gem::Specification.new do |s|
|
|
37
37
|
s.summary = %q{Helper to simplify RPX Now user login/creation}
|
38
38
|
s.test_files = [
|
39
39
|
"spec/rpx_now_spec.rb",
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
"spec/rpx_now/contacts_collection_spec.rb",
|
41
|
+
"spec/rpx_now/user_proxy_spec.rb",
|
42
|
+
"spec/spec_helper.rb"
|
43
43
|
]
|
44
44
|
|
45
45
|
if s.respond_to? :specification_version then
|
data/spec/rpx_now_spec.rb
CHANGED
@@ -152,6 +152,21 @@ describe RPXNow do
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
+
describe :set_status do
|
156
|
+
before do
|
157
|
+
@response_body = %Q({ "stat": "ok" })
|
158
|
+
end
|
159
|
+
|
160
|
+
def fake_response
|
161
|
+
mock(:code=>"200",:body=>@response_body)
|
162
|
+
end
|
163
|
+
|
164
|
+
it "parses JSON response to result hash" do
|
165
|
+
RPXNow.expects(:post).returns fake_response
|
166
|
+
RPXNow.set_status('identifier', 'Chillen...').should == {'stat' => 'ok'}
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
155
170
|
describe :read_user_data_from_response do
|
156
171
|
it "reads secondary names" do
|
157
172
|
RPXNow.send(:read_user_data_from_response,{'profile'=>{'preferredUsername'=>'1'}})[:name].should == '1'
|
@@ -260,4 +275,4 @@ describe RPXNow do
|
|
260
275
|
RPXNow.all_mappings.sort.should == [["1", ["http://test.myopenid.com"]], ["2", ["http://test-2.myopenid.com"]]]
|
261
276
|
end
|
262
277
|
end
|
263
|
-
end
|
278
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grosser-rpx_now
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -35,7 +35,7 @@ files:
|
|
35
35
|
- MIGRATION
|
36
36
|
- README.markdown
|
37
37
|
- Rakefile
|
38
|
-
- VERSION
|
38
|
+
- VERSION
|
39
39
|
- certs/ssl_cert.pem
|
40
40
|
- init.rb
|
41
41
|
- lib/rpx_now.rb
|
@@ -50,7 +50,6 @@ files:
|
|
50
50
|
- spec/spec_helper.rb
|
51
51
|
has_rdoc: false
|
52
52
|
homepage: http://github.com/grosser/rpx_now
|
53
|
-
licenses:
|
54
53
|
post_install_message:
|
55
54
|
rdoc_options:
|
56
55
|
- --charset=UTF-8
|
@@ -71,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
70
|
requirements: []
|
72
71
|
|
73
72
|
rubyforge_project:
|
74
|
-
rubygems_version: 1.
|
73
|
+
rubygems_version: 1.2.0
|
75
74
|
signing_key:
|
76
75
|
specification_version: 3
|
77
76
|
summary: Helper to simplify RPX Now user login/creation
|
data/VERSION.yml
DELETED