Skip to content

Instantly share code, notes, and snippets.

@joshco
Last active June 12, 2017 23:02
Show Gist options
  • Save joshco/973fa098cad788488fd35c8bcfe58f2a to your computer and use it in GitHub Desktop.
Save joshco/973fa098cad788488fd35c8bcfe58f2a to your computer and use it in GitHub Desktop.
Get record attendance helper
{
"identifiers": [
"osdi_sample_system:d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3",
"foreign_system:1"
],
"origin_system": "OSDI Sample System",
"created_date": "2014-03-20T21:04:31Z",
"modified_date": "2014-03-20T21:04:31Z",
"name": "March 14th Rally",
"title": "Rally for Justice",
"description": "<p>Join us in the park to rally for justice!</p>",
"summary": "Join us in the park to rally for justice!",
"instructions": "<p>Bring a friend and a sign.</p>",
"browser_url": "http://osdi-sample-system.org/events/rally-for-justice",
"type": "open",
"featured_image_url": "http://osdi-sample-system.org/images/rally-for-justice-banner.jpg",
"total_accepted": 14,
"status": "confirmed",
"start_date": "2015-03-14T12:00:00Z",
"end_date": "2015-03-14T14:00:00Z",
"all_day": false,
"guests_can_invite_others": true,
"transparence": "opaque",
"visibility": "public",
"location": {
"venue": "Lafayette Square",
"address_lines": [
"1564 H St NW"
],
"locality": "Washington",
"region": "DC",
"postal_code": "20001",
"country": "US",
"language": "EN",
"location": {
"latitude": 38.9002101,
"longitude": -77.0359252,
"accuracy": "Rooftop"
}
},
"reminders": [
{
"method": "email",
"minutes": 1440
},
{
"method": "sms",
"minutes": 60
}
],
"share_url": "http://osdi-sample-system.org/events/my-event/",
"total_shares": 345,
"share_options": [
{
"facebook_share": {
"title": "Debate watch party!",
"description": "Come and watch the debate.",
"image": "http://odsi-sample-system.org/images/event-share-image.jpg",
"total_shares": 100
},
"twitter_share": {
"message": "Watch the debate with @OSDI! Click here: http://osdi-sample-system.org/events/my-event/",
"total_shares": 100
},
"email_share": {
"subject": "Come watch the debate!",
"body": "Can you watch the debate with us? Click here: http://osdi-sample-system.org/events/my-event/",
"total_shares": 145
}
}
],
"_links": {
"self": {
"href": "https://osdi-sample-system.org/api/v1/events/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3"
},
"osdi:attendances": {
"href": "https://osdi-sample-system.org/api/v1/events/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3/attendances"
},
"osdi:creator": {
"href": "https://osdi-sample-system.org/api/v1/people/65345d7d-cd24-466a-a698-4a7686ef684f"
},
"osdi:organizer": {
"href": "https://osdi-sample-system.org/api/v1/people/8a625981-67a4-4457-8b55-2e30b267b2c2"
},
"osdi:modified_by": {
"href": "https://osdi-sample-system.org/api/v1/people/c945d6fe-929e-11e3-a2e9-12313d316c29"
},
"osdi:record_attendance_helper": {
"href": "https://osdi-sample-system.org/api/v1/events/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3/record_attendance_helper"
}
}
}
require 'json'
# finding the record attendance helper for an event
# it is assumed that you retreive a collection of OSDI events.
# sample event JSON from the OSDI spec
# http://opensupporter.github.io/osdi-docs/events.html#scenario-scenario-retrieving-an-individual-event-resource-get
event=JSON.parse(File.read('event.json'))
# find the links collection
links=event['_links']
# find the record link
record_link=links['osdi:record_attendance_helper']
# find the actual URL of the link
record_url=record_link['href']
# display link you should POST to
# https://osdi-sample-system.org/api/v1/events/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3/record_attendance_helper
puts record_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment