Class: Cronofy::ApiKey

Inherits:
Object
  • Object
show all
Defined in:
lib/cronofy/api_key.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, client_secret) ⇒ ApiKey

Returns a new instance of ApiKey.



5
6
7
8
# File 'lib/cronofy/api_key.rb', line 5

def initialize(client, client_secret)
  @client = client
  @client_secret = client_secret
end

Instance Method Details

#get(path, opts = {}, &block) ⇒ Object

Make a GET request with the API Key

See Also:



25
26
27
# File 'lib/cronofy/api_key.rb', line 25

def get(path, opts = {}, &block)
  request(:get, path, opts, &block)
end

#patch(path, opts = {}, &block) ⇒ Object

Make a PATCH request with the API Key

See Also:



46
47
48
# File 'lib/cronofy/api_key.rb', line 46

def patch(path, opts = {}, &block)
  request(:patch, path, opts, &block)
end

#post(path, opts = {}, &block) ⇒ Object

Make a POST request with the API Key

See Also:



32
33
34
# File 'lib/cronofy/api_key.rb', line 32

def post(path, opts = {}, &block)
  request(:post, path, opts, &block)
end

#put(path, opts = {}, &block) ⇒ Object

Make a PUT request with the API Key

See Also:



39
40
41
# File 'lib/cronofy/api_key.rb', line 39

def put(path, opts = {}, &block)
  request(:put, path, opts, &block)
end

#request(verb, path, opts = {}, &block) ⇒ Object

Make a request with the API Key

Parameters:

  • verb (Symbol)

    the HTTP request method

  • path (String)

    the HTTP URL path of the request

  • opts (Hash) (defaults to: {})

    the options to make the request with

See Also:

  • Client#request


16
17
18
19
20
# File 'lib/cronofy/api_key.rb', line 16

def request(verb, path, opts = {}, &block)
  configure_authentication!(opts)
  opts = { snaky: false }.merge(opts)
  do_request { @client.request(verb, path, opts, &block) }
end