Class: Nom::API
- Inherits:
-
Object
- Object
- Nom::API
- Defined in:
- lib/nom-ruby/api.rb
Instance Method Summary collapse
- #here(lat, lng, options = {}) ⇒ Object
- #location_search(query, options = {}) ⇒ Object
-
#login(password, options = {}) ⇒ Object
Any item out of email, user_nid, screen_name will work.
- #register(email, password, options = {}) ⇒ Object
- #user_search(query, options = {}) ⇒ Object
Instance Method Details
#here(lat, lng, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/nom-ruby/api.rb', line 4 def here(lat, lng, = {}) start, limit = Nom::Util.page() Nom::API.handle.get('/locations/here', { :lat => lat, :lng => lng, :dist => ([:dist] || 0.5), :start => start, :limit => limit }) end |
#location_search(query, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nom-ruby/api.rb', line 15 def location_search(query, = {}) start, limit = Nom::Util.page() params = { :query => query } params.merge!({ :lat => [:lat], :lng => [:lng] }) if([:lat].present? && [:lng].present?) params.merge!({ :location => [:location] }) if [:location].present? Nom::API.handle.get('/locations/search', params) end |
#login(password, options = {}) ⇒ Object
Any item out of email, user_nid, screen_name will work
42 43 44 45 46 47 48 49 |
# File 'lib/nom-ruby/api.rb', line 42 def login(password, ={}) Nom::API.handle.post('/users/login', { :password => password, :email => [:email], :user_nid => [:user_nid], :screen_name => [:screen_name] }) end |
#register(email, password, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/nom-ruby/api.rb', line 31 def register(email, password, ={}) Nom::API.handle.post('/users/register', { :email => email, :password => password, :screen_name => [:screen_name], :name => [:name], :city => [:city] }) end |
#user_search(query, options = {}) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/nom-ruby/api.rb', line 51 def user_search(query, = {}) start, limit = Nom::Util.page() Nom::API.handle.get('/users/search', { :query => query, # If the input value is of unknown origin :screen_name => [:screen_name], :email => [:email] }) end |