Class: Sharedcount::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/sharedcount/data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_data) ⇒ Data

Returns a new instance of Data.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sharedcount/data.rb', line 10

def initialize(json_data)

	self.json_data = json_data
    self.raw_data = JSON.parse(json_data)

	self.stumble_upon_shares = (self.raw_data["StumbleUpon"] || nil)
	self.reddit_shares = (self.raw_data["Reddit"] || nil)
	self.delicious_shares = (self.raw_data["Delicious"] || nil)
	self.google_plus_one = (self.raw_data["GooglePlusOne"] || nil)
	self.google_buzzs = (self.raw_data["Buzz"] || nil)
	self.twitter_shares = (self.raw_data["Twitter"] || nil)
	self.digg_shares = (self.raw_data["Diggs"] || nil)
	self.pinterest_shares = (self.raw_data["Pinterest"] || nil)
	self.linkedin_shares = (self.raw_data["LinkedIn"] || nil)
	self.facebook_commentsbox = (self.raw_data["Facebook"]["commentsbox_count"] || nil)
	self.facebook_clicks = (self.raw_data["Facebook"]["click_count"] || nil)
	self.facebook_total = (self.raw_data["Facebook"]["total_count"] || nil)
	self.facebook_comments = (self.raw_data["Facebook"]["comment_count"] || nil)
	self.facebook_likes = (self.raw_data["Facebook"]["like_count"] || nil)
	self.facebook_shares = (self.raw_data["Facebook"]["share_count"] || nil)

	self.total_actions = self.stumble_upon_shares + self.reddit_shares + self.delicious_shares + self.google_plus_one + self.google_buzzs + self.twitter_shares + self.digg_shares + self.pinterest_shares + self.linkedin_shares + self.facebook_total

end

Instance Attribute Details

#delicious_sharesObject

Returns the value of attribute delicious_shares.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def delicious_shares
  @delicious_shares
end

#digg_sharesObject

Returns the value of attribute digg_shares.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def digg_shares
  @digg_shares
end

#facebook_clicksObject

Returns the value of attribute facebook_clicks.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def facebook_clicks
  @facebook_clicks
end

#facebook_commentsObject

Returns the value of attribute facebook_comments.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def facebook_comments
  @facebook_comments
end

#facebook_commentsboxObject

Returns the value of attribute facebook_commentsbox.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def facebook_commentsbox
  @facebook_commentsbox
end

#facebook_likesObject

Returns the value of attribute facebook_likes.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def facebook_likes
  @facebook_likes
end

#facebook_sharesObject

Returns the value of attribute facebook_shares.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def facebook_shares
  @facebook_shares
end

#facebook_totalObject

Returns the value of attribute facebook_total.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def facebook_total
  @facebook_total
end

#google_buzzsObject

Returns the value of attribute google_buzzs.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def google_buzzs
  @google_buzzs
end

#google_plus_oneObject

Returns the value of attribute google_plus_one.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def google_plus_one
  @google_plus_one
end

#json_dataObject

Returns the value of attribute json_data.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def json_data
  @json_data
end

#linkedin_sharesObject

Returns the value of attribute linkedin_shares.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def linkedin_shares
  @linkedin_shares
end

#pinterest_sharesObject

Returns the value of attribute pinterest_shares.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def pinterest_shares
  @pinterest_shares
end

#raw_dataObject

Returns the value of attribute raw_data.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def raw_data
  @raw_data
end

#reddit_sharesObject

Returns the value of attribute reddit_shares.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def reddit_shares
  @reddit_shares
end

#stumble_upon_sharesObject

Returns the value of attribute stumble_upon_shares.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def stumble_upon_shares
  @stumble_upon_shares
end

#total_actionsObject

Returns the value of attribute total_actions.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def total_actions
  @total_actions
end

#twitter_sharesObject

Returns the value of attribute twitter_shares.



4
5
6
# File 'lib/sharedcount/data.rb', line 4

def twitter_shares
  @twitter_shares
end