Class: ClerkActiveRecord::Api::Connection
- Inherits:
-
Object
- Object
- ClerkActiveRecord::Api::Connection
- Defined in:
- lib/clerk_active_record.rb
Instance Method Summary collapse
- #delete(path, fields, &block) ⇒ Object
- #get(*args, &block) ⇒ Object
-
#initialize(url, auth_token) ⇒ Connection
constructor
A new instance of Connection.
- #patch(path, fields, &block) ⇒ Object
- #post(path, fields, &block) ⇒ Object
Constructor Details
#initialize(url, auth_token) ⇒ Connection
Returns a new instance of Connection.
8 9 10 11 12 13 14 |
# File 'lib/clerk_active_record.rb', line 8 def initialize(url, auth_token) @c = Faraday.new(:url => url) do |conn| conn.request :url_encoded conn. :Bearer, auth_token conn.adapter Faraday.default_adapter end end |
Instance Method Details
#delete(path, fields, &block) ⇒ Object
24 25 26 |
# File 'lib/clerk_active_record.rb', line 24 def delete(path, fields, &block) ClerkActiveRecord::Api::Response.new(@c.delete(path, fields.as_json, &block)) end |
#get(*args, &block) ⇒ Object
28 29 30 |
# File 'lib/clerk_active_record.rb', line 28 def get(*args, &block) ClerkActiveRecord::Api::Response.new(@c.get(*args, &block)) end |
#patch(path, fields, &block) ⇒ Object
20 21 22 |
# File 'lib/clerk_active_record.rb', line 20 def patch(path, fields, &block) ClerkActiveRecord::Api::Response.new(@c.patch(path, fields.as_json, &block)) end |
#post(path, fields, &block) ⇒ Object
16 17 18 |
# File 'lib/clerk_active_record.rb', line 16 def post(path, fields, &block) ClerkActiveRecord::Api::Response.new(@c.post(path, fields.as_json, &block)) end |