module SendGrid4r::REST::Whitelabel::Links
SendGrid Web API
v3 Whitelabel
Links
Constants
- Dns
- Link
- Record
- Result
- ValidationResult
- ValidationResults
Public Class Methods
create_dns(resp)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 46 def self.create_dns(resp) return resp if resp.nil? Dns.new( Links.create_record(resp['domain_cname']), Links.create_record(resp['owner_cname']) ) end
create_link(resp)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 31 def self.create_link(resp) return resp if resp.nil? Link.new( resp['id'], resp['domain'], resp['subdomain'], resp['username'], resp['user_id'], resp['default'], resp['valid'], resp['legacy'], Links.create_dns(resp['dns']) ) end
create_links(resp)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 26 def self.create_links(resp) return resp if resp.nil? resp.map { |link| Links.create_link(link) } end
create_record(resp)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 54 def self.create_record(resp) return resp if resp.nil? Record.new(resp['host'], resp['type'], resp['data'], resp['valid']) end
create_result(resp)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 63 def self.create_result(resp) return resp if resp.nil? Result.new( resp['id'], resp['valid'], Links.create_validation_results(resp['validation_results']) ) end
create_validation_result(resp)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 80 def self.create_validation_result(resp) return resp if resp.nil? ValidationResult.new(resp['valid'], resp['reason']) end
create_validation_results(resp)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 72 def self.create_validation_results(resp) return resp if resp.nil? ValidationResults.new( Links.create_validation_result(resp['domain_cname']), Links.create_validation_result(resp['owner_cname']) ) end
url(id = nil)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 20 def self.url(id = nil) url = "#{BASE_URL}/whitelabel/links" url = "#{url}/#{id}" unless id.nil? url end
Public Instance Methods
associate_wl_link(id:, username:, &block)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 149 def associate_wl_link(id:, username:, &block) params = { username: username } resp = post(@auth, "#{Links.url(id)}/subuser", params, &block) finish(resp, @raw_resp) { |r| Links.create_link(r) } end
delete_wl_link(id:, &block)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 122 def delete_wl_link(id:, &block) delete(@auth, Links.url(id), &block) end
disassociate_wl_link(username:, &block)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 144 def disassociate_wl_link(username:, &block) params = { username: username } delete(@auth, "#{Links.url}/subuser", params, &block) end
get_associated_wl_link(username:, &block)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 138 def get_associated_wl_link(username:, &block) params = { username: username } resp = get(@auth, "#{Links.url}/subuser", params, &block) finish(resp, @raw_resp) { |r| Links.create_link(r) } end
get_default_wl_link(domain: nil, &block)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 126 def get_default_wl_link(domain: nil, &block) params = {} params[:domain] = domain unless domain.nil? resp = get(@auth, "#{Links.url}/default", params, &block) finish(resp, @raw_resp) { |r| Links.create_link(r) } end
get_wl_link(id:, &block)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 111 def get_wl_link(id:, &block) resp = get(@auth, Links.url(id), nil, &block) finish(resp, @raw_resp) { |r| Links.create_link(r) } end
get_wl_links( limit: nil, offset: nil, exclude_subusers: nil, username: nil, domain: nil, &block )
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 85 def get_wl_links( limit: nil, offset: nil, exclude_subusers: nil, username: nil, domain: nil, &block ) params = {} params[:limit] = limit unless limit.nil? params[:offset] = offset unless offset.nil? unless exclude_subusers.nil? params[:exclude_subusers] = exclude_subusers end params[:username] = username unless username.nil? params[:domain] = domain unless domain.nil? resp = get(@auth, Links.url, params, &block) finish(resp, @raw_resp) { |r| Links.create_links(r) } end
patch_wl_link(id:, default:, &block)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 116 def patch_wl_link(id:, default:, &block) params = { default: default } resp = patch(@auth, Links.url(id), params, &block) finish(resp, @raw_resp) { |r| Links.create_link(r) } end
post_wl_link(subdomain:, domain:, default: nil, &block)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 101 def post_wl_link(subdomain:, domain:, default: nil, &block) params = { subdomain: subdomain, domain: domain } params[:default] = default unless default.nil? resp = post(@auth, Links.url, params, &block) finish(resp, @raw_resp) { |r| Links.create_link(r) } end
validate_wl_link(id:, &block)
click to toggle source
# File lib/sendgrid4r/rest/whitelabel/links.rb, line 133 def validate_wl_link(id:, &block) resp = post(@auth, "#{Links.url(id)}/validate", &block) finish(resp, @raw_resp) { |r| Links.create_result(r) } end