Class: Flash::Integration::Connection
- Inherits:
-
Object
- Object
- Flash::Integration::Connection
- Defined in:
- lib/flash/integration/connection.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Instance Method Summary collapse
- #default_headers ⇒ Object
- #delete(url: "", params: {}, headers: {}, body: {}) ⇒ Object
- #get(url: "", params: {}, headers: {}) ⇒ Object
-
#initialize(base_url:, request_class: Faraday) ⇒ Connection
constructor
A new instance of Connection.
- #patch(url: "", params: {}, headers: {}, body: {}) ⇒ Object
- #post(url: "", params: {}, headers: {}, body: {}, multipart: false) ⇒ Object
- #put(url: "", params: {}, headers: {}, body: {}) ⇒ Object
Constructor Details
#initialize(base_url:, request_class: Faraday) ⇒ Connection
Returns a new instance of Connection.
8 9 10 11 |
# File 'lib/flash/integration/connection.rb', line 8 def initialize(base_url:, request_class: Faraday) @request_class = request_class @base_url = base_url end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
6 7 8 |
# File 'lib/flash/integration/connection.rb', line 6 def base_url @base_url end |
Instance Method Details
#default_headers ⇒ Object
63 64 65 |
# File 'lib/flash/integration/connection.rb', line 63 def default_headers {} end |
#delete(url: "", params: {}, headers: {}, body: {}) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/flash/integration/connection.rb', line 53 def delete(url: "", params: {}, headers: {}, body: {}) send_request( method: :delete, url: url, params: params, headers: headers, body: body ) end |
#get(url: "", params: {}, headers: {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/flash/integration/connection.rb', line 13 def get(url: "", params: {}, headers: {}) send_request( method: :get, url: url, params: params, headers: headers ) end |
#patch(url: "", params: {}, headers: {}, body: {}) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/flash/integration/connection.rb', line 43 def patch(url: "", params: {}, headers: {}, body: {}) send_request( method: :patch, url: url, params: params, headers: headers, body: body ) end |
#post(url: "", params: {}, headers: {}, body: {}, multipart: false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flash/integration/connection.rb', line 22 def post(url: "", params: {}, headers: {}, body: {}, multipart: false) send_request( method: :post, url: url, params: params, headers: headers, body: body, multipart: multipart ) end |
#put(url: "", params: {}, headers: {}, body: {}) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/flash/integration/connection.rb', line 33 def put(url: "", params: {}, headers: {}, body: {}) send_request( method: :put, url: url, params: params, headers: headers, body: body ) end |