Class: EcsClaims::Client
- Inherits:
-
Object
- Object
- EcsClaims::Client
- Defined in:
- lib/ecs_claims/client.rb
Instance Attribute Summary collapse
-
#rfc ⇒ Object
readonly
Returns the value of attribute rfc.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #request(type, path, params = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 |
# File 'lib/ecs_claims/client.rb', line 8 def initialize(={}) @token = [:token] @url = [:url] @rfc = [:rfc] end |
Instance Attribute Details
#rfc ⇒ Object (readonly)
Returns the value of attribute rfc.
6 7 8 |
# File 'lib/ecs_claims/client.rb', line 6 def rfc @rfc end |
Instance Method Details
#request(type, path, params = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/ecs_claims/client.rb', line 14 def request(type, path, params={}) block = Proc.new do |request| request.url path request.headers['Authorization'] = "Token #{token}" request.headers['Content-Type'] = 'application/json' end send("#{type}_request", path, params, &block) end |