Class: JustFootball::Acceptance::Adapters::Places
- Inherits:
-
Base
- Object
- Base
- JustFootball::Acceptance::Adapters::Places
show all
- Defined in:
- lib/adapters/place.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#connection
Instance Method Summary
collapse
Methods inherited from Base
#del, #get, #make_json, #make_response, #post, #put
Constructor Details
#initialize ⇒ Places
Returns a new instance of Places.
7
8
9
10
|
# File 'lib/adapters/place.rb', line 7
def initialize
super
@places = []
end
|
Instance Attribute Details
#places ⇒ Object
Returns the value of attribute places.
5
6
7
|
# File 'lib/adapters/place.rb', line 5
def places
@places
end
|
Instance Method Details
#create_fake_places ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/adapters/place.rb', line 12
def create_fake_places
responses = []
2.times do
responses << post('/v1/place', {
longitude: rand,
latitude: rand,
radius: 30,
name: 'test',
status: 'accepted'
})
end
responses
end
|
#create_place(options) ⇒ Object
28
29
30
31
32
|
# File 'lib/adapters/place.rb', line 28
def create_place options
place = post '/v1/place', options
@places << place
place
end
|
#delete_place(id) ⇒ Object
34
35
36
|
# File 'lib/adapters/place.rb', line 34
def delete_place id
del "/v1/place/#{id}"
end
|
#delete_places ⇒ Object
38
39
40
41
42
|
# File 'lib/adapters/place.rb', line 38
def delete_places
@places.each do |place|
delete_place place[:id]
end
end
|