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



90
91
92
# File 'lib/fat_zebra/api_helper.rb', line 90

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:



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

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



66
67
68
# File 'lib/fat_zebra/api_helper.rb', line 66

def resource_name
  self.class.resource_name
end

#resource_path(path = nil) ⇒ String

Returns resource path.

Returns:

  • (String)

    resource path



72
73
74
# File 'lib/fat_zebra/api_helper.rb', line 72

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