Still need to support _links for the time being

This commit is contained in:
rubyist 2015-07-31 17:30:26 -04:00
parent 34cec8502c
commit aecb40dd4a
2 changed files with 9 additions and 3 deletions

@ -43,6 +43,7 @@ type objectResource struct {
Oid string `json:"oid,omitempty"`
Size int64 `json:"size"`
Actions map[string]*linkRelation `json:"actions,omitempty"`
Links map[string]*linkRelation `json:"_links,omitempty"`
Error objectError `json:"error,omitempty"`
}
@ -66,11 +67,16 @@ func (o *objectResource) NewRequest(relation, method string) (*http.Request, Cre
}
func (o *objectResource) Rel(name string) (*linkRelation, bool) {
if o.Actions == nil {
actions := o.Actions
if actions == nil {
actions = o.Links
}
if actions == nil {
return nil, false
}
rel, ok := o.Actions[name]
rel, ok := actions[name]
return rel, ok
}

@ -175,7 +175,7 @@ func (q *TransferQueue) batchApiRoutine() {
}
for _, o := range objects {
if _, ok := o.Actions[q.transferKind]; ok {
if _, ok := o.Rel(q.transferKind); ok {
// This object needs to be transferred
if transfer, ok := q.transferables[o.Oid]; ok {
transfer.SetObject(o)