Method: ARest#initialize

Defined in:
lib/arest.rb

#initialize(base_url, **options) ⇒ ARest

Input:

  • base_url - the base URL for REST API

Options:

  • headers (Hash) to set up headers c = ARest.new “localhost:3000/_api/v1”, headers: => “Token token=AHDIUHSBC.…”

  • username and password for basic http authentication c = ARest.new “localhost:3000/_api/v1”, username: “user1”, password: “password.8”

  • Authentication token c = ARest.new “localhost:3000/_api/v1”, token: ‘AdbsuUDhwb3hqhj…’



40
41
42
43
44
45
46
# File 'lib/arest.rb', line 40

def initialize(base_url, **options)
  @base_url = base_url
  @headers = options[:headers]
  @auth_user = options[:username]
  @auth_password = options[:password]
  @auth_token = options[:token]
end