rpx_now 0.6.21 → 0.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,6 +123,14 @@ Post a users activity, on their e.g. Facebook profile, complete with images, tit
123
123
  :media=>[{:type=>:image, :src=>product.image_url, :href=>product_url(product, :only_path => false)}]
124
124
  }
125
125
 
126
+ ### Offline user data access (RPX Plus/Pro)
127
+ Same response as auth_info but can be called with a identifier at any time.
128
+ Offline Profile Access must be enabled.
129
+ RPXNow.get_user_data(identifier, :extended => true)
130
+
131
+ ### Auth info
132
+ Same response as user_data with :raw_response, but without any kind of failure detection or post processing.
133
+ RPXNow.auth_info(params[:token])
126
134
 
127
135
  Author
128
136
  ======
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.21
1
+ 0.6.22
@@ -20,20 +20,33 @@ module RPXNow
20
20
  return_raw = options.delete(:raw_response)
21
21
 
22
22
  data = begin
23
- Api.call("auth_info", options.merge(:token => token))
23
+ auth_info(token, options)
24
24
  rescue ServerError
25
25
  return nil if $!.to_s=~/Data not found/
26
26
  raise
27
27
  end
28
28
 
29
29
  result = (block_given? ? yield(data) : (return_raw ? data : parse_user_data(data, options)))
30
- result.respond_to?(:with_indifferent_access) ? result.with_indifferent_access : result
30
+ with_indifferent_access(result)
31
+ end
32
+
33
+ # same data as user_data, but without any kind of post-processing
34
+ def auth_info(token, options={})
35
+ data = Api.call("auth_info", options.merge(:token => token))
36
+ with_indifferent_access(data)
37
+ end
38
+
39
+ # same as for auth_info if Offline Profile Access is enabled,
40
+ # but can be called at any time and does not need a token / does not expire
41
+ def get_user_data(identifier, options={})
42
+ data = Api.call("get_user_data", options.merge(:identifier => identifier))
43
+ with_indifferent_access(data)
31
44
  end
32
45
 
33
46
  # set the users status
34
47
  def set_status(identifier, status, options={})
35
48
  options = options.merge(:identifier => identifier, :status => status)
36
- data = Api.call("set_status", options)
49
+ Api.call("set_status", options)
37
50
  rescue ServerError
38
51
  return nil if $!.to_s=~/Data not found/
39
52
  raise
@@ -163,7 +176,7 @@ module RPXNow
163
176
  html_options = options.delete(:html) || {}
164
177
  html_options[:class] = "rpxnow #{html_options[:class]}".strip
165
178
  html_options[:href] ||= popup_url(subdomain, url, options)
166
- html_options = html_options.map{|k,v| %{#{k}="#{v}"}}
179
+ html_options = html_options.sort_by{|k,v|k.to_s}.map{|k,v| %{#{k}="#{v}"}}
167
180
 
168
181
  %{<a #{html_options.join(' ')}>#{text}</a>}
169
182
  end
@@ -173,6 +186,10 @@ module RPXNow
173
186
  popup_source(subdomain, url, options)
174
187
  end
175
188
 
189
+ def with_indifferent_access(hash)
190
+ hash.respond_to?(:with_indifferent_access) ? hash.with_indifferent_access : hash
191
+ end
192
+
176
193
  class ServerError < RuntimeError; end #backwards compatibility / catch all
177
194
  class ApiError < ServerError; end
178
195
  class ServiceUnavailableError < ServerError; end
@@ -5,22 +5,19 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rpx_now}
8
- s.version = "0.6.21"
8
+ s.version = "0.6.22"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2010-05-29}
12
+ s.date = %q{2010-07-19}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
- s.extra_rdoc_files = [
15
- "README.markdown"
16
- ]
17
14
  s.files = [
18
15
  ".gitignore",
19
16
  "CHANGELOG",
20
17
  "Gemfile",
21
18
  "MIGRATION",
22
- "README.markdown",
23
19
  "Rakefile",
20
+ "Readme.md",
24
21
  "VERSION",
25
22
  "certs/ssl_cert.pem",
26
23
  "init.rb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 21
9
- version: 0.6.21
8
+ - 22
9
+ version: 0.6.22
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Grosser
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-29 00:00:00 +02:00
17
+ date: 2010-07-19 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -35,15 +35,15 @@ executables: []
35
35
 
36
36
  extensions: []
37
37
 
38
- extra_rdoc_files:
39
- - README.markdown
38
+ extra_rdoc_files: []
39
+
40
40
  files:
41
41
  - .gitignore
42
42
  - CHANGELOG
43
43
  - Gemfile
44
44
  - MIGRATION
45
- - README.markdown
46
45
  - Rakefile
46
+ - Readme.md
47
47
  - VERSION
48
48
  - certs/ssl_cert.pem
49
49
  - init.rb