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.
-
#update_relationship(id, data) ⇒ Object
Update relationship.
-
#update_relationship_pivot_fields(data) ⇒ Object
Update relationship pivot fields.
Instance Method Details
#attach_relationship(data) ⇒ Object
Attach relationship.
Attach a relationship.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
12 13 14 |
# File 'lib/user/config/relationships.rb', line 12 def attach_relationship(data) @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 = @cxf_user.create_relationship(data)
76 77 78 |
# File 'lib/user/config/relationships.rb', line 76 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 = @cxf_user.delete_relationship(5)
107 108 109 |
# File 'lib/user/config/relationships.rb', line 107 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
24 25 26 |
# File 'lib/user/config/relationships.rb', line 24 def detach_relationship(data) @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 = @cxf_user.get_relationship(1)
Second Example
= { fields: 'id' }
@data = @cxf_user.get_relationship(1, )
58 59 60 |
# File 'lib/user/config/relationships.rb', line 58 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 = @cxf_user.get_relationships
Second Example
= { fields: 'id' }
@data = @cxf_user.get_relationships()
41 42 43 |
# File 'lib/user/config/relationships.rb', line 41 def get_relationships( = nil) @client.raw('get', '/config/relationships', ) 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 = @cxf_user.update_relationship(5, data)
95 96 97 |
# File 'lib/user/config/relationships.rb', line 95 def update_relationship(id, data) @client.raw('put', "/config/relationships/#{id}", nil, data_transform(data)) end |
#update_relationship_pivot_fields(data) ⇒ Object
Update relationship pivot fields.
Update pivot fields for relationships.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
field_name_1: 'value_1',
field_name_2: 'value_2'
}
@data = @cxf_user.update_relationship_pivot_fields(data)
124 125 126 |
# File 'lib/user/config/relationships.rb', line 124 def update_relationship_pivot_fields(data) @client.raw('put', '/config/relationships/pivot-fields', nil, data_transform(data)) end |