Module: FatZebra::APIHelper

Included in:
APIResource
Defined in:
lib/fat_zebra/api_helper.rb

Overview

FatZebra Helper

Help for the api resource

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



86
87
88
# File 'lib/fat_zebra/api_helper.rb', line 86

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#request(method, resource_path, payload = {}, options = {}) ⇒ Hash

Send a request to the API

Parameters:

  • method (Symbol)

    for the request

  • endpoint (String)

    for the request

  • options (Hash) (defaults to: {})
  • Payload (Hash)

Returns:

  • (Hash)

    response

Raises:



82
83
84
# File 'lib/fat_zebra/api_helper.rb', line 82

def request(method, resource_path, payload = {}, options = {})
  self.class.request(method, resource_path, payload, options)
end

#resource_nameString

Returns resource name.

Returns:

  • (String)

    resource name



62
63
64
# File 'lib/fat_zebra/api_helper.rb', line 62

def resource_name
  self.class.resource_name
end

#resource_path(path = nil) ⇒ String

Returns resource path.

Returns:

  • (String)

    resource path



68
69
70
# File 'lib/fat_zebra/api_helper.rb', line 68

def resource_path(path = nil)
  self.class.resource_path(path)
end