Class: Dopplr::Trip

Inherits:
Object
  • Object
show all
Defined in:
lib/dopplr/trip.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#finishObject (readonly)

Returns the value of attribute finish.



3
4
5
# File 'lib/dopplr/trip.rb', line 3

def finish
  @finish
end

#notesObject (readonly)

Returns the value of attribute notes.



3
4
5
# File 'lib/dopplr/trip.rb', line 3

def notes
  @notes
end

#outgoing_transportObject (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_transportObject (readonly)

Returns the value of attribute return_transport.



3
4
5
# File 'lib/dopplr/trip.rb', line 3

def return_transport
  @return_transport
end

#startObject (readonly)

Returns the value of attribute start.



3
4
5
# File 'lib/dopplr/trip.rb', line 3

def start
  @start
end

#tagsObject (readonly)

Returns the value of attribute tags.



3
4
5
# File 'lib/dopplr/trip.rb', line 3

def tags
  @tags
end

#trip_idObject (readonly)

Returns the value of attribute trip_id.



4
5
6
# File 'lib/dopplr/trip.rb', line 4

def trip_id
  @trip_id
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/dopplr/trip.rb', line 4

def url
  @url
end

Instance Method Details

#populateObject



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']
  @tags               = info['tag']
  @notes              = info['note']
  @url                = info['url']
  @start              = Time.parse info['start']
  @finish             = Time.parse info['finish']
end