master
1class Restaurant
2 attr_accessor :name, :latitude, :longitude
3
4 def initialize(name, latitude, longitude)
5 @name = name
6 @latitude = latitude
7 @longitude = longitude
8 end
9
10 def save
11 begin
12 BW::HTTP.post("http://localhost:3000/api/v1/restaurants", to_hash ) do |response|
13 begin
14 p response
15 rescue Exception => e
16 p e
17 end
18 end
19 rescue Exception => e
20 p e
21 end
22 end
23
24 def to_hash
25 {
26 payload:
27 {
28 restaurant:
29 {
30 name: @name,
31 latitude: @latitude,
32 longitude: @longitude
33 }
34 }
35 }
36 end
37end