File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
src/placeos-rest-api/controllers Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ module PlaceOS::Api
2525
2626 result.success?.should be_true
2727 zones = Array (Hash (String , JSON ::Any )).from_json(result.body)
28- zone_ids = zones.map { | z | z [" id" ].as_s }
28+ zone_ids = zones.map( & . [" id" ].as_s)
2929 zone_ids.should contain(child1.id)
3030 zone_ids.should contain(child2.id)
3131
@@ -62,7 +62,7 @@ module PlaceOS::Api
6262
6363 result.success?.should be_true
6464 zones = Array (Hash (String , JSON ::Any )).from_json(result.body)
65- zone_ids = zones.map { | z | z [" id" ].as_s }
65+ zone_ids = zones.map( & . [" id" ].as_s)
6666 zone_ids.should contain(child1.id)
6767 zone_ids.should contain(child2.id)
6868 zone_ids.should_not contain(child3.id)
Original file line number Diff line number Diff line change @@ -94,10 +94,10 @@ module PlaceOS::Api
9494 # ##############################################################################################
9595
9696 # list the configured zones
97- @[AC ::Route ::GET (" /" , converters: {tags: ConvertStringArray })]
97+ @[AC ::Route ::GET (" /" , converters: {tags: ConvertStringArray , parent_id: ConvertStringArray })]
9898 def index (
9999 @[AC ::Param ::Info (description: " only return zones who have this zone as a parent (supports comma-separated list)" , example: " zone-1234,zone-5678" )]
100- parent_id : String ? = nil ,
100+ parent_id : Array ( String ) ? = nil ,
101101 @[AC ::Param ::Info (description: " return zones with particular tags" , example: " building,level" )]
102102 tags : Array (String )? = nil ,
103103 ) : Array (::PlaceOS ::Model ::Zone )
@@ -107,7 +107,7 @@ module PlaceOS::Api
107107
108108 # Limit results to the children of these parents (OR logic)
109109 if parent = parent_id
110- parent_ids = parent.split( ',' ). map(& .strip).reject(& .empty?)
110+ parent_ids = parent.map(& .strip).reject(& .empty?)
111111 query.should({
112112 " parent_id" => parent_ids,
113113 })
You can’t perform that action at this time.
0 commit comments