acts_as_graph_object 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,15 +13,22 @@ module ActsAsGraphObject
13
13
 
14
14
  module InstanceMethods
15
15
  # requires routes.default_url_options[:host] to be set!
16
- # TODO: add warning message if method is called?
17
- def url
18
- url_helpers.send("#{self.class}_url".downcase, self) rescue nil
16
+ # in nested associations parent is passed, e.g. @review.url(@movie)
17
+ def url(*args)
18
+ logger.warn "Using #{self.class.name}.url directly not recommended: please override in your model/view."
19
+ url_helpers.send([self].unshift(*args).map(&:class).join('_').downcase + '_url', *args.push(self)) rescue nil
19
20
  end
20
21
 
21
22
  def type
22
23
  [configuration.namespace, self.class.name.underscore].join(':')
23
24
  end
24
25
 
26
+ # helper for sending custom actions, e.g. (using Koala):
27
+ # user.put_connections('me', action('watch'), movie: @movie.url)
28
+ def action(name = '')
29
+ [configuration.namespace, name].join(':') unless name.empty?
30
+ end
31
+
25
32
  def graph_properties
26
33
  # standard object properties & alternative names
27
34
  default_properties = {
@@ -32,7 +39,7 @@ module ActsAsGraphObject
32
39
  :description => [:info, :details],
33
40
  :site_name => [:site],
34
41
  :latitude => [:lat],
35
- :longitude => [:long],
42
+ :longitude => [:lng],
36
43
  :street_address => [:address],
37
44
  :locality => [:locale, :area],
38
45
  :region => [:province, :territory],
@@ -40,7 +47,8 @@ module ActsAsGraphObject
40
47
  :country_name => [:country],
41
48
  :email => [:email_address],
42
49
  :phone_number => [:phone],
43
- :fax_number => [:fax]
50
+ :fax_number => [:fax],
51
+ :determiner => [:prefix]
44
52
  }
45
53
 
46
54
  # property/content pairs
@@ -1,3 +1,3 @@
1
1
  module ActsAsGraphObject
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_graph_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-19 00:00:00.000000000 Z
12
+ date: 2012-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -71,3 +71,4 @@ signing_key:
71
71
  specification_version: 3
72
72
  summary: Facebook Open Graph object mapper.
73
73
  test_files: []
74
+ has_rdoc: