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
Relationships.
-
#relationship_has_objects(id) ⇒ Object
Relationship has objects.
-
#update_relationship(id, data) ⇒ Object
Update relationship.
Instance Method Details
#attach_relationship(data) ⇒ Object
Attach relationship.
Attach a relationship.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
30 31 32 33 |
# File 'lib/user/config/relationships.rb', line 30 def attach_relationship(data) # FIXME: Method doesn't work, RelationshipManager cannot access to id attribute. @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)
107 108 109 |
# File 'lib/user/config/relationships.rb', line 107 def create_relationship(data) @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)
138 139 140 |
# File 'lib/user/config/relationships.rb', line 138 def delete_relationship(id) @client.raw('delete', "/config/relationships/#{id}") end |
#detach_relationship(data) ⇒ Object
Detach relationship.
Detach a relationship.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
43 44 45 46 |
# File 'lib/user/config/relationships.rb', line 43 def detach_relationship(data) # FIXME: Method doesn't work, RelationshipManager cannot access to id attribute. @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
= { fields: 'id' }
@data = @mints_user.get_relationship(1, )
89 90 91 |
# File 'lib/user/config/relationships.rb', line 89 def get_relationship(id, = nil) @client.raw('get', "/config/relationships/#{id}", ) 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
= { fields: 'id' }
@data = @mints_user.get_relationships()
72 73 74 |
# File 'lib/user/config/relationships.rb', line 72 def get_relationships( = nil) @client.raw('get', '/config/relationships', ) end |
#get_relationships_available_for(options) ⇒ Object
Relationships
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()
18 19 20 |
# File 'lib/user/config/relationships.rb', line 18 def get_relationships_available_for() @client.raw('get', '/config/relationships/available-for', ) 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)
56 57 58 |
# File 'lib/user/config/relationships.rb', line 56 def relationship_has_objects(id) @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)
126 127 128 |
# File 'lib/user/config/relationships.rb', line 126 def update_relationship(id, data) @client.raw('put', "/config/relationships/#{id}", nil, data_transform(data)) end |