Created
December 9, 2008 20:08
-
-
Save paul/34062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// core.ssbe.localhost/clients/legacy_client | |
{ | |
"_type": "Client", | |
"href": "http://core.ssbe.localhost/clients/legacy_client", | |
"id": "cecbab41-59cb-46fc-89e6-7d49ec60ccbe", | |
"name": "legacy_client", | |
"parent_href": "http://core.ssbe.localhost/clients/API", | |
"hosts_href": "http://core.ssbe.localhost/clients/legacy_client/hosts" | |
} | |
// core.ssbe.localhost/clients/legacy_client/hosts | |
{ | |
"href" : "http://core.ssbe.localhost/clients/legacy_client/hosts", | |
"item_count": 1, | |
"items" : [ | |
{ | |
"_type" : "Host", | |
"id" : "a5ef5493-4780-4874-bd2f-39048bfe11e6", | |
"href" : "http://core.ssbe.localhost/hosts/1", | |
"name" : "legacy_hostname", | |
"client_href" : "http://core.ssbe.localhost/clients/legacy_client" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Client | |
include DataMapper::Resource | |
# ... | |
property :hosts_href, String | |
# ... | |
has n, :hosts | |
end | |
class Host | |
include DataMapper::Resource | |
# ... | |
# property :client_href | |
# ... | |
belongs_to :client | |
end | |
client = Client.get('http://core.ssbe.localhost/clients/legacy_client') | |
client.hosts #=> [<#Host ...>, ...] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment