class Geotrigger::Application
Application
objects offer top-level, ORM-ish access to various other model objects, as well as updating of application specific settings.
a = Geotrigger::Application.new client_id: 'abcde', client_secret: '12345' #=> <Geotrigger::Application ...> # or s = Geotrigger::Session.new client_id: 'abcde', client_secret: '12345' a = Geotrigger::Application.new session: s #=> <Geotrigger::Application ...>
Public Instance Methods
devices(params = {})
click to toggle source
Return an Array
of Device
model objects that belong to this application.
- params
-
Hash
optional parameters to send with the request
a.devices tags: 'foo' #=> [<Geotrigger::Device ...>, ...] # (devices that have the tag 'foo' on them) a.devices geo: { geojson: { type: "Feature", properties: nil, geometry: { type:"Polygon",coordinates:[[[-122.669085113593,45.4999973537201], ... ,[-122.669085113593,45.4999973537201]]] }}} #=> [<Geotrigger::Device ...>, ...] # (devices whose last location was inside the given polygon)
# File lib/geotrigger/application.rb, line 51 def devices params = {} post_list 'devices', params end
permissions()
click to toggle source
Return this application’s default tag permissions as a Hash
.
a.permissions #=> {"deviceTagging"=>true, "deviceLocation"=>false, ... }
# File lib/geotrigger/application.rb, line 22 def permissions post 'application/permissions' end
permissions=(perms)
click to toggle source
Update this application’s default tag permissions with a Hash
.
a.permissions = { deviceTagging: false } #=> {:deviceTagging => false } a.permissions #=> {"deviceTagging"=>false, "deviceLocation"=>false, ... }
# File lib/geotrigger/application.rb, line 34 def permissions= perms post 'application/permissions/update', perms end
triggers(params = {})
click to toggle source
Return an Array
of Trigger
model objects that belong to this application.
- params
-
Hash
optional parameters to send with the request
a.triggers tags: 'foo' #=> [<Geotrigger::Trigger ...>, ...] # (triggers that have the tag 'foo' on them) a.triggers geo: { geojson: { type: "Feature", properties: nil, geometry: { type:"Polygon",coordinates:[[[-122.669085113593,45.4999973537201], ... ,[-122.669085113593,45.4999973537201]]] }}} #=> [<Geotrigger::Trigger ...>, ...] # (triggers whose condition polygon is inside the given polygon)
# File lib/geotrigger/application.rb, line 80 def triggers params = {} post_list 'triggers', params end