module SendGrid4r::REST::Ips::Pools

SendGrid Web API v3 Ip Management - Pools

Constants

Pool

Public Class Methods

create_pool(resp) click to toggle source
# File lib/sendgrid4r/rest/ips/pools.rb, line 20
def self.create_pool(resp)
  return resp if resp.nil?
  Pool.new(resp['pool_name'], resp['name'], resp['ips'])
end
create_pools(resp) click to toggle source
# File lib/sendgrid4r/rest/ips/pools.rb, line 15
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) click to toggle source
# File lib/sendgrid4r/rest/ips/pools.rb, line 25
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

Public Instance Methods

delete_pool(name:, &block) click to toggle source
# File lib/sendgrid4r/rest/ips/pools.rb, line 53
def delete_pool(name:, &block)
  delete(@auth, Ips::Pools.url(name), &block)
end
get_pool(name:, &block) click to toggle source
# File lib/sendgrid4r/rest/ips/pools.rb, line 43
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) click to toggle source
# File lib/sendgrid4r/rest/ips/pools.rb, line 38
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) click to toggle source
# File lib/sendgrid4r/rest/ips/pools.rb, line 33
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) click to toggle source
# File lib/sendgrid4r/rest/ips/pools.rb, line 48
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