module Planefinder

Constants

VERSION

Public Class Methods

get_categories() click to toggle source
# File lib/planefinder.rb, line 26
def self.get_categories
  response = self.get(@@urls[:airplane_categories])
  categories = []
  JSON.parse(response.body).each do |cat|
    next if(cat.has_key?('special_use_counts'))
    categories << AirplaneCategory.new(cat)
  end
  categories
end
get_makes(category)
get_makes_for_category(category) click to toggle source
# File lib/planefinder.rb, line 36
def self.get_makes_for_category(category)
  response = self.get(@@urls[:airplane_makes_for_category] % category.id)
  makes = []
  JSON.parse(response.body).each do |make|
    makes << AirplaneMake.new(make, category)
  end
  makes
end
Also aliased as: get_makes
get_models(category, make)
get_models_for_category_and_make(category, make) click to toggle source
# File lib/planefinder.rb, line 45
def self.get_models_for_category_and_make(category, make)
  response = self.get(@@urls[:airplane_models_for_category_and_make] % [category.id, make.id])
  models = []
  JSON.parse(response.body).each do |model|
    models << AirplaneModel.new(model, category, make)
  end
  models
end
Also aliased as: get_models
search_by_model_make_category(model, make, cat) click to toggle source
# File lib/planefinder.rb, line 54
def self.search_by_model_make_category(model, make, cat)
  response = self.get(@@urls[:search_by_model_make_category] % [model, make, cat].map { |s| URI.escape(s.name) })
  listings = []
  JSON.parse(response.body).each do |listing|
    listings << AirplaneListing.new(listing)
  end
  listings
end
valid_args?(*args) click to toggle source
# File lib/planefinder.rb, line 22
def self.valid_args?(*args)
  args.all? { |a| a.to_i > 0 }
end