Class: Dopplr::Trip
- Inherits:
-
Object
- Object
- Dopplr::Trip
- Defined in:
- lib/dopplr/trip.rb
Instance Attribute Summary collapse
-
#city(options = {}) ⇒ Object
readonly
Returns the value of attribute city.
-
#finish ⇒ Object
readonly
Returns the value of attribute finish.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#outgoing_transport ⇒ Object
readonly
Returns the value of attribute outgoing_transport.
-
#return_transport ⇒ Object
readonly
Returns the value of attribute return_transport.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#trip_id ⇒ Object
readonly
Returns the value of attribute trip_id.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #add_note(note) ⇒ Object
- #add_tags(*tags) ⇒ Object
- #delete ⇒ Object
-
#initialize(client, id) ⇒ Trip
constructor
A new instance of Trip.
- #populate ⇒ Object
Constructor Details
#initialize(client, id) ⇒ Trip
Returns a new instance of Trip.
6 7 8 9 10 |
# File 'lib/dopplr/trip.rb', line 6 def initialize(client, id) @client = client @trip_id = id populate end |
Instance Attribute Details
#city(options = {}) ⇒ Object (readonly)
Returns the value of attribute city.
3 4 5 |
# File 'lib/dopplr/trip.rb', line 3 def city @city end |
#finish ⇒ Object (readonly)
Returns the value of attribute finish.
3 4 5 |
# File 'lib/dopplr/trip.rb', line 3 def finish @finish end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
3 4 5 |
# File 'lib/dopplr/trip.rb', line 3 def notes @notes end |
#outgoing_transport ⇒ Object (readonly)
Returns the value of attribute outgoing_transport.
3 4 5 |
# File 'lib/dopplr/trip.rb', line 3 def outgoing_transport @outgoing_transport end |
#return_transport ⇒ Object (readonly)
Returns the value of attribute return_transport.
3 4 5 |
# File 'lib/dopplr/trip.rb', line 3 def return_transport @return_transport end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
3 4 5 |
# File 'lib/dopplr/trip.rb', line 3 def start @start end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
3 4 5 |
# File 'lib/dopplr/trip.rb', line 3 def end |
#trip_id ⇒ Object (readonly)
Returns the value of attribute trip_id.
4 5 6 |
# File 'lib/dopplr/trip.rb', line 4 def trip_id @trip_id end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/dopplr/trip.rb', line 4 def url @url end |
Instance Method Details
#add_note(note) ⇒ Object
36 37 38 39 |
# File 'lib/dopplr/trip.rb', line 36 def add_note(note) info = @client.post 'add_trip_note', :trip_id => @trip_id, :body => note @notes = info['trip']['note'] end |
#add_tags(*tags) ⇒ Object
31 32 33 34 |
# File 'lib/dopplr/trip.rb', line 31 def (*) info = @client.post 'add_trip_tags', :trip_id => @trip_id, :tags => .join('+') = info['trip']['tag'] end |
#delete ⇒ Object
41 42 43 |
# File 'lib/dopplr/trip.rb', line 41 def delete @client.post 'delete_trip', :trip_id => @trip_id end |
#populate ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dopplr/trip.rb', line 12 def populate info = @client.get('trip_info', :trip_id => @trip_id)['trip'] @outgoing_transport = info['outgoing_transport_type'] @return_transport = info['return_transport_type'] = info['tag'] @notes = info['note'] @url = info['url'] @start = Time.parse info['start'] @finish = Time.parse info['finish'] end |