Class: CommitLive::API
- Inherits:
-
Object
- Object
- CommitLive::API
- Defined in:
- lib/commit-live/api.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Instance Method Summary collapse
- #get(url, options = {}) ⇒ Object
-
#initialize(api_url = nil) ⇒ API
constructor
A new instance of API.
- #post(url, options = {}) ⇒ Object
Constructor Details
#initialize(api_url = nil) ⇒ API
Returns a new instance of API.
8 9 10 11 12 13 |
# File 'lib/commit-live/api.rb', line 8 def initialize(api_url = nil) endpoint = api_url || CommitLive::Endpoint.new.get() @conn = Faraday.new(url: endpoint) do |faraday| faraday.adapter Faraday.default_adapter end end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
6 7 8 |
# File 'lib/commit-live/api.rb', line 6 def conn @conn end |
Instance Method Details
#get(url, options = {}) ⇒ Object
15 16 17 |
# File 'lib/commit-live/api.rb', line 15 def get(url, = {}) request :get, url, end |
#post(url, options = {}) ⇒ Object
19 20 21 |
# File 'lib/commit-live/api.rb', line 19 def post(url, = {}) request :post, url, end |