Class: Sistrix::Domain::Social::Overview
- Inherits:
-
Object
- Object
- Sistrix::Domain::Social::Overview
- Includes:
- Base
- Defined in:
- lib/sistrix/domain/social/overview.rb
Instance Attribute Summary collapse
-
#credits ⇒ Object
readonly
Returns the value of attribute credits.
-
#facebook ⇒ Object
readonly
Returns the value of attribute facebook.
-
#googleplus ⇒ Object
readonly
Returns the value of attribute googleplus.
-
#twitter ⇒ Object
readonly
Returns the value of attribute twitter.
Instance Method Summary collapse
- #call(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Overview
constructor
A new instance of Overview.
Methods included from Base
#base_uri, #fetch, #method_name
Constructor Details
#initialize(options = {}) ⇒ Overview
Returns a new instance of Overview.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sistrix/domain/social/overview.rb', line 12 def initialize( = {}) @options = { 'domain' => nil, 'api_key' => Sistrix.config.api_key, }.merge() if Sistrix.config.proxy RestClient.proxy = Sistrix.config.proxy end end |
Instance Attribute Details
#credits ⇒ Object (readonly)
Returns the value of attribute credits.
10 11 12 |
# File 'lib/sistrix/domain/social/overview.rb', line 10 def credits @credits end |
#facebook ⇒ Object (readonly)
Returns the value of attribute facebook.
10 11 12 |
# File 'lib/sistrix/domain/social/overview.rb', line 10 def facebook @facebook end |
#googleplus ⇒ Object (readonly)
Returns the value of attribute googleplus.
10 11 12 |
# File 'lib/sistrix/domain/social/overview.rb', line 10 def googleplus @googleplus end |
#twitter ⇒ Object (readonly)
Returns the value of attribute twitter.
10 11 12 |
# File 'lib/sistrix/domain/social/overview.rb', line 10 def twitter @twitter end |
Instance Method Details
#call(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sistrix/domain/social/overview.rb', line 23 def call( = {}) data = fetch() @credits = data.xpath('//credits').first['used'].to_i @twitter = data.search('/response/answer/votes[@network="twitter"]').first['value'].to_i @facebook = data.search('/response/answer/votes[@network="facebook"]').first['value'].to_i @googleplus = data.search('/response/answer/votes[@network="googleplus"]').first['value'].to_i self end |