module SendGrid4r::REST::Ips::Addresses

SendGrid Web API v3 Ip Management - Pools

Constants

Address

Public Class Methods

create_address(resp) click to toggle source
# File lib/sendgrid4r/rest/ips/addresses.rb, line 22
def self.create_address(resp)
  return resp if resp.nil?
  Address.new(
    resp['ip'],
    resp['pools'],
    resp['warmup'],
    resp['start_date'].nil? ? nil : Time.at(resp['start_date']),
    resp['subusers'],
    resp['rdns'],
    resp['pool_name']
  )
end
create_addresses(resp) click to toggle source
# File lib/sendgrid4r/rest/ips/addresses.rb, line 17
def self.create_addresses(resp)
  return resp if resp.nil?
  resp.map { |address| Ips::Addresses.create_address(address) }
end
url(ip = nil) click to toggle source
# File lib/sendgrid4r/rest/ips/addresses.rb, line 35
def self.url(ip = nil)
  url = "#{BASE_URL}/ips"
  url = "#{url}/#{ip}" unless ip.nil?
  url
end

Public Instance Methods

delete_ip_from_pool(pool_name:, ip:, &block) click to toggle source
# File lib/sendgrid4r/rest/ips/addresses.rb, line 61
def delete_ip_from_pool(pool_name:, ip:, &block)
  delete(@auth, Ips::Pools.url(pool_name, :ips, ip), &block)
end
get_ip(ip:, &block) click to toggle source
# File lib/sendgrid4r/rest/ips/addresses.rb, line 56
def get_ip(ip:, &block)
  resp = get(@auth, Ips::Addresses.url(ip), &block)
  finish(resp, @raw_resp) { |r| Ips::Addresses.create_address(r) }
end
get_ips(&block) click to toggle source
# File lib/sendgrid4r/rest/ips/addresses.rb, line 46
def get_ips(&block)
  resp = get(@auth, Ips::Addresses.url, &block)
  finish(resp, @raw_resp) { |r| Ips::Addresses.create_addresses(r) }
end
get_ips_assigned(&block) click to toggle source
# File lib/sendgrid4r/rest/ips/addresses.rb, line 51
def get_ips_assigned(&block)
  resp = get(@auth, Ips::Addresses.url(:assigned), &block)
  finish(resp, @raw_resp) { |r| Ips::Addresses.create_addresses(r) }
end
post_ip_to_pool(pool_name:, ip:, &block) click to toggle source
# File lib/sendgrid4r/rest/ips/addresses.rb, line 41
def post_ip_to_pool(pool_name:, ip:, &block)
  resp = post(@auth, Ips::Pools.url(pool_name, :ips), ip: ip, &block)
  finish(resp, @raw_resp) { |r| Ips::Addresses.create_address(r) }
end