Module: SendGrid4r::REST::Webhooks::Parse

Includes:
Request
Included in:
API
Defined in:
lib/sendgrid4r/rest/webhooks/parse.rb

Overview

SendGrid Web API v3 Webhooks Parse

Defined Under Namespace

Classes: ParseSetting, ParseSettings

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_parse_setting(resp) ⇒ Object



29
30
31
32
33
34
# File 'lib/sendgrid4r/rest/webhooks/parse.rb', line 29

def self.create_parse_setting(resp)
  return resp if resp.nil?
  ParseSetting.new(
    resp['url'], resp['hostname'], resp['spam_check_outgoing']
  )
end

.create_parse_settings(resp) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/sendgrid4r/rest/webhooks/parse.rb', line 21

def self.create_parse_settings(resp)
  return resp if resp.nil?
  parse_settings = resp['result'].map do |setting|
    Parse.create_parse_setting(setting)
  end
  ParseSettings.new(parse_settings)
end

.urlObject



17
18
19
# File 'lib/sendgrid4r/rest/webhooks/parse.rb', line 17

def self.url
  "#{BASE_URL}/user/webhooks/parse/settings"
end

Instance Method Details

#get_parse_settings(&block) ⇒ Object



36
37
38
39
# File 'lib/sendgrid4r/rest/webhooks/parse.rb', line 36

def get_parse_settings(&block)
  resp = get(@auth, Parse.url, &block)
  finish(resp, @raw_resp) { |r| Parse.create_parse_settings(r) }
end