Class: SendGridWebApi::ApiKeyModules::Management

Inherits:
SendGridWebApi::ApiKey show all
Defined in:
lib/api_key/management.rb

Constant Summary collapse

APIKEY_URL =
"api_keys"

Instance Attribute Summary

Attributes inherited from Base

#api_key

Instance Method Summary collapse

Methods inherited from SendGridWebApi::ApiKey

#base_url

Methods included from SendGridWebApi::ApiKeyModules

#management

Methods inherited from Base

#builder_options, #initialize, #make_request_url, #query_api, #query_delete_api, #query_patch_api, #query_post_api, #query_post_json_api, #session, #to_query

Constructor Details

This class inherits a constructor from SendGridWebApi::Base

Instance Method Details

#create(options = {}) ⇒ Object



14
15
16
# File 'lib/api_key/management.rb', line 14

def create options = {}
  query_post_json_api(APIKEY_URL, process_header_options(options))
end

#delete(apikey_id, options = {}) ⇒ Object



18
19
20
# File 'lib/api_key/management.rb', line 18

def delete apikey_id, options = {}
  query_delete_api(APIKEY_URL+"/#{apikey_id}", process_header_options(options))
end

#get(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/api_key/management.rb', line 5

def get options = {}
  management_get_url = APIKEY_URL
  if options.key?(:apikey_id)
    management_get_url += "/#{options[:apikey_id]}"
    options.delete(:apikey_id)
  end
  query_api(management_get_url, process_header_options(options))
end

#update(apikey_id, options = {}) ⇒ Object



22
23
24
# File 'lib/api_key/management.rb', line 22

def update apikey_id, options = {}
  query_patch_api(APIKEY_URL+"/#{apikey_id}", process_header_options(options))
end