Class: BeetrackAPI::Client
- Inherits:
-
Object
- Object
- BeetrackAPI::Client
- Defined in:
- lib/beetrackapi.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #createroute(options = {}) ⇒ Object
- #getdispatchinfo(dispatch_id) ⇒ Object
- #getroutes(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
15 16 17 18 |
# File 'lib/beetrackapi.rb', line 15 def initialize( = {}) @key = [:key] @url = 'http://app.beetrack.cl/api/external/v1/' end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
12 13 14 |
# File 'lib/beetrackapi.rb', line 12 def key @key end |
#url ⇒ Object (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( = {}) post("routes", ) 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( = {}) date = .empty? ? "#{Date.today.strftime("%d-%m-%Y")}" : [:date] get('routes', :date => date) end |