From 756984d54f82bfbef31760769979e2d889566031 Mon Sep 17 00:00:00 2001 From: Mike Mangino Date: Mon, 3 May 2010 10:37:59 -0400 Subject: [PATCH] Rename to Mogli --- Readme | 10 +++--- init.rb | 2 +- lib/mogli.rb | 25 ++++++++++++++ lib/{ogli => mogli}/action.rb | 2 +- lib/{ogli => mogli}/activity.rb | 2 +- lib/{ogli => mogli}/address.rb | 2 +- lib/{ogli => mogli}/album.rb | 2 +- lib/{ogli => mogli}/book.rb | 2 +- lib/{ogli => mogli}/client.rb | 10 +++--- lib/{ogli => mogli}/client/user.rb | 4 +-- lib/{ogli => mogli}/comment.rb | 2 +- lib/{ogli => mogli}/event.rb | 2 +- lib/{ogli => mogli}/fetching_array.rb | 2 +- lib/{ogli => mogli}/group.rb | 2 +- lib/{ogli => mogli}/interest.rb | 2 +- lib/{ogli => mogli}/model.rb | 6 ++-- lib/{ogli => mogli}/movie.rb | 2 +- lib/{ogli => mogli}/music.rb | 2 +- lib/{ogli => mogli}/note.rb | 2 +- lib/{ogli => mogli}/page.rb | 2 +- lib/{ogli => mogli}/photo.rb | 2 +- lib/{ogli => mogli}/post.rb | 2 +- lib/{ogli => mogli}/television.rb | 2 +- lib/{ogli => mogli}/user.rb | 2 +- lib/{ogli => mogli}/video.rb | 2 +- lib/ogli.rb | 25 -------------- spec/client/client_user_spec.rb | 6 ++-- spec/client_spec.rb | 50 +++++++++++++-------------- spec/fetching_array_spec.rb | 26 +++++++------- spec/post_spec.rb | 10 +++--- spec/user_spec.rb | 10 +++--- 31 files changed, 111 insertions(+), 111 deletions(-) create mode 100644 lib/mogli.rb rename lib/{ogli => mogli}/action.rb (82%) rename lib/{ogli => mogli}/activity.rb (83%) rename lib/{ogli => mogli}/address.rb (91%) rename lib/{ogli => mogli}/album.rb (95%) rename lib/{ogli => mogli}/book.rb (82%) rename lib/{ogli => mogli}/client.rb (93%) rename lib/{ogli => mogli}/client/user.rb (63%) rename lib/{ogli => mogli}/comment.rb (93%) rename lib/{ogli => mogli}/event.rb (97%) rename lib/{ogli => mogli}/fetching_array.rb (97%) rename lib/{ogli => mogli}/group.rb (96%) rename lib/{ogli => mogli}/interest.rb (83%) rename lib/{ogli => mogli}/model.rb (91%) rename lib/{ogli => mogli}/movie.rb (82%) rename lib/{ogli => mogli}/music.rb (82%) rename lib/{ogli => mogli}/note.rb (95%) rename lib/{ogli => mogli}/page.rb (95%) rename lib/{ogli => mogli}/photo.rb (94%) rename lib/{ogli => mogli}/post.rb (96%) rename lib/{ogli => mogli}/television.rb (83%) rename lib/{ogli => mogli}/user.rb (97%) rename lib/{ogli => mogli}/video.rb (95%) delete mode 100644 lib/ogli.rb diff --git a/Readme b/Readme index 459bb30..8711e24 100644 --- a/Readme +++ b/Readme @@ -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: @@ -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 ======================================== diff --git a/init.rb b/init.rb index 5e3a5be..3d33c7b 100644 --- a/init.rb +++ b/init.rb @@ -1,3 +1,3 @@ require "httparty" require "hashie" -require "ogli" +require "mogli" diff --git a/lib/mogli.rb b/lib/mogli.rb new file mode 100644 index 0000000..cfda6c0 --- /dev/null +++ b/lib/mogli.rb @@ -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" \ No newline at end of file diff --git a/lib/ogli/action.rb b/lib/mogli/action.rb similarity index 82% rename from lib/ogli/action.rb rename to lib/mogli/action.rb index e075fe1..505ea0d 100644 --- a/lib/ogli/action.rb +++ b/lib/mogli/action.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Action < Hashie::Mash include Model diff --git a/lib/ogli/activity.rb b/lib/mogli/activity.rb similarity index 83% rename from lib/ogli/activity.rb rename to lib/mogli/activity.rb index 516e38b..01dd279 100644 --- a/lib/ogli/activity.rb +++ b/lib/mogli/activity.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Activity < Hashie::Mash include Model diff --git a/lib/ogli/address.rb b/lib/mogli/address.rb similarity index 91% rename from lib/ogli/address.rb rename to lib/mogli/address.rb index 4182fc7..253db2d 100644 --- a/lib/ogli/address.rb +++ b/lib/mogli/address.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Address < Hashie::Dash include Model diff --git a/lib/ogli/album.rb b/lib/mogli/album.rb similarity index 95% rename from lib/ogli/album.rb rename to lib/mogli/album.rb index 2fe2ec8..4079451 100644 --- a/lib/ogli/album.rb +++ b/lib/mogli/album.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Album < Hashie::Dash include Model diff --git a/lib/ogli/book.rb b/lib/mogli/book.rb similarity index 82% rename from lib/ogli/book.rb rename to lib/mogli/book.rb index a413340..9a7d070 100644 --- a/lib/ogli/book.rb +++ b/lib/mogli/book.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Book < Hashie::Mash include Model diff --git a/lib/ogli/client.rb b/lib/mogli/client.rb similarity index 93% rename from lib/ogli/client.rb rename to lib/mogli/client.rb index 0346046..ddbba96 100644 --- a/lib/ogli/client.rb +++ b/lib/mogli/client.rb @@ -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) @@ -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) @@ -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) diff --git a/lib/ogli/client/user.rb b/lib/mogli/client/user.rb similarity index 63% rename from lib/ogli/client/user.rb rename to lib/mogli/client/user.rb index 651accb..121c85a 100644 --- a/lib/ogli/client/user.rb +++ b/lib/mogli/client/user.rb @@ -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 diff --git a/lib/ogli/comment.rb b/lib/mogli/comment.rb similarity index 93% rename from lib/ogli/comment.rb rename to lib/mogli/comment.rb index fb25bf5..fe3bf32 100644 --- a/lib/ogli/comment.rb +++ b/lib/mogli/comment.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Comment < Hashie::Dash include Model diff --git a/lib/ogli/event.rb b/lib/mogli/event.rb similarity index 97% rename from lib/ogli/event.rb rename to lib/mogli/event.rb index f41c3c0..daac71f 100644 --- a/lib/ogli/event.rb +++ b/lib/mogli/event.rb @@ -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 diff --git a/lib/ogli/fetching_array.rb b/lib/mogli/fetching_array.rb similarity index 97% rename from lib/ogli/fetching_array.rb rename to lib/mogli/fetching_array.rb index b9ec411..8e8b545 100644 --- a/lib/ogli/fetching_array.rb +++ b/lib/mogli/fetching_array.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class FetchingArray < Array attr_accessor :next_url, :previous_url, :client, :classes diff --git a/lib/ogli/group.rb b/lib/mogli/group.rb similarity index 96% rename from lib/ogli/group.rb rename to lib/mogli/group.rb index 737fd7d..06d79d4 100644 --- a/lib/ogli/group.rb +++ b/lib/mogli/group.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Group < Hashie::Dash include Model define_properties :id, :name, :description, :link, :privacy, :updated_time diff --git a/lib/ogli/interest.rb b/lib/mogli/interest.rb similarity index 83% rename from lib/ogli/interest.rb rename to lib/mogli/interest.rb index edc61e7..f4d60b5 100644 --- a/lib/ogli/interest.rb +++ b/lib/mogli/interest.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Interest < Hashie::Mash include Model diff --git a/lib/ogli/model.rb b/lib/mogli/model.rb similarity index 91% rename from lib/ogli/model.rb rename to lib/mogli/model.rb index 61a9157..fc1d416 100644 --- a/lib/ogli/model.rb +++ b/lib/mogli/model.rb @@ -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) @@ -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 diff --git a/lib/ogli/movie.rb b/lib/mogli/movie.rb similarity index 82% rename from lib/ogli/movie.rb rename to lib/mogli/movie.rb index 33efba6..c46db13 100644 --- a/lib/ogli/movie.rb +++ b/lib/mogli/movie.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Movie < Hashie::Mash include Model diff --git a/lib/ogli/music.rb b/lib/mogli/music.rb similarity index 82% rename from lib/ogli/music.rb rename to lib/mogli/music.rb index 46ca094..2a381a4 100644 --- a/lib/ogli/music.rb +++ b/lib/mogli/music.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Music < Hashie::Mash include Model diff --git a/lib/ogli/note.rb b/lib/mogli/note.rb similarity index 95% rename from lib/ogli/note.rb rename to lib/mogli/note.rb index e488212..a48c2ba 100644 --- a/lib/ogli/note.rb +++ b/lib/mogli/note.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Note < Hashie::Dash include Model diff --git a/lib/ogli/page.rb b/lib/mogli/page.rb similarity index 95% rename from lib/ogli/page.rb rename to lib/mogli/page.rb index 3a523e9..9f760d6 100644 --- a/lib/ogli/page.rb +++ b/lib/mogli/page.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Page < Hashie::Dash include Model diff --git a/lib/ogli/photo.rb b/lib/mogli/photo.rb similarity index 94% rename from lib/ogli/photo.rb rename to lib/mogli/photo.rb index 76212bf..5b3ed30 100644 --- a/lib/ogli/photo.rb +++ b/lib/mogli/photo.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Photo < Hashie::Dash include Model define_properties :id, :name, :picture, :source, :height, :width, :link, :icon, diff --git a/lib/ogli/post.rb b/lib/mogli/post.rb similarity index 96% rename from lib/ogli/post.rb rename to lib/mogli/post.rb index acd2d6f..843641b 100644 --- a/lib/ogli/post.rb +++ b/lib/mogli/post.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Post < Hashie::Dash include Model diff --git a/lib/ogli/television.rb b/lib/mogli/television.rb similarity index 83% rename from lib/ogli/television.rb rename to lib/mogli/television.rb index ce05772..8a69709 100644 --- a/lib/ogli/television.rb +++ b/lib/mogli/television.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Television < Hashie::Mash include Model diff --git a/lib/ogli/user.rb b/lib/mogli/user.rb similarity index 97% rename from lib/ogli/user.rb rename to lib/mogli/user.rb index 04783ac..81b76b9 100644 --- a/lib/ogli/user.rb +++ b/lib/mogli/user.rb @@ -1,5 +1,5 @@ -module Ogli +module Mogli class User < Hashie::Mash include Model diff --git a/lib/ogli/video.rb b/lib/mogli/video.rb similarity index 95% rename from lib/ogli/video.rb rename to lib/mogli/video.rb index 740c24b..40d9fc1 100644 --- a/lib/ogli/video.rb +++ b/lib/mogli/video.rb @@ -1,4 +1,4 @@ -module Ogli +module Mogli class Video < Hashie::Dash include Model diff --git a/lib/ogli.rb b/lib/ogli.rb deleted file mode 100644 index 96dbbbb..0000000 --- a/lib/ogli.rb +++ /dev/null @@ -1,25 +0,0 @@ -module Ogli - -end - -require "ogli/model" -require "ogli/fetching_array" -require "ogli/action" -require "ogli/activity" -require "ogli/address" -require "ogli/album" -require "ogli/book" -require "ogli/comment" -require "ogli/event" -require "ogli/group" -require "ogli/interest" -require "ogli/movie" -require "ogli/music" -require "ogli/note" -require "ogli/page" -require "ogli/photo" -require "ogli/post" -require "ogli/television" -require "ogli/video" -require "ogli/user" -require "ogli/client" \ No newline at end of file diff --git a/spec/client/client_user_spec.rb b/spec/client/client_user_spec.rb index d2bbcc6..6237345 100644 --- a/spec/client/client_user_spec.rb +++ b/spec/client/client_user_spec.rb @@ -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 diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 0e9ac69..71b2a74 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -1,29 +1,29 @@ require "spec_helper" -describe Ogli::Client do +describe Mogli::Client do let :client do - Ogli::Client.new + Mogli::Client.new end describe "creation" do it "allows creating with an access_token" do - client = Ogli::Client.new("myaccesstoken") + client = Mogli::Client.new("myaccesstoken") client.access_token.should == "myaccesstoken" end it "sets the access_token into the default params" do - client = Ogli::Client.new("myaccesstoken") + client = Mogli::Client.new("myaccesstoken") client.default_params.should == {:access_token=>"myaccesstoken"} end it "allow creation with no access token" do - client = Ogli::Client.new + client = Mogli::Client.new client.access_token.should be_nil end it "doesn't include the access_token param when not passed" do - client = Ogli::Client.new + client = Mogli::Client.new client.default_params.should == {} end end @@ -48,52 +48,52 @@ it "creates an instance of the class when specified" do - user = client.map_data(user_data,Ogli::User) - user.should be_an_instance_of(Ogli::User) + user = client.map_data(user_data,Mogli::User) + user.should be_an_instance_of(Mogli::User) user.id.should == 12451752 end it "creates an array of instances when the data is an array" do - users = client.map_data([user_data,user_data],Ogli::User) + users = client.map_data([user_data,user_data],Mogli::User) users.should be_an_instance_of(Array) - users.each {|i| i.should be_an_instance_of(Ogli::User) } + users.each {|i| i.should be_an_instance_of(Mogli::User) } users.size.should == 2 end it "creates an array of instances when the data is just a hash with a single data parameter" do - users = client.map_data({"data"=>[user_data,user_data]},Ogli::User) + users = client.map_data({"data"=>[user_data,user_data]},Mogli::User) users.should be_kind_of(Array) - users.each {|i| i.should be_an_instance_of(Ogli::User) } + users.each {|i| i.should be_an_instance_of(Mogli::User) } users.size.should == 2 end it "create an instance of fetching array when there is a data element" do - users = client.map_data({"data"=>[user_data,user_data]},Ogli::User) - users.should be_an_instance_of(Ogli::FetchingArray) + users = client.map_data({"data"=>[user_data,user_data]},Mogli::User) + users.should be_an_instance_of(Mogli::FetchingArray) end it "sets the client on the array" do - users = client.map_data({"data"=>[user_data,user_data]},Ogli::User) + users = client.map_data({"data"=>[user_data,user_data]},Mogli::User) users.client.should == client end it "sets the next url on the array" do - users = client.map_data({"data"=>[user_data,user_data],"paging"=>{"next"=>"next"}},Ogli::User) + users = client.map_data({"data"=>[user_data,user_data],"paging"=>{"next"=>"next"}},Mogli::User) users.next_url.should == "next" end it "sets the previous url on the array" do - users = client.map_data({"data"=>[user_data,user_data],"paging"=>{"previous"=>"prev"}},Ogli::User) + users = client.map_data({"data"=>[user_data,user_data],"paging"=>{"previous"=>"prev"}},Mogli::User) users.previous_url.should == "prev" end it "sets the classes on the array" do - users = client.map_data({"data"=>[user_data,user_data],"paging"=>{"previous"=>"prev"}},Ogli::User) - users.classes.should == [Ogli::User] + users = client.map_data({"data"=>[user_data,user_data],"paging"=>{"previous"=>"prev"}},Mogli::User) + users.classes.should == [Mogli::User] end it "sets the client in the newly created instance" do - user = client.map_data(user_data,Ogli::User) + user = client.map_data(user_data,Mogli::User) user.client.should == client end @@ -113,14 +113,14 @@ end describe "Instance creation" do - it "will find the class in the Ogli namespace if given a string" do - client.create_instance("User",{:id=>1}).should be_an_instance_of(Ogli::User) + it "will find the class in the Mogli namespace if given a string" do + client.create_instance("User",{:id=>1}).should be_an_instance_of(Mogli::User) end it "call the recognize method on each class passing the data and will use the one that recognizes it" do - Ogli::User.should_receive(:recognize?).with(:id=>1).and_return(false) - Ogli::Post.should_receive(:recognize?).with(:id=>1).and_return(true) - client.create_instance(["User","Post"],{:id=>1}).should be_an_instance_of(Ogli::Post) + Mogli::User.should_receive(:recognize?).with(:id=>1).and_return(false) + Mogli::Post.should_receive(:recognize?).with(:id=>1).and_return(true) + client.create_instance(["User","Post"],{:id=>1}).should be_an_instance_of(Mogli::Post) end end end diff --git a/spec/fetching_array_spec.rb b/spec/fetching_array_spec.rb index 8fafe8b..6b6856d 100644 --- a/spec/fetching_array_spec.rb +++ b/spec/fetching_array_spec.rb @@ -1,19 +1,19 @@ require "spec_helper" -describe Ogli::FetchingArray do +describe Mogli::FetchingArray do let :fetching_array do - array = Ogli::FetchingArray.new - array << Ogli::User.new(:id=>4) - array << Ogli::User.new(:id=>5) + array = Mogli::FetchingArray.new + array << Mogli::User.new(:id=>4) + array << Mogli::User.new(:id=>5) array.next_url = "http://next" array.previous_url = "http://previous" array.client = client - array.classes = [Ogli::User] + array.classes = [Mogli::User] array end let :client do - Ogli::Client.new + Mogli::Client.new end it "has a next_url" do @@ -36,18 +36,18 @@ describe "fetching" do before(:each) do - Ogli::Client.stub!(:get).and_return("data"=>[:id=>3],"paging"=>{"previous"=>"http://new_previous","next"=>"http://new_next"}) + Mogli::Client.stub!(:get).and_return("data"=>[:id=>3],"paging"=>{"previous"=>"http://new_previous","next"=>"http://new_next"}) end describe "fetch next" do it "returns an empty array if there is no next_url" do - Ogli::FetchingArray.new.fetch_next.should == [] + Mogli::FetchingArray.new.fetch_next.should == [] end it "adds the contents to this container" do fetching_array.fetch_next - fetching_array.should == [Ogli::User.new(:id=>4),Ogli::User.new(:id=>5),Ogli::User.new(:id=>3)] + fetching_array.should == [Mogli::User.new(:id=>4),Mogli::User.new(:id=>5),Mogli::User.new(:id=>3)] end it "updates the next url with the newly fetched next url" do @@ -62,7 +62,7 @@ end it "returns the new records" do - fetching_array.fetch_next.should == [Ogli::User.new(:id=>3)] + fetching_array.fetch_next.should == [Mogli::User.new(:id=>3)] end end @@ -70,13 +70,13 @@ describe "fetch previous" do it "returns an empty array if there is no previous url" do - Ogli::FetchingArray.new.fetch_previous.should == [] + Mogli::FetchingArray.new.fetch_previous.should == [] end it "adds the contents to this container" do fetching_array.fetch_previous - fetching_array.should == [Ogli::User.new(:id=>3),Ogli::User.new(:id=>4),Ogli::User.new(:id=>5)] + fetching_array.should == [Mogli::User.new(:id=>3),Mogli::User.new(:id=>4),Mogli::User.new(:id=>5)] end it "updates the previous url with the newly fetched previous url" do @@ -90,7 +90,7 @@ end it "returns the new records" do - fetching_array.fetch_previous.should == [Ogli::User.new(:id=>3)] + fetching_array.fetch_previous.should == [Mogli::User.new(:id=>3)] end end diff --git a/spec/post_spec.rb b/spec/post_spec.rb index e6096a9..bcdf383 100644 --- a/spec/post_spec.rb +++ b/spec/post_spec.rb @@ -1,18 +1,18 @@ require "spec_helper" -describe Ogli::Post do +describe Mogli::Post do it "populates from as the user from a hash" do - post = Ogli::Post.new("from"=> {"id" => "12451752", "name" => "Mike Mangino"}) - post.from.should be_an_instance_of(Ogli::User) + post = Mogli::Post.new("from"=> {"id" => "12451752", "name" => "Mike Mangino"}) + post.from.should be_an_instance_of(Mogli::User) post.from.id.should == "12451752" post.from.name.should == "Mike Mangino" end it "populates comments from a hash array" do - post = Ogli::Post.new ({"comments"=>{"data"=>[{"id"=>1,"message"=>"message1"},{"id"=>2}]}},Ogli::Client.new("my_api_key")) + post = Mogli::Post.new ({"comments"=>{"data"=>[{"id"=>1,"message"=>"message1"},{"id"=>2}]}},Mogli::Client.new("my_api_key")) post.comments.size.should == 2 - post.comments.each {|c| c.should be_an_instance_of(Ogli::Comment)} + post.comments.each {|c| c.should be_an_instance_of(Mogli::Comment)} post.comments.first.id.should == 1 post.comments.first.client.access_token.should == "my_api_key" end diff --git a/spec/user_spec.rb b/spec/user_spec.rb index e98f5cb..913d5ab 100644 --- a/spec/user_spec.rb +++ b/spec/user_spec.rb @@ -1,8 +1,8 @@ require "spec_helper" -describe Ogli::User do +describe Mogli::User do let :user_1 do - user_1 = Ogli::User.new(:id=>1) + user_1 = Mogli::User.new(:id=>1) user_1.client = mock_client user_1 end @@ -12,7 +12,7 @@ end it "allow setting the client" do - user = Ogli::User.new + user = Mogli::User.new user.client = "client" user.client.should == "client" end @@ -29,10 +29,10 @@ end it "won't recognize pages" do - Ogli::User.recognize?("id"=>1,"name"=>"bob","category"=>"fdhsjkfsd") + Mogli::User.recognize?("id"=>1,"name"=>"bob","category"=>"fdhsjkfsd") end it "will recognize itself" do - Ogli::User.recognize?("id"=>1,"name"=>"bob") + Mogli::User.recognize?("id"=>1,"name"=>"bob") end end \ No newline at end of file