Module: SendGrid4r::REST::Ips::Pools
- Includes:
- Request
- Included in:
- API
- Defined in:
- lib/sendgrid4r/rest/ips/pools.rb
Overview
SendGrid Web API v3 Ip Management - Pools
Defined Under Namespace
Classes: Pool
Constant Summary
Constants included
from Request
Request::BASE_URL
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Request
#create_args, #delete, #execute, #finish, #get, #patch, #post, #process_array_params, #process_url_params, #put
Class Method Details
.create_pool(resp) ⇒ Object
21
22
23
24
|
# File 'lib/sendgrid4r/rest/ips/pools.rb', line 21
def self.create_pool(resp)
return resp if resp.nil?
Pool.new(resp['pool_name'], resp['name'], resp['ips'])
end
|
.create_pools(resp) ⇒ Object
16
17
18
19
|
# File 'lib/sendgrid4r/rest/ips/pools.rb', line 16
def self.create_pools(resp)
return resp if resp.nil?
resp.map { |pool| Ips::Pools.create_pool(pool) }
end
|
.url(name = nil, ips = nil, ip = nil) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/sendgrid4r/rest/ips/pools.rb', line 26
def self.url(name = nil, ips = nil, ip = nil)
url = "#{BASE_URL}/ips/pools"
url = "#{url}/#{name}" unless name.nil?
url = "#{url}/#{ips}" unless ips.nil?
url = "#{url}/#{ip}" unless ip.nil?
url
end
|
Instance Method Details
#delete_pool(name:, &block) ⇒ Object
54
55
56
|
# File 'lib/sendgrid4r/rest/ips/pools.rb', line 54
def delete_pool(name:, &block)
delete(@auth, Ips::Pools.url(name), &block)
end
|
#get_pool(name:, &block) ⇒ Object
44
45
46
47
|
# File 'lib/sendgrid4r/rest/ips/pools.rb', line 44
def get_pool(name:, &block)
resp = get(@auth, Ips::Pools.url(name), &block)
finish(resp, @raw_resp) { |r| Ips::Pools.create_pool(r) }
end
|
#get_pools(&block) ⇒ Object
39
40
41
42
|
# File 'lib/sendgrid4r/rest/ips/pools.rb', line 39
def get_pools(&block)
resp = get(@auth, Ips::Pools.url, &block)
finish(resp, @raw_resp) { |r| Ips::Pools.create_pools(r) }
end
|
#post_pool(name:, &block) ⇒ Object
34
35
36
37
|
# File 'lib/sendgrid4r/rest/ips/pools.rb', line 34
def post_pool(name:, &block)
resp = post(@auth, Ips::Pools.url, name: name, &block)
finish(resp, @raw_resp) { |r| Ips::Pools.create_pool(r) }
end
|
#put_pool(name:, new_name:, &block) ⇒ Object
49
50
51
52
|
# File 'lib/sendgrid4r/rest/ips/pools.rb', line 49
def put_pool(name:, new_name:, &block)
resp = put(@auth, Ips::Pools.url(name), name: new_name, &block)
finish(resp, @raw_resp) { |r| Ips::Pools.create_pool(r) }
end
|