mogli 0.0.10 → 0.0.11

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.
data/lib/mogli/link.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  module Mogli
2
2
  class Link < Model
3
- define_properties :link, :message
3
+ define_properties :link, :message, :id, :name, :page, :created_time, :icon, :picture, :description
4
4
  creation_properties :link, :message
5
+
6
+ hash_populating_accessor :comments, "Comment"
7
+ hash_populating_accessor :from, "User"
5
8
  end
6
9
  end
data/lib/mogli/page.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Mogli
2
2
  class Page < Profile
3
3
 
4
- define_properties :id, :name, :category, :username
4
+ define_properties :id, :name, :category, :username, :access_token
5
5
 
6
6
  # General
7
7
  define_properties :fan_count, :link, :picture, :has_added_app
@@ -12,9 +12,20 @@ module Mogli
12
12
  # Musicians
13
13
  define_properties :record_label, :hometown, :band_members, :genre
14
14
 
15
+ def client_for_page
16
+ if access_token.blank?
17
+ raise MissingAccessToken.new("You can only get a client for this page if an access_token has been provided. i.e. via /me/accounts")
18
+ end
19
+ Client.new(access_token)
20
+ end
21
+
15
22
  def self.recognize?(hash)
16
23
  hash.has_key?("category")
17
24
  end
25
+
26
+ class MissingAccessToken < Exception
27
+ end
18
28
 
19
29
  end
30
+
20
31
  end
data/lib/mogli/profile.rb CHANGED
@@ -14,6 +14,10 @@ module Mogli
14
14
  has_association :links, "Link"
15
15
  has_association :statuses, "Status"
16
16
 
17
+ def image_url
18
+ "https://graph.facebook.com/#{id}/picture"
19
+ end
20
+
17
21
  def to_s
18
22
  name
19
23
  end
data/lib/mogli/user.rb CHANGED
@@ -3,7 +3,7 @@ module Mogli
3
3
  class User < Profile
4
4
 
5
5
  define_properties :first_name, :last_name, :link, :about, :birthday, :gender,
6
- :email, :website, :timezone, :updated_time, :verified, :political, :relationship_status
6
+ :email, :website, :timezone, :updated_time, :verified, :political, :relationship_status, :locale
7
7
 
8
8
  def self.recognize?(hash)
9
9
  !hash.has_key?("category")
@@ -23,6 +23,7 @@ module Mogli
23
23
  has_association :movies, "Movie"
24
24
  has_association :television, "Television"
25
25
  has_association :likes, "Page"
26
-
26
+ has_association :home, "Post"
27
+ has_association :accounts, "Page"
27
28
  end
28
29
  end
data/lib/mogli/work.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Mogli
2
2
  class Work < Model
3
3
 
4
- define_properties :start_date, :end_date
4
+ define_properties :start_date, :end_date, :description
5
5
 
6
6
  hash_populating_accessor :employer, "Page"
7
7
  hash_populating_accessor :location, "Page"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mogli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Mangino
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-06-28 00:00:00 -04:00
12
+ date: 2010-07-21 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency