Class: SendgridTemplate::Configuration
- Inherits:
-
Object
- Object
- SendgridTemplate::Configuration
- Defined in:
- lib/sendgrid_template/configuration.rb
Constant Summary collapse
- API_URL =
'https://api.sendgrid.com'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 |
# File 'lib/sendgrid_template/configuration.rb', line 8 def initialize( = {}) @api_key = [:api_key] end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/sendgrid_template/configuration.rb', line 6 def api_key @api_key end |
Instance Method Details
#connect ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/sendgrid_template/configuration.rb', line 12 def connect @conn ||= Faraday.new(url: API_URL) do |h| h.headers[:content_type] = 'application/json' h.headers['Authorization'] = "Bearer #{@api_key}" h.adapter(Faraday.default_adapter) end @conn end |