Project

yarel

0.0
No commit activity in last 3 years
No release in over 3 years
Object-relational mapper for Yahoo Query Language - A Object Relation Mapper for YQL in ruby, very similar to ActiveRecord 3.0.0 with chainability and lazy evaluation of queries
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 3.0.0.beta4
>= 3.0.0.beta4
 Project Readme

YAREL

YQL Object Relational Mapper for Ruby

Example

require 'yarel'

Yarel::GeoPlacetypes.all
# Generated YQL: "SELECT * FROM geo.placetype"
# => [{"uri"=>"http://where.yahooapis.com/v1/placetype/0", ..}, ..]

Yarel::GeoPlaces.where(:text => "north beach, san francisco").all
# Generated YQL: "SELECT * FROM geo.places WHERE text = 'north beach, san francisco'"
# => [{"name"=>"North Beach", "woeid"=>"2460640", ... }]


Yarel::GeoPlaces.select("centroid.latitude, centroid.longitude").where(:text => "north beach, san francisco").all
# Generated YQL: "SELECT centroid.latitude, centroid.longitude FROM geo.places WHERE text = 'north beach, san francisco'"
# => [{"centroid"=>{"latitude"=>"37.805939", "longitude"=>"-122.411118"}}]


Yarel::SearchNews.where(:query => "election").limit(10,2).to_yql
# => "SELECT * FROM search.news WHERE query = 'election' LIMIT 2 OFFSET 10"


sub_query = Yarel::GeoPlaces.select("centroid.latitude, centroid.longitude").where(:text => "north beach, san francisco")
Yarel::LocalSearch.where("(latitude,longitude)" => sub_query).where(:radius => 1, :query => 'pizza').sort('AverageRating').to_yql
# => "SELECT * FROM local.search WHERE (latitude,longitude) in ( SELECT centroid.latitude, centroid.longitude FROM geo.places WHERE text = 'north beach, san francisco' ) AND radius = '1' AND query = 'pizza' | sort(field='AverageRating')"

TODO

  1. Insetion / Updation / Deletion