Class: EcsClaims::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ecs_claims/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options={})
  @token = options[:token]
  @url = options[:url]
  @rfc = options[:rfc]
end

Instance Attribute Details

#rfcObject (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