Class: FbGraph::Checkin

Inherits:
Node
  • Object
show all
Extended by:
Searchable
Defined in:
lib/fb_graph/checkin.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Searchable

search

Methods inherited from Node

#connection, #destroy, fetch, #fetch, #update

Methods included from Comparison

#==

Constructor Details

#initialize(identifier, attributes = {}) ⇒ Checkin

Returns a new instance of Checkin.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fb_graph/checkin.rb', line 7

def initialize(identifier, attributes = {})
  super
  if (from = attributes[:from])
    @from = User.new(from[:id], from)
  end
  @tags = []
  if (tags = attributes[:tags])
    case tags
    when Hash
      Collection.new(tags).each do |user|
        @tags << User.new(user[:id], user)
      end
    when String, Array
      Array(tags).each do |user_id|
        @tags << User.new(user_id)
      end
    end
  end
  if (place = attributes[:place])
    @place = case place
    when Place
      place
    when String, Integer
      Place.new(place)
    when Hash
      Place.new(place[:id], place)
    end
  end
  @message = attributes[:message]
  if (application = attributes[:application])
    @application = Application.new(application[:id], application)
  end
  if (created_time = attributes[:created_time])
    @created_time = Time.parse(created_time).utc
  end
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



5
6
7
# File 'lib/fb_graph/checkin.rb', line 5

def application
  @application
end

#created_timeObject

Returns the value of attribute created_time.



5
6
7
# File 'lib/fb_graph/checkin.rb', line 5

def created_time
  @created_time
end

#fromObject

Returns the value of attribute from.



5
6
7
# File 'lib/fb_graph/checkin.rb', line 5

def from
  @from
end

#messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/fb_graph/checkin.rb', line 5

def message
  @message
end

#placeObject

Returns the value of attribute place.



5
6
7
# File 'lib/fb_graph/checkin.rb', line 5

def place
  @place
end

#tagsObject

Returns the value of attribute tags.



5
6
7
# File 'lib/fb_graph/checkin.rb', line 5

def tags
  @tags
end

Class Method Details

.search(options = {}) ⇒ Object



44
45
46
# File 'lib/fb_graph/checkin.rb', line 44

def self.search(options = {})
  super(nil, options)
end