Class: Cloudrunpdf::Providers::Amazon
- Inherits:
-
Object
- Object
- Cloudrunpdf::Providers::Amazon
- Defined in:
- lib/cloudrunpdf/providers/amazon.rb
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(configuration = nil) ⇒ Amazon
constructor
A new instance of Amazon.
- #token ⇒ Object
Constructor Details
#initialize(configuration = nil) ⇒ Amazon
Returns a new instance of Amazon.
4 5 6 7 |
# File 'lib/cloudrunpdf/providers/amazon.rb', line 4 def initialize(configuration = nil) @configuration = configuration @token = token end |
Instance Method Details
#connection ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cloudrunpdf/providers/amazon.rb', line 22 def connection return unless @configuration Faraday::Connection.new( headers: { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{@token}" }.compact ) do |conn| conn.response :raise_error end end |
#token ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cloudrunpdf/providers/amazon.rb', line 9 def token return unless @configuration if @configuration.token return @token ||= @configuration.token end # To be deprecated if !ENV['CLOUD_API_TOKEN'].nil? @token ||= ENV.fetch('CLOUD_API_TOKEN', nil) end end |