Class: CommitLive::API
- Inherits:
-
Object
- Object
- CommitLive::API
- Defined in:
- lib/commit-live/api.rb
Constant Summary collapse
- URL =
'http://api.greyatom.com'- API_ROOT =
'/api/v1'
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Instance Method Summary collapse
- #get(url, options = {}) ⇒ Object
-
#initialize ⇒ API
constructor
A new instance of API.
- #post(url, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ API
Returns a new instance of API.
10 11 12 13 14 |
# File 'lib/commit-live/api.rb', line 10 def initialize() @conn = Faraday.new(url: URL) do |faraday| faraday.adapter Faraday.default_adapter end end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
5 6 7 |
# File 'lib/commit-live/api.rb', line 5 def conn @conn end |
Instance Method Details
#get(url, options = {}) ⇒ Object
16 17 18 |
# File 'lib/commit-live/api.rb', line 16 def get(url, = {}) request :get, url, end |
#post(url, options = {}) ⇒ Object
20 21 22 |
# File 'lib/commit-live/api.rb', line 20 def post(url, = {}) request :post, url, end |