Class: Convoy::ApiResource

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Convoy::ApiOperations::Request
Defined in:
lib/convoy/api_resource.rb

Overview

USAGE resource = Convoy::Resource.create(args) OR resource = Convoy::Resource.new(args) resource.save

Class methods - get, list, create, update, delete. These methods exist as helper methods. Instance methods - get, list, save, delete, update. Core methods class methods rely on.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Convoy::ApiOperations::Request

#send_request

Constructor Details

#initialize(**kwargs) ⇒ ApiResource

Returns a new instance of ApiResource.



30
31
32
33
34
# File 'lib/convoy/api_resource.rb', line 30

def initialize(**kwargs)
  @params = kwargs[:params].nil? ? {} : kwargs[:params]
  @query = kwargs[:query].nil? ? {} : kwargs[:query]
  @data = kwargs[:data].nil? ? {} : kwargs[:data]
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



28
29
30
# File 'lib/convoy/api_resource.rb', line 28

def response
  @response
end

Instance Method Details

#project_base_uriObject



36
37
38
39
40
41
42
# File 'lib/convoy/api_resource.rb', line 36

def project_base_uri
  if @config.project_id.nil?
    raise ArgumentError, "Project ID not supplied"
  end

  "#{@config.base_uri}/#{@config.path_version}/projects/#{@config.project_id}"
end