Class: Clerk::ApiConnection
- Inherits:
-
Object
- Object
- Clerk::ApiConnection
- Defined in:
- lib/clerk-rails.rb
Instance Method Summary collapse
- #get(*args, &block) ⇒ Object
-
#initialize ⇒ ApiConnection
constructor
A new instance of ApiConnection.
- #post(path, fields, &block) ⇒ Object
Constructor Details
#initialize ⇒ ApiConnection
Returns a new instance of ApiConnection.
49 50 51 52 53 54 55 |
# File 'lib/clerk-rails.rb', line 49 def initialize @c = Faraday.new(:url => (ENV["CLERK_API_PATH"] || "https://clerk-server-prod-test.herokuapp.com")) do |conn| conn. :Bearer, Clerk.key_secret conn.headers['Content-Type'] = 'application/json' conn.adapter Faraday.default_adapter end end |
Instance Method Details
#get(*args, &block) ⇒ Object
61 62 63 |
# File 'lib/clerk-rails.rb', line 61 def get(*args, &block) Clerk::ApiResponse.new(@c.get(*args, &block)) end |
#post(path, fields, &block) ⇒ Object
57 58 59 |
# File 'lib/clerk-rails.rb', line 57 def post(path, fields, &block) Clerk::ApiResponse.new(@c.post(path, fields.to_json, &block)) end |