teleportd 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/teleportd.rb +2 -0
- data/lib/teleportd/get.rb +32 -0
- data/lib/teleportd/get_search_result.rb +13 -0
- data/lib/teleportd/version.rb +1 -1
- metadata +15 -38
data/lib/teleportd.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Teleportd
|
2
|
+
class Get
|
3
|
+
|
4
|
+
attr_reader :sha
|
5
|
+
|
6
|
+
# Accepts either a Teleportd::SearchResult or a string representing the sha of a result
|
7
|
+
#
|
8
|
+
# @params [sha_or_search_result]
|
9
|
+
# @return [Teleportd::Get]
|
10
|
+
def initialize sha_or_search_result
|
11
|
+
@sha = handle_sha(sha_or_search_result)
|
12
|
+
@request = Request.new(request_uri)
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
# Returns a Teleportd::GetSearchResult representing the get search
|
17
|
+
#
|
18
|
+
# @return [Teleportd::GetSearchResult]
|
19
|
+
def result
|
20
|
+
@result ||= GetSearchResult.new(@request.parsed_response['hit'])
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def handle_sha sha_or_search_result
|
25
|
+
sha_or_search_result.is_a?(Teleportd::SearchResult) ? sha_or_search_result.sha : sha_or_search_result
|
26
|
+
end
|
27
|
+
|
28
|
+
def request_uri
|
29
|
+
"/get?user_key=#{Config.api_key}&sha=#{sha}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/teleportd/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teleportd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &14633940 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.7.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.7.1
|
24
|
+
version_requirements: *14633940
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: activesupport
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &14633320 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: '0'
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
35
|
+
version_requirements: *14633320
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: i18n
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &14632620 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,15 +43,10 @@ dependencies:
|
|
53
43
|
version: '0'
|
54
44
|
type: :runtime
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
46
|
+
version_requirements: *14632620
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: curb
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &14631980 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ! '>='
|
@@ -69,15 +54,10 @@ dependencies:
|
|
69
54
|
version: '0'
|
70
55
|
type: :runtime
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
57
|
+
version_requirements: *14631980
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: pry
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &14631360 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
62
|
requirements:
|
83
63
|
- - ! '>='
|
@@ -85,12 +65,7 @@ dependencies:
|
|
85
65
|
version: '0'
|
86
66
|
type: :development
|
87
67
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
68
|
+
version_requirements: *14631360
|
94
69
|
description: Ruby Wrapper Library for Teleportd API
|
95
70
|
email:
|
96
71
|
- nicholas.fine@gmail.com
|
@@ -105,6 +80,8 @@ files:
|
|
105
80
|
- Rakefile
|
106
81
|
- lib/teleportd.rb
|
107
82
|
- lib/teleportd/config.rb
|
83
|
+
- lib/teleportd/get.rb
|
84
|
+
- lib/teleportd/get_search_result.rb
|
108
85
|
- lib/teleportd/request.rb
|
109
86
|
- lib/teleportd/search.rb
|
110
87
|
- lib/teleportd/search_result.rb
|
@@ -130,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
107
|
version: '0'
|
131
108
|
requirements: []
|
132
109
|
rubyforge_project:
|
133
|
-
rubygems_version: 1.8.
|
110
|
+
rubygems_version: 1.8.15
|
134
111
|
signing_key:
|
135
112
|
specification_version: 3
|
136
113
|
summary: Ruby Wrapper Library for Teleportd API
|