Class: BeetrackAPI::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



15
16
17
18
# File 'lib/beetrackapi.rb', line 15

def initialize(options = {})
    @key = options[:key]
    @url = 'http://app.beetrack.cl/api/external/v1/'
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



12
13
14
# File 'lib/beetrackapi.rb', line 12

def key
  @key
end

#urlObject (readonly)

Returns the value of attribute url.



13
14
15
# File 'lib/beetrackapi.rb', line 13

def url
  @url
end

Instance Method Details

#createroute(options = {}) ⇒ Object



25
26
27
# File 'lib/beetrackapi.rb', line 25

def createroute(options = {})
    post("routes", options)
end

#getdispatchinfo(dispatch_id) ⇒ Object



29
30
31
# File 'lib/beetrackapi.rb', line 29

def getdispatchinfo(dispatch_id)
    get("dispatches/#{dispatch_id}")
end

#getroutes(options = {}) ⇒ Object



20
21
22
23
# File 'lib/beetrackapi.rb', line 20

def getroutes(options = {})
    date = options.empty? ? "#{Date.today.strftime("%d-%m-%Y")}" : options[:date]
    get('routes', :date => date)
end