Class: Cronofy::ApiKey
- Inherits:
-
Object
- Object
- Cronofy::ApiKey
- Defined in:
- lib/cronofy/api_key.rb
Instance Method Summary collapse
-
#get(path, opts = {}, &block) ⇒ Object
Make a GET request with the API Key.
-
#initialize(client, client_secret) ⇒ ApiKey
constructor
A new instance of ApiKey.
-
#patch(path, opts = {}, &block) ⇒ Object
Make a PATCH request with the API Key.
-
#post(path, opts = {}, &block) ⇒ Object
Make a POST request with the API Key.
-
#put(path, opts = {}, &block) ⇒ Object
Make a PUT request with the API Key.
-
#request(verb, path, opts = {}, &block) ⇒ Object
Make a request with the API Key.
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
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
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
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
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
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 |