teleportd 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Ruby Wrapper Library for Teleportd API
4
4
 
5
+ Currently, this wrapper only supports the basic search functionality.
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -18,7 +20,41 @@ Or install it yourself as:
18
20
 
19
21
  ## Usage
20
22
 
21
- TODO: Write usage instructions here
23
+ NOTE: You must set an ENV variable 'TELEPORTD_API_KEY' for your Teleportd API key
24
+
25
+ $ export TELEPORTD_API_KEY=$APIKEY
26
+
27
+ Create an instance of a Teleportd::Search with optional filters. Call
28
+ the result method on the Search instance to receive a Hash of the
29
+ search.
30
+
31
+ Basic Query Without Filters:
32
+
33
+ $ search = Teleportd::Search.new
34
+
35
+ Query With Locations:
36
+
37
+ $ options = {}
38
+ $ options[:location] = {}
39
+ $ options[:location][:latitude] = 34.19
40
+ $ options[:location][:longitude] = -119.49
41
+ $ options[:location][:vertical] = 5.0
42
+ $ options[:location][:horizontal] = 5.0
43
+ $ search = Teleportd::Search.new(options)
44
+
45
+ Query With Textual Search:
46
+
47
+ $ options = {}
48
+ $ options[:textual_search] = 'foo bar baz'
49
+ $ search = Teleportd::Search.new(options)
50
+
51
+ Query With Time Period (start/end)
52
+
53
+ $ options = {}
54
+ $ options[:time_period] = {}
55
+ $ options[:time_period][:start_time] = 5.days.ago
56
+ $ options[:time_period][:end_time] = 2.days.ago
57
+ $ search = Teleportd::Search.new(options)
22
58
 
23
59
  ## Contributing
24
60
 
data/lib/teleportd.rb CHANGED
@@ -5,7 +5,6 @@ require 'teleportd/version'
5
5
  require 'teleportd/config'
6
6
  require 'teleportd/request'
7
7
  require 'teleportd/search'
8
- require 'teleportd/stream'
9
8
 
10
9
  module Teleportd
11
10
  end
@@ -1,7 +1,12 @@
1
- require 'pry'
2
1
  module Teleportd
3
2
  class Search
4
3
 
4
+ class << self
5
+ def potential_available_filters
6
+ [:location, :textual_search, :time_period, :size_filter, :from_filter, :sort_filter]
7
+ end
8
+ end
9
+
5
10
  attr_reader :opts
6
11
 
7
12
  def initialize opts={}
@@ -25,7 +30,7 @@ module Teleportd
25
30
  end
26
31
 
27
32
  def available_filters
28
- [:location, :textual_search, :time_period, :size_filter, :from_filter, :sort_filter].each_with_object([]) do |filter, available|
33
+ Search.potential_available_filters.each_with_object([]) do |filter, available|
29
34
  available << filter unless self.send(filter).nil?
30
35
  end
31
36
  end
@@ -1,3 +1,3 @@
1
1
  module Teleportd
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &15312040 !ruby/object:Gem::Requirement
16
+ requirement: &11881640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.7.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15312040
24
+ version_requirements: *11881640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: active_support
27
- requirement: &15311460 !ruby/object:Gem::Requirement
27
+ requirement: &11881060 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *15311460
35
+ version_requirements: *11881060
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: i18n
38
- requirement: &15310740 !ruby/object:Gem::Requirement
38
+ requirement: &11880340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *15310740
46
+ version_requirements: *11880340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: curb
49
- requirement: &15310120 !ruby/object:Gem::Requirement
49
+ requirement: &11879720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *15310120
57
+ version_requirements: *11879720
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: pry
60
- requirement: &15309460 !ruby/object:Gem::Requirement
60
+ requirement: &11879060 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *15309460
68
+ version_requirements: *11879060
69
69
  description: Ruby Wrapper Library for Teleportd API
70
70
  email:
71
71
  - nicholas.fine@gmail.com