Skip to content

Links following curies href #28

Description

@alekseydreval

Hi.
I'm trying to use hyperresource to consume the following API from server:

{
  "_links" : {
    "curies" : [ {
      "href" : "http://example.com/docs/{rel}",
      "name" : "common",
      "templated" : true
    } ],
    "self" : {
      "href" : "http://example.com"
    },
    "common:version" : [ {
      "href" : "/version/{name}",
      "templated" : true
    } ]
}

The problem is the following

When I do api.get.version[0].url it returns http://example.com/version based on self.href link, which is not what I expected. Since version link belongs to common cury, I expected url property to look like http://example.com/docs/version/{some_name_parametr}

I see it uses resource.root which is passed in Hyperresource constructor.
https://github.com/gamache/hyperresource/blob/master/lib/hyper_resource/link.rb#L73

Probably the case to consider.
Regards.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions