Module: Convoy::ApiOperations::Save

Included in:
Convoy::ApiKey, Endpoint, Event, PortalLink, Project, Source, Subscription
Defined in:
lib/convoy/api_operations/save.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



23
24
25
26
# File 'lib/convoy/api_operations/save.rb', line 23

def self.included(base)
  # Setup helper methods on Class.
  base.extend(ClassMethods)
end

Instance Method Details

#saveObject



18
19
20
21
# File 'lib/convoy/api_operations/save.rb', line 18

def save
  method = @id.nil? ? :post : :put
  send_request(resource_uri, method, data: @data, params: @params)
end

#update(data = {}) ⇒ Object



13
14
15
16
# File 'lib/convoy/api_operations/save.rb', line 13

def update(data = {})
  @data = data unless data.empty?
  send_request(resource_uri, :put, data: @data, params: @params)
end