class Fb::Metric

Fb::Metric reprensents a Facebook page's metric. For a list of all available metrics, refer to: @see developers.facebook.com/docs/graph-api/reference/v2.9/insights Provides methods to read name, description, and value.

Attributes

description[R]

@return [String] a description for the metric.

name[R]

@return [String] the name of the metric (e.g. page_fans).

value[R]

@return [Integer] the value of the metric when last requested.

Public Class Methods

new(options = {}) click to toggle source

@param [Hash] options the options to initialize an instance of Fb::Metric. @option [String] :name of the metric. @option [String] :title of the metric. @option [String] :description of the metric. @option [Integer] :value of this metric when last requested.

# File lib/fb/metric.rb, line 24
def initialize(options = {})
  @name = options["name"]
  @description = options["description"]
  @value = options["values"].first["value"]
end

Public Instance Methods

to_s() click to toggle source

@return [String] the representation of the metric.

# File lib/fb/metric.rb, line 31
def to_s
  "#<#{self.class.name} name=#{@name}, description=#{@description}, value=#{@value}>"
end