Reputation: 471
I get a response in JSON and need to make sure that i get only one 'signal' in signal_events. I'm using Ruby with rspec.
"signal_events": [
{
"id": "587e9ae969702d10bd5a0000",
"created_at": 1484692201,
"geo": {
"type": "Point",
"coordinates": [
-153.45703125,
59.67773438
]
},
"expires_at": 1484778601,
"geohashes": [
"bddg",
"bdeh"
],
"signal": {
"id": "587e9ae969702d0911060000",
"created_at": 1484692201.24,
"expires_at": 1484778601.24,
"signal_at": 1484691607,
"source": "usgs",
"updated_at": 1484692144,
"magnitude": 2,
"radius": 6.36107901750268,
"event_name": "earthquake",
"tsunami": "no"
},
"signal_type": "earthquake",
"centroid": {
"type": "Point",
"coordinates": [
-153.45703125,
59.67773438
]
},
"location": {
"country": "United States",
"country_code": "US",
"city": "Kenai Peninsula Borough",
"region": "Kenai Peninsula Borough",
"region_code": "AK"
}
},
Upvotes: 1
Views: 91
Reputation: 52377
Hash can not contain duplicated keys, so you will always have one value for any given key.
Upvotes: 6