Chrononaut-rpx_now 0.5.6 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
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/Rakefile CHANGED
@@ -19,6 +19,7 @@ begin
19
19
  gem.homepage = "http://github.com/grosser/#{project_name}"
20
20
  gem.authors = ["Michael Grosser"]
21
21
  gem.add_dependency ['activesupport']
22
+ gem.files = ['**/*']
22
23
  end
23
24
  rescue LoadError
24
25
  puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
- ---
2
- :minor: 5
3
- :patch: 6
1
+ ---
4
2
  :major: 0
3
+ :minor: 5
4
+ :patch: 9
data/init.rb CHANGED
@@ -1 +1,2 @@
1
+ #Needed to load rpx_now when used as Rails plugin
1
2
  require 'rpx_now'
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)
@@ -64,10 +77,11 @@ module RPXNow
64
77
  end
65
78
  alias get_contacts contacts
66
79
 
67
- def embed_code(subdomain,url)
80
+ def embed_code(subdomain,url,options={})
81
+ options = {:width => '400', :height => '240', :language => 'en'}.merge(options)
68
82
  <<EOF
69
- <iframe src="https://#{subdomain}.#{HOST}/openid/embed?token_url=#{url}"
70
- scrolling="no" frameBorder="no" style="width:400px;height:240px;">
83
+ <iframe src="https://#{subdomain}.#{HOST}/openid/embed?token_url=#{url}&language_preference=#{options[:language]}"
84
+ scrolling="no" frameBorder="no" style="width:#{options[:width]}px;height:#{options[:height]}px;">
71
85
  </iframe>
72
86
  EOF
73
87
  end
@@ -148,7 +162,7 @@ EOF
148
162
  def post(path, data)
149
163
  require 'net/http'
150
164
  require 'net/https'
151
- request = Net::HTTP::Get.new(path)
165
+ request = Net::HTTP::Post.new(path)
152
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
153
167
  make_request(request)
154
168
  end
data/rpx_now.gemspec CHANGED
@@ -1,19 +1,21 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{rpx_now}
5
- s.version = "0.5.6"
8
+ s.version = "0.5.9"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["Michael Grosser"]
9
- s.date = %q{2009-06-20}
12
+ s.date = %q{2009-09-10}
10
13
  s.email = %q{grosser.michael@gmail.com}
11
14
  s.extra_rdoc_files = [
12
15
  "README.markdown"
13
16
  ]
14
17
  s.files = [
15
- ".gitignore",
16
- "CHANGELOG",
18
+ "CHANGELOG",
17
19
  "MIGRATION",
18
20
  "README.markdown",
19
21
  "Rakefile",
@@ -34,13 +36,13 @@ Gem::Specification.new do |s|
34
36
  s.homepage = %q{http://github.com/grosser/rpx_now}
35
37
  s.rdoc_options = ["--charset=UTF-8"]
36
38
  s.require_paths = ["lib"]
37
- s.rubygems_version = %q{1.3.4}
39
+ s.rubygems_version = %q{1.3.5}
38
40
  s.summary = %q{Helper to simplify RPX Now user login/creation}
39
41
  s.test_files = [
40
- "spec/rpx_now/contacts_collection_spec.rb",
41
- "spec/rpx_now/user_proxy_spec.rb",
42
- "spec/rpx_now_spec.rb",
43
- "spec/spec_helper.rb"
42
+ "spec/rpx_now/user_proxy_spec.rb",
43
+ "spec/rpx_now/contacts_collection_spec.rb",
44
+ "spec/spec_helper.rb",
45
+ "spec/rpx_now_spec.rb"
44
46
  ]
45
47
 
46
48
  if s.respond_to? :specification_version then
data/spec/rpx_now_spec.rb CHANGED
@@ -24,6 +24,30 @@ describe RPXNow do
24
24
  it "contains the url" do
25
25
  RPXNow.embed_code('xxx','my_url').should =~ /token_url=my_url/
26
26
  end
27
+
28
+ it "defaults to English" do
29
+ RPXNow.embed_code('xxx', 'my_url').should =~ /language_preference=en/
30
+ end
31
+
32
+ it "has a changeable language" do
33
+ RPXNow.embed_code('xxx', 'my_url', :language => 'es').should =~ /language_preference=es/
34
+ end
35
+
36
+ it "defaults to 400px width" do
37
+ RPXNow.embed_code('xxx', 'my_url').should =~ /width:400px;/
38
+ end
39
+
40
+ it "has a changeable width" do
41
+ RPXNow.embed_code('xxx', 'my_url', :width => '300').should =~ /width:300px;/
42
+ end
43
+
44
+ it "defaults to 240px height" do
45
+ RPXNow.embed_code('xxx', 'my_url').should =~ /height:240px;/
46
+ end
47
+
48
+ it "has a changeable height" do
49
+ RPXNow.embed_code('xxx', 'my_url', :height => '500').should =~ /height:500px;/
50
+ end
27
51
  end
28
52
 
29
53
  describe :popup_code do
@@ -128,6 +152,21 @@ describe RPXNow do
128
152
  end
129
153
  end
130
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
+
131
170
  describe :read_user_data_from_response do
132
171
  it "reads secondary names" do
133
172
  RPXNow.send(:read_user_data_from_response,{'profile'=>{'preferredUsername'=>'1'}})[:name].should == '1'
@@ -236,4 +275,4 @@ describe RPXNow do
236
275
  RPXNow.all_mappings.sort.should == [["1", ["http://test.myopenid.com"]], ["2", ["http://test-2.myopenid.com"]]]
237
276
  end
238
277
  end
239
- end
278
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Chrononaut-rpx_now
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
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-06-20 00:00:00 -07:00
12
+ date: 2009-09-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -31,7 +31,6 @@ extensions: []
31
31
  extra_rdoc_files:
32
32
  - README.markdown
33
33
  files:
34
- - .gitignore
35
34
  - CHANGELOG
36
35
  - MIGRATION
37
36
  - README.markdown
@@ -76,7 +75,7 @@ signing_key:
76
75
  specification_version: 3
77
76
  summary: Helper to simplify RPX Now user login/creation
78
77
  test_files:
79
- - spec/rpx_now/contacts_collection_spec.rb
80
78
  - spec/rpx_now/user_proxy_spec.rb
81
- - spec/rpx_now_spec.rb
79
+ - spec/rpx_now/contacts_collection_spec.rb
82
80
  - spec/spec_helper.rb
81
+ - spec/rpx_now_spec.rb
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- Manifest
2
- pkg
3
- .*.swp
4
- .*.swo