Class: Teleportd::SearchResult

Inherits:
Object
  • Object
show all
Defined in:
lib/teleportd/search_result.rb

Overview

Represents an individual image returned from a Search call

Direct Known Subclasses

GetSearchResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result_hash = {}) ⇒ Teleportd::SearchResult

Accepts a hash from a Teleportd::Search and returns an instance of Teleportd::SearchResult

Examples:

Teleportd::SearchResult.new(result_hash)
> #<Teleportd::SearchResult...>

Parameters:

  • (Hash)


16
17
18
# File 'lib/teleportd/search_result.rb', line 16

def initialize result_hash={}
  @result_hash = result_hash
end

Instance Attribute Details

#result_hashObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
# File 'lib/teleportd/search_result.rb', line 6

def result_hash
  @result_hash
end

Instance Method Details

#dateFixnum

Returns the result’s time as seconds from the epoch

Returns:

  • (Fixnum)


44
45
46
# File 'lib/teleportd/search_result.rb', line 44

def date
  result_hash['dte']
end

#full_resolution_urlString

Returns the full resolution image url for the result

Returns:

  • (String)


65
66
67
# File 'lib/teleportd/search_result.rb', line 65

def full_resolution_url
  result_hash['fll']
end

#hashtagsArray

Returns the hashtags of the search result in an Array NOTE: Will return nil unless you have an enterprise account

Returns:

  • (Array)


97
98
99
# File 'lib/teleportd/search_result.rb', line 97

def hashtags
  result_hash['hashtag']
end

#locationHash

Returns a Hash with the results latitude and longitude values

Returns:

  • (Hash)


23
24
25
# File 'lib/teleportd/search_result.rb', line 23

def location
  result_hash['loc']
end

#mentionsArray

Returns the mentions of the search result in an Array NOTE: Will return nil unless you have an enterprise account

Returns:

  • (Array)


105
106
107
# File 'lib/teleportd/search_result.rb', line 105

def mentions
  result_hash['mention']
end

#profile_pic_urlString

Returns the user’s profile pic url from the respective service account NOTE: Will return nil unless you have an enterprise account

Returns:

  • (String)


81
82
83
# File 'lib/teleportd/search_result.rb', line 81

def profile_pic_url
  result_hash['pic']
end

#shaString

Returns a String representing the search result SHA hash

Returns:

  • (String)


37
38
39
# File 'lib/teleportd/search_result.rb', line 37

def sha
  result_hash['sha']
end

#sourceString

Returns the source of the result (“twimg”, “instagram”, etc.)

Returns:

  • (String)


51
52
53
# File 'lib/teleportd/search_result.rb', line 51

def source
  result_hash['src']
end

#textArray

Returns the comments or title of the search result in an Array NOTE: Will return nil unless you have an enterprise account

Returns:

  • (Array)


89
90
91
# File 'lib/teleportd/search_result.rb', line 89

def text
  result_hash['text']
end

#thumbnail_urlString

Returns the thumbnail image url for the result

Returns:

  • (String)


58
59
60
# File 'lib/teleportd/search_result.rb', line 58

def thumbnail_url
  result_hash['thb']
end

#typeString

Returns a String representing the search result type (usually “image”)

Returns:

  • (String)


30
31
32
# File 'lib/teleportd/search_result.rb', line 30

def type
  result_hash['typ']
end

#usersArray

Returns the author handles identified from the result NOTE: Will return nil unless you have an enterprise account

Returns:

  • (Array)


73
74
75
# File 'lib/teleportd/search_result.rb', line 73

def users
  result_hash['usr']
end