Class: SnapCi::Http
- Inherits:
-
Object
- Object
- SnapCi::Http
- Defined in:
- lib/snap_ci/http.rb
Constant Summary collapse
- URL =
'https://api.snap-ci.com'
Instance Method Summary collapse
- #get(parameters = '') ⇒ Object
-
#initialize(config) ⇒ Http
constructor
A new instance of Http.
Constructor Details
#initialize(config) ⇒ Http
Returns a new instance of Http.
7 8 9 10 11 12 13 14 |
# File 'lib/snap_ci/http.rb', line 7 def initialize(config) @http = Faraday.new(url: URL) do |conection| conection.basic_auth(config.user, config.token) conection.headers['Content-Type'] = 'text/plain' conection.headers['Accept'] = 'application/vnd.snap-ci.com.v1+json' conection.adapter Faraday.default_adapter end end |
Instance Method Details
#get(parameters = '') ⇒ Object
16 17 18 |
# File 'lib/snap_ci/http.rb', line 16 def get(parameters = '') @http.get(parameters) end |