Module: Relationships
- Included in:
- Config
- Defined in:
- lib/user/config/relationships.rb
Instance Method Summary collapse
-
#attach_relationship(data) ⇒ Object
Attach relationship.
-
#create_relationship(data) ⇒ Object
Create relationship.
-
#delete_relationship(id) ⇒ Object
Delete relationship.
-
#detach_relationship(data) ⇒ Object
Detach relationship.
-
#get_relationship(id, options = nil) ⇒ Object
Get relationship.
-
#get_relationships(options = nil) ⇒ Object
Get relationships.
-
#get_relationships_available_for(options) ⇒ Object
Get relationships available for.
-
#relationship_has_objects(id) ⇒ Object
Relationship has objects.
-
#update_relationship(id, data) ⇒ Object
Update relationship.
Instance Method Details
permalink #attach_relationship(data) ⇒ Object
Attach relationship.
Attach a relationship.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
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 |
permalink #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)
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 |
permalink #delete_relationship(id) ⇒ Object
Delete relationship.
Delete a relationship.
Parameters
- id
-
(Integer) – Relationship id.
Example
@data = @mints_user.delete_relationship(5)
135 136 137 |
# File 'lib/user/config/relationships.rb', line 135 def delete_relationship(id) return @client.raw("delete", "/config/relationships/#{id}") end |
permalink #detach_relationship(data) ⇒ Object
Detach relationship.
Detach a relationship.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
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 |
permalink #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
= { "fields": "id" }
@data = @mints_user.get_relationship(1, )
86 87 88 |
# File 'lib/user/config/relationships.rb', line 86 def get_relationship(id, = nil) return @client.raw("get", "/config/relationships/#{id}", ) end |
permalink #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
= { "fields": "id" }
@data = @mints_user.get_relationships()
69 70 71 |
# File 'lib/user/config/relationships.rb', line 69 def get_relationships( = nil) return @client.raw("get", "/config/relationships", ) end |
permalink #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
= {
"objectType": "contacts"
}
@data = @mints_user.get_relationships_available_for()
17 18 19 |
# File 'lib/user/config/relationships.rb', line 17 def get_relationships_available_for() return @client.raw("get", "/config/relationships/available-for", ) end |
permalink #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)
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 |
permalink #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)
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 |