Skip to content

Commit

Permalink
Rename to Mogli
Browse files Browse the repository at this point in the history
  • Loading branch information
mmangino committed May 3, 2010
1 parent f577f92 commit 756984d
Show file tree
Hide file tree
Showing 31 changed files with 111 additions and 111 deletions.
10 changes: 5 additions & 5 deletions Readme
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ The important part is to make a request to https://graph.facebook.com/oauth/auth

grab the result and copy the access_token parameter. This will need to be URL decoded.

With the decoded access_token, create a new Ogli client:
With the decoded access_token, create a new Mogli client:

in the ogli directory, run
in the mogli directory, run
irb -Ilib

require "rubygems"
require "init"
client = Ogli::Client.new("your_access_token")
client = Mogli::Client.new("your_access_token")

You can now fetch users with the client, for example:

Expand All @@ -39,12 +39,12 @@ Unfortunately, quite a bit of information is unavailable due to a facebook bug.

You can also fetch other objects by ID, for example:

album = Ogli::Album.find(99394368305)
album = Mogli::Album.find(99394368305)
album.photos

If the object requires a client, just pass one in:

album = Ogli::Album.find(99394368305,client)
album = Mogli::Album.find(99394368305,client)
album.photos

========================================
Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require "httparty"
require "hashie"
require "ogli"
require "mogli"
25 changes: 25 additions & 0 deletions lib/mogli.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module Mogli

end

require "mogli/model"
require "mogli/fetching_array"
require "mogli/action"
require "mogli/activity"
require "mogli/address"
require "mogli/album"
require "mogli/book"
require "mogli/comment"
require "mogli/event"
require "mogli/group"
require "mogli/interest"
require "mogli/movie"
require "mogli/music"
require "mogli/note"
require "mogli/page"
require "mogli/photo"
require "mogli/post"
require "mogli/television"
require "mogli/video"
require "mogli/user"
require "mogli/client"
2 changes: 1 addition & 1 deletion lib/ogli/action.rb → lib/mogli/action.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Action < Hashie::Mash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/activity.rb → lib/mogli/activity.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Activity < Hashie::Mash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/address.rb → lib/mogli/address.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Address < Hashie::Dash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/album.rb → lib/mogli/album.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Album < Hashie::Dash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/book.rb → lib/mogli/book.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Book < Hashie::Mash
include Model

Expand Down
10 changes: 5 additions & 5 deletions lib/ogli/client.rb → lib/mogli/client.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require "ogli/client/user"
require "mogli/client/user"
require "ruby-debug"

module Ogli
module Mogli
class Client
attr_reader :access_token
attr_reader :default_params

include HTTParty
include Ogli::Client::User
include Mogli::Client::User
class UnrecognizeableClassError < Exception; end

def api_path(path)
Expand Down Expand Up @@ -46,7 +46,7 @@ def extract_hash_or_array(hash_or_array,klass)
end

def extract_fetching_array(hash,klass)
f = Ogli::FetchingArray.new
f = Mogli::FetchingArray.new
f.concat(hash["data"])
f.client = self
f.classes = Array(klass)
Expand Down Expand Up @@ -74,7 +74,7 @@ def create_instance(klass,data)
end

def constantize_string(klass)
klass.is_a?(String) ? Ogli.const_get(klass) : klass
klass.is_a?(String) ? Mogli.const_get(klass) : klass
end

def determine_class(klass_or_klasses,data)
Expand Down
4 changes: 2 additions & 2 deletions lib/ogli/client/user.rb → lib/mogli/client/user.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Ogli
module Mogli
class Client
module User


def user(id)
get_and_map(id,Ogli::User)
get_and_map(id,Mogli::User)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/comment.rb → lib/mogli/comment.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Comment < Hashie::Dash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/event.rb → lib/mogli/event.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Event < Hashie::Dash
include Model
define_properties :id, :name, :description, :start_time, :end_time, :location, :privacy, :updated_time
Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/fetching_array.rb → lib/mogli/fetching_array.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class FetchingArray < Array
attr_accessor :next_url, :previous_url, :client, :classes

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/group.rb → lib/mogli/group.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Group < Hashie::Dash
include Model
define_properties :id, :name, :description, :link, :privacy, :updated_time
Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/interest.rb → lib/mogli/interest.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Interest < Hashie::Mash
include Model

Expand Down
6 changes: 3 additions & 3 deletions lib/ogli/model.rb → lib/mogli/model.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module Ogli
module Mogli
module Model
def client=(val)
@client=val
end

def client
@client || Ogli::Client.new
@client || Mogli::Client.new
end

def initialize(hash={},client=nil)
Expand Down Expand Up @@ -51,7 +51,7 @@ def recognize?(data)
end

def find(id,client=nil)
(client||Ogli::Client.new).get_and_map(id,self)
(client||Mogli::Client.new).get_and_map(id,self)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/movie.rb → lib/mogli/movie.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Movie < Hashie::Mash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/music.rb → lib/mogli/music.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Music < Hashie::Mash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/note.rb → lib/mogli/note.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Note < Hashie::Dash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/page.rb → lib/mogli/page.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Page < Hashie::Dash

include Model
Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/photo.rb → lib/mogli/photo.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Photo < Hashie::Dash
include Model
define_properties :id, :name, :picture, :source, :height, :width, :link, :icon,
Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/post.rb → lib/mogli/post.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Post < Hashie::Dash

include Model
Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/television.rb → lib/mogli/television.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Television < Hashie::Mash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/user.rb → lib/mogli/user.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

module Ogli
module Mogli
class User < Hashie::Mash
include Model

Expand Down
2 changes: 1 addition & 1 deletion lib/ogli/video.rb → lib/mogli/video.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ogli
module Mogli
class Video < Hashie::Dash
include Model

Expand Down
25 changes: 0 additions & 25 deletions lib/ogli.rb

This file was deleted.

6 changes: 3 additions & 3 deletions spec/client/client_user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require "spec_helper"
describe Ogli::Client do
describe Mogli::Client do
let :client do
Ogli::Client.new
Mogli::Client.new
end

it "fetches a user by id" do
client.should_receive(:get_and_map).with(12451752,Ogli::User).and_return("user")
client.should_receive(:get_and_map).with(12451752,Mogli::User).and_return("user")
client.user(12451752).should == "user"
end

Expand Down
Loading

0 comments on commit 756984d

Please sign in to comment.