Class: Dolibarr::Api::Objectlinks
- Inherits:
-
Object
- Object
- Dolibarr::Api::Objectlinks
- Defined in:
- lib/dolibarr-api/api/objectlinks.rb
Instance Method Summary collapse
- #create(objectlinks_create_model: nil) ⇒ Object
-
#initialize(connection) ⇒ Objectlinks
constructor
A new instance of Objectlinks.
- #remove_by_id(id:) ⇒ Object
- #remove_by_values(fk_source:, sourcetype:, fk_target:, targettype:, relationtype: nil, notrigger: nil) ⇒ Object
- #retrieve_by_id(id:) ⇒ Object
- #retrieve_by_values(fk_source:, sourcetype:, fk_target:, targettype:, relationtype: nil) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Objectlinks
Returns a new instance of Objectlinks.
5 6 7 |
# File 'lib/dolibarr-api/api/objectlinks.rb', line 5 def initialize(connection) @connection = connection end |
Instance Method Details
#create(objectlinks_create_model: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/dolibarr-api/api/objectlinks.rb', line 9 def create(objectlinks_create_model: nil) @connection.call( :POST, '/objectlinks', type: nil, auth: ['api_key'], body: objectlinks_create_model ) end |
#remove_by_id(id:) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dolibarr-api/api/objectlinks.rb', line 19 def remove_by_id(id:) raise ArgumentError, 'id is required' if id.nil? @connection.call( :DELETE, '/objectlinks/{id}' .gsub('{id}', ERB::Util.url_encode(id.to_s)), type: nil, auth: ['api_key'] ) end |
#remove_by_values(fk_source:, sourcetype:, fk_target:, targettype:, relationtype: nil, notrigger: nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dolibarr-api/api/objectlinks.rb', line 31 def remove_by_values(fk_source:, sourcetype:, fk_target:, targettype:, relationtype: nil, notrigger: nil) raise ArgumentError, 'fk_source is required' if fk_source.nil? raise ArgumentError, 'sourcetype is required' if sourcetype.nil? raise ArgumentError, 'fk_target is required' if fk_target.nil? raise ArgumentError, 'targettype is required' if targettype.nil? @connection.call( :DELETE, '/objectlinks', type: nil, auth: ['api_key'], query: { 'fk_source' => fk_source, 'sourcetype' => sourcetype, 'fk_target' => fk_target, 'targettype' => targettype, 'relationtype' => relationtype, 'notrigger' => notrigger } ) end |
#retrieve_by_id(id:) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/dolibarr-api/api/objectlinks.rb', line 46 def retrieve_by_id(id:) raise ArgumentError, 'id is required' if id.nil? @connection.call( :GET, '/objectlinks/{id}' .gsub('{id}', ERB::Util.url_encode(id.to_s)), type: Dolibarr::Api::Models::Obj, auth: ['api_key'] ) end |
#retrieve_by_values(fk_source:, sourcetype:, fk_target:, targettype:, relationtype: nil) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/dolibarr-api/api/objectlinks.rb', line 58 def retrieve_by_values(fk_source:, sourcetype:, fk_target:, targettype:, relationtype: nil) raise ArgumentError, 'fk_source is required' if fk_source.nil? raise ArgumentError, 'sourcetype is required' if sourcetype.nil? raise ArgumentError, 'fk_target is required' if fk_target.nil? raise ArgumentError, 'targettype is required' if targettype.nil? @connection.call( :GET, '/objectlinks', type: Dolibarr::Api::Models::Obj, auth: ['api_key'], query: { 'fk_source' => fk_source, 'sourcetype' => sourcetype, 'fk_target' => fk_target, 'targettype' => targettype, 'relationtype' => relationtype } ) end |