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



93
94
95
# File 'lib/fat_zebra/api_helper.rb', line 93

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:



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

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



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

def resource_name
  self.class.resource_name
end

#resource_path(path = nil) ⇒ String

Returns resource path.

Returns:

  • (String)

    resource path



75
76
77
# File 'lib/fat_zebra/api_helper.rb', line 75

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