teachstreet 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/teachstreet.rb +11 -0
- data/lib/teachstreet/version.rb +1 -1
- data/spec/api_key.rb +1 -1
- data/spec/teachstreet_spec.rb +53 -0
- metadata +4 -4
data/lib/teachstreet.rb
CHANGED
@@ -86,6 +86,10 @@ module Teachstreet
|
|
86
86
|
class Deal < Result
|
87
87
|
end
|
88
88
|
|
89
|
+
class TeacherRequest < Result
|
90
|
+
has_one :location
|
91
|
+
end
|
92
|
+
|
89
93
|
class Client
|
90
94
|
include HTTParty
|
91
95
|
|
@@ -135,6 +139,13 @@ module Teachstreet
|
|
135
139
|
Deal.new(process(self.class.get("/deal/#{id}.json", options))["deal"])
|
136
140
|
end
|
137
141
|
|
142
|
+
# find teacher requests
|
143
|
+
def teacher_requests(options={})
|
144
|
+
process(self.class.get("/teacher-requests.json", :query => options)).map do |l|
|
145
|
+
TeacherRequest.new(l)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
138
149
|
private
|
139
150
|
|
140
151
|
def process(result)
|
data/lib/teachstreet/version.rb
CHANGED
data/spec/api_key.rb
CHANGED
data/spec/teachstreet_spec.rb
CHANGED
@@ -127,4 +127,57 @@ describe Teachstreet do
|
|
127
127
|
deal.id.should_not be_nil
|
128
128
|
end
|
129
129
|
|
130
|
+
it "basic teacher request browse" do
|
131
|
+
result = @client.teacher_requests
|
132
|
+
result.should_not be_empty
|
133
|
+
teacher_request = result.first
|
134
|
+
teacher_request.id.should_not be_nil
|
135
|
+
teacher_request.cost.should_not be_nil
|
136
|
+
teacher_request.category_id.should_not be_nil
|
137
|
+
teacher_request.category_name.should_not be_nil
|
138
|
+
teacher_request.subcategory_id.should_not be_nil
|
139
|
+
teacher_request.subcategory_name.should_not be_nil
|
140
|
+
teacher_request.url.should_not be_nil
|
141
|
+
teacher_request.student_name.should_not be_nil
|
142
|
+
teacher_request.description.should_not be_nil
|
143
|
+
teacher_request.local.should_not be_nil
|
144
|
+
teacher_request.online.should_not be_nil
|
145
|
+
teacher_request.location.should_not be_nil
|
146
|
+
location = teacher_request.location
|
147
|
+
location.should be_kind_of Teachstreet::Location
|
148
|
+
location.postal_code.should_not be_nil
|
149
|
+
location.city.should_not be_nil
|
150
|
+
location.state.should_not be_nil
|
151
|
+
location.lat.should_not be_nil
|
152
|
+
location.lng.should_not be_nil
|
153
|
+
end
|
154
|
+
|
155
|
+
it "teacher request browse for online" do
|
156
|
+
result = @client.teacher_requests(:location => 'online')
|
157
|
+
result.should_not be_empty
|
158
|
+
teacher_request = result.first
|
159
|
+
teacher_request.id.should_not be_nil
|
160
|
+
teacher_request.online.should be_true
|
161
|
+
end
|
162
|
+
|
163
|
+
it "teacher request browse for local" do
|
164
|
+
result = @client.teacher_requests(:where => 'Portland, OR', :location => 'local')
|
165
|
+
result.should_not be_empty
|
166
|
+
teacher_request = result.first
|
167
|
+
teacher_request.id.should_not be_nil
|
168
|
+
teacher_request.local.should be_true
|
169
|
+
location = teacher_request.location
|
170
|
+
location.should be_kind_of Teachstreet::Location
|
171
|
+
location.city.should eql("Portland")
|
172
|
+
location.state.should eql("OR")
|
173
|
+
end
|
174
|
+
|
175
|
+
it "teacher request browse by category" do
|
176
|
+
result = @client.teacher_requests(:subcategory_id => 172)
|
177
|
+
result.should_not be_empty
|
178
|
+
teacher_request = result.first
|
179
|
+
teacher_request.id.should_not be_nil
|
180
|
+
teacher_request.subcategory_id.should eql(172)
|
181
|
+
end
|
182
|
+
|
130
183
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teachstreet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Scott Windsor
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-14 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|