Module: Bistip
- Includes:
- HTTParty
- Defined in:
- lib/bistip.rb,
lib/bistip/version.rb
Constant Summary collapse
- API_VERSION =
'/api/v1'- SEARCH_TRIP =
'/trips.json'- SEARCH_SEEK =
'/seeks.json'- DEFAULT_PER_PAGE =
10- DEFAULT_PAGE =
1- VERSION =
"0.0.4"
Class Method Summary collapse
Class Method Details
.seeks(params = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bistip.rb', line 27 def self.seeks(params={}) check_params(params) from = params[:from] if params[:from] to = params[:to] if params[:to] per_page = params[:per_page].nil? ? DEFAULT_PER_PAGE : params[:per_page] page = params[:page].nil? ? DEFAULT_PAGE : params[:page] result = get("#{API_VERSION+SEARCH_SEEK}?from=#{from}&to=#{to}&page=#{page}&per_page=#{per_page}") result = result.first.include?("exception") ? Array.new : result return result end |
.trips(params = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bistip.rb', line 15 def self.trips(params={}) check_params(params) from = params[:from] if params[:from] to = params[:to] if params[:to] per_page = params[:per_page].nil? ? DEFAULT_PER_PAGE : params[:per_page] page = params[:page].nil? ? DEFAULT_PAGE : params[:page] result = get("#{API_VERSION+SEARCH_TRIP}?from=#{from}&to=#{to}&page=#{page}&per_page=#{per_page}") result = result.first.include?("exception") ? Array.new : result return result end |