Module: SendgridWeb::Request

Extended by:
URL
Defined in:
lib/sendgrid_web/request.rb

Class Attribute Summary collapse

Attributes included from URL

#format, #params, #resource, #url, #verb

Class Method Summary collapse

Methods included from URL

param, url_action, with_date

Class Attribute Details

.callbacksObject

Returns the value of attribute callbacks.



14
15
16
# File 'lib/sendgrid_web/request.rb', line 14

def callbacks
  @callbacks
end

.headersObject

Returns the value of attribute headers.



14
15
16
# File 'lib/sendgrid_web/request.rb', line 14

def headers
  @headers
end

.optionsObject

Returns the value of attribute options.



14
15
16
# File 'lib/sendgrid_web/request.rb', line 14

def options
  @options
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Configure a Request. @options and @headers are passed through to Faraday.

Yields:

  • (_self)

Yield Parameters:



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sendgrid_web/request.rb', line 22

def configure &block
  @callbacks = {}
  @headers = []
  @options = []

  unless SendgridWeb.api_user.nil? or SendgridWeb.api_key.nil?
    param(:api_user => SendgridWeb.api_user)
    param(:api_key => SendgridWeb.api_key)
  end

  yield self
end

.header(header) ⇒ Object



40
41
42
43
# File 'lib/sendgrid_web/request.rb', line 40

def header(header)
  @headers ||= {}
  @headers.merge!(header)
end

.option(option) ⇒ Object



35
36
37
38
# File 'lib/sendgrid_web/request.rb', line 35

def option(option)
  @options ||= {}
  @options.merge!(option)
end