Skip to content
Browse files

Added the Cameraplus::Comment class.

  • Loading branch information...
1 parent 5cba33d commit a7aabe8a5a5889bab25bdb1e43ac06fd1c1feefc @kevintuhumury kevintuhumury committed Mar 20, 2012
Showing with 48 additions and 0 deletions.
  1. +2 −0 lib/cameraplus.rb
  2. +14 −0 lib/cameraplus/comment.rb
  3. +32 −0 spec/cameraplus/comment_spec.rb
View
2 lib/cameraplus.rb
@@ -3,7 +3,9 @@
require "cameraplus/api/request"
require "cameraplus/api/user"
+
require "cameraplus/user"
require "cameraplus/page"
require "cameraplus/photo"
+require "cameraplus/comment"
require "cameraplus/version"
View
14 lib/cameraplus/comment.rb
@@ -0,0 +1,14 @@
+module Cameraplus
+ class Comment
+
+ attr_reader :author, :avatar, :url, :text
+
+ def initialize(data)
+ @author = data.author
+ @avatar = data.avatar
+ @url = data.url
+ @text = data.text
+ end
+
+ end
+end
View
32 spec/cameraplus/comment_spec.rb
@@ -0,0 +1,32 @@
+require "spec_helper"
+
+describe Cameraplus::Comment do
+
+ let(:data) do
+ {
+ author: "Lisa Bettany",
+ avatar: "https:\/\/fbcdn-profile-a.akamaihd.net\/hprofile-ak-snc4\/261022_674215636_4030749_q.jpg",
+ url: "http:\/\/www.facebook.com\/profile.php?id=674215636",
+ text: "great shot!"
+ }
+ end
+
+ subject { Cameraplus::Comment.new data }
+
+ it "has an author" do
+ subject.author.should eq "Lisa Bettany"
+ end
+
+ it "has an avatar" do
+ subject.avatar.should eq "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/261022_674215636_4030749_q.jpg"
+ end
+
+ it "has an url" do
+ subject.url.should eq "http://www.facebook.com/profile.php?id=674215636"
+ end
+
+ it "has a text" do
+ subject.text.should eq "great shot!"
+ end
+
+end

0 comments on commit a7aabe8

Please sign in to comment.
Something went wrong with that request. Please try again.