| @@ -9,9 +9,10 @@ class PostsController < ApplicationController | |||||
| # :params => params, | # :params => params, | ||||
| # :pois_returned => @posts.size | # :pois_returned => @posts.size | ||||
| # ) | # ) | ||||
| @layer = Layer.find(params[:layer_id]) | |||||
| layar_response = { | layar_response = { | ||||
| :layer => 'hyparlocal', | |||||
| :layer => @layer.layar_name, | |||||
| :hotspots => @posts.collect { |p| post_to_poi(p) }, | :hotspots => @posts.collect { |p| post_to_poi(p) }, | ||||
| :errorCode => 0, # OK | :errorCode => 0, # OK | ||||
| :errorString => "OK", | :errorString => "OK", | ||||
| @@ -1,4 +1,9 @@ | |||||
| class Layer < ActiveRecord::Base | class Layer < ActiveRecord::Base | ||||
| attr_accessible :name | attr_accessible :name | ||||
| has_and_belongs_to_many :feeds | has_and_belongs_to_many :feeds | ||||
| # Unique name for Layar layer | |||||
| def layar_name | |||||
| "apollo" + self.name.strip.downcase.gsub(/[^a-z0-9]/, '') | |||||
| end | |||||
| end | end | ||||
| @@ -5,7 +5,9 @@ | |||||
| %p | %p | ||||
| API URL: | API URL: | ||||
| = "#{request.protocol}#{request.host_with_port}/posts/near.layar?layer_id=#{@layer.id}" | = "#{request.protocol}#{request.host_with_port}/posts/near.layar?layer_id=#{@layer.id}" | ||||
| %br | |||||
| Layar layer name: | |||||
| = @layer.layar_name | |||||
| %h2 Feeds | %h2 Feeds | ||||