Sha256: cfb527dc4c768f08be9934bf60023e51013fc9d13a46de8db6e6c7b72da04da0

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

# -*- encoding: utf-8 -*-
$LOAD_PATH.unshift File.dirname(__FILE__)

require 'sendgrid4r/rest/request'

module SendGrid4r
  module REST
    #
    # SendGrid Web API v3 Webhooks
    #
    module Webhooks
      #
      # SendGrid Web API v3 Webhooks ParseApi
      #
      module ParseApi
        include SendGrid4r::REST::Request

        ParseSettings = Struct.new(:url, :hostname, :spam_check_outgoing)

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

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

        def get_parse_settings(&block)
          resp = get(@auth, SendGrid4r::REST::Webhooks::ParseApi.url, &block)
          SendGrid4r::REST::Webhooks::ParseApi.create_parse_settings(resp)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sendgrid4r-1.5.0 lib/sendgrid4r/rest/webhooks/parse_api.rb