Module: Relationships

Included in:
Config
Defined in:
lib/user/config/relationships.rb

Instance Method Summary collapse

Instance Method Details

#attach_relationship(data) ⇒ Object

Attach relationship.

Attach a relationship.

Parameters

data

(Hash) – Data to be submitted.

Example

[View source]

29
30
31
# File 'lib/user/config/relationships.rb', line 29

def attach_relationship(data) #FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.
    return @client.raw("post", "/config/relationships/attach", nil, data_transform(data))
end

#create_relationship(data) ⇒ Object

Create relationship.

Create a relationship with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  "alias_1": "eventsCopy",
  "alias_2": "ticketsCopy",
  "object_model_1": "Story",
  "object_model_2": "Product"
}
@data = @mints_user.create_relationship(data)
[View source]

104
105
106
# File 'lib/user/config/relationships.rb', line 104

def create_relationship(data)
    return @client.raw("post", "/config/relationships", nil, data_transform(data))
end

#delete_relationship(id) ⇒ Object

Delete relationship.

Delete a relationship.

Parameters

id

(Integer) – Relationship id.

Example

@data = @mints_user.delete_relationship(5)
[View source]

135
136
137
# File 'lib/user/config/relationships.rb', line 135

def delete_relationship(id)
    return @client.raw("delete", "/config/relationships/#{id}")
end

#detach_relationship(data) ⇒ Object

Detach relationship.

Detach a relationship.

Parameters

data

(Hash) – Data to be submitted.

Example

[View source]

41
42
43
# File 'lib/user/config/relationships.rb', line 41

def detach_relationship(data) #FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.
    return @client.raw("post", "/config/relationships/detach", nil, data_transform(data))
end

#get_relationship(id, options = nil) ⇒ Object

Get relationship.

Get a relationship info.

Parameters

id

(Integer) – Relationship id.

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_relationship(1)

Second Example

options = { "fields": "id" }
@data = @mints_user.get_relationship(1, options)
[View source]

86
87
88
# File 'lib/user/config/relationships.rb', line 86

def get_relationship(id, options = nil)
    return @client.raw("get", "/config/relationships/#{id}", options)
end

#get_relationships(options = nil) ⇒ Object

Get relationships.

Get a collection of relationships.

Parameters

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_relationships

Second Example

options = { "fields": "id" }
@data = @mints_user.get_relationships(options)
[View source]

69
70
71
# File 'lib/user/config/relationships.rb', line 69

def get_relationships(options = nil)
    return @client.raw("get", "/config/relationships", options)
end

#get_relationships_available_for(options) ⇒ Object

Get relationships available for.

Get relationships available.

Parameters

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

Example

options = {
  "objectType": "contacts"
}
@data = @mints_user.get_relationships_available_for(options)
[View source]

17
18
19
# File 'lib/user/config/relationships.rb', line 17

def get_relationships_available_for(options)
    return @client.raw("get", "/config/relationships/available-for", options)
end

#relationship_has_objects(id) ⇒ Object

Relationship has objects.

Get relationships that has objects.

Parameters

id

(Integer) – Relationship id.

Example

@data = @mints_user.relationship_has_objects(1)
[View source]

53
54
55
# File 'lib/user/config/relationships.rb', line 53

def relationship_has_objects(id)
    return @client.raw("get", "/config/relationships/#{id}/hasObjects")
end

#update_relationship(id, data) ⇒ Object

Update relationship.

Update a relationship info.

Parameters

id

(Integer) – Relationship id.

data

(Hash) – Data to be submitted.

Example

data = {
  "alias_1": "eventsCopyModified",
  "alias_2": "ticketsCopyModified",
  "object_model_1": "Story",
  "object_model_2": "Product"
}
@data = @mints_user.update_relationship(5, data)
[View source]

123
124
125
# File 'lib/user/config/relationships.rb', line 123

def update_relationship(id, data)
    return @client.raw("put", "/config/relationships/#{id}", nil, data_transform(data))
end