Module: SendgridWeb::URL
- Included in:
- Request
- Defined in:
- lib/sendgrid_web/utils.rb
Overview
Utility to assemble a URL for Sendgrid.
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#params ⇒ Object
Returns the value of attribute params.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#url ⇒ Object
Returns the value of attribute url.
-
#verb ⇒ Object
Returns the value of attribute verb.
Instance Method Summary collapse
-
#param(param) ⇒ Object
Add or overwrite a param in @params hash.
-
#url_action ⇒ Object
Returns action portion of Sendgrid URL, e.g.
-
#with_date ⇒ Object
Convenience method to add param with strict Sendgrid requirements.
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
7 8 9 |
# File 'lib/sendgrid_web/utils.rb', line 7 def format @format end |
#params ⇒ Object
Returns the value of attribute params.
7 8 9 |
# File 'lib/sendgrid_web/utils.rb', line 7 def params @params end |
#resource ⇒ Object
Returns the value of attribute resource.
7 8 9 |
# File 'lib/sendgrid_web/utils.rb', line 7 def resource @resource end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/sendgrid_web/utils.rb', line 7 def url @url end |
#verb ⇒ Object
Returns the value of attribute verb.
7 8 9 |
# File 'lib/sendgrid_web/utils.rb', line 7 def verb @verb end |
Instance Method Details
#param(param) ⇒ Object
Add or overwrite a param in @params hash. These are passed through to Faraday.
24 25 26 27 |
# File 'lib/sendgrid_web/utils.rb', line 24 def param(param) @params ||= {} @params.merge!(param) end |
#url_action ⇒ Object
Returns action portion of Sendgrid URL, e.g. “api/resource.verb.format”
15 16 17 18 19 20 |
# File 'lib/sendgrid_web/utils.rb', line 15 def url_action parts = [] parts << SendgridWeb.api_namespace parts << [resource, verb, format].join('.') parts.join('/') end |
#with_date ⇒ Object
Convenience method to add param with strict Sendgrid requirements.
31 32 33 |
# File 'lib/sendgrid_web/utils.rb', line 31 def with_date param(:date => 1) end |