Class: MetaGraph::Collection

Inherits:
Array
  • Object
show all
Includes:
GraphAccessor
Defined in:
lib/meta_graph/collection.rb

Overview

Collection class presents an array data in Facebook Graph API.

Instance Method Summary collapse

Methods included from GraphAccessor

#read_graph

Constructor Details

#initialize(access_token, collection) ⇒ Collection

Create Collection instance from an array.

Arguments

access_token

access token to read a data from Graph API. Please set to oauth’s access_token.

collection

An array of collection data.



16
17
18
19
20
21
# File 'lib/meta_graph/collection.rb', line 16

def initialize(access_token, collection)
  @access_token = access_token
  @collection = collection

  replace @collection
end

Instance Method Details

#[](index) ⇒ Object



23
24
25
# File 'lib/meta_graph/collection.rb', line 23

def [](index)
  read_graph(@access_token, @collection[index])
end