Class: Teleportd::Get

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sha_or_search_result) ⇒ Teleportd::Get

Accepts either a Teleportd::SearchResult or a string representing the sha of a result



10
11
12
13
# File 'lib/teleportd/get.rb', line 10

def initialize sha_or_search_result
  @sha = handle_sha(sha_or_search_result)
  @request = Request.new(request_uri)
end

Instance Attribute Details

#shaObject (readonly)

Returns the value of attribute sha.



4
5
6
# File 'lib/teleportd/get.rb', line 4

def sha
  @sha
end

Instance Method Details

#resultTeleportd::GetSearchResult

Returns a Teleportd::GetSearchResult representing the get search



19
20
21
# File 'lib/teleportd/get.rb', line 19

def result
  @result ||= GetSearchResult.new(@request.parsed_response['hit'])
end