Class: Veryfi::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/veryfi/request.rb

Constant Summary collapse

VERBS_WITH_BODIES =
%i[post put].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_id, client_secret, username, api_key, base_url, api_version, timeout) ⇒ Request

Returns a new instance of Request.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/veryfi/request.rb', line 13

def initialize(
  client_id,
  client_secret,
  username,
  api_key,
  base_url,
  api_version,
  timeout
)
  @client_id = client_id
  @client_secret = client_secret
  @username = username
  @api_key = api_key
  @base_url = base_url
  @api_version = api_version
  @timeout = timeout
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



9
10
11
# File 'lib/veryfi/request.rb', line 9

def api_key
  @api_key
end

#api_versionObject (readonly)

Returns the value of attribute api_version.



9
10
11
# File 'lib/veryfi/request.rb', line 9

def api_version
  @api_version
end

#base_urlObject (readonly)

Returns the value of attribute base_url.



9
10
11
# File 'lib/veryfi/request.rb', line 9

def base_url
  @base_url
end

#client_idObject (readonly)

Returns the value of attribute client_id.



9
10
11
# File 'lib/veryfi/request.rb', line 9

def client_id
  @client_id
end

#client_secretObject (readonly)

Returns the value of attribute client_secret.



9
10
11
# File 'lib/veryfi/request.rb', line 9

def client_secret
  @client_secret
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



9
10
11
# File 'lib/veryfi/request.rb', line 9

def timeout
  @timeout
end

#usernameObject (readonly)

Returns the value of attribute username.



9
10
11
# File 'lib/veryfi/request.rb', line 9

def username
  @username
end

Instance Method Details

#api_urlObject



47
48
49
# File 'lib/veryfi/request.rb', line 47

def api_url
  @_api_url ||= [base_url, api_version].join
end

#delete(path) ⇒ Object



43
44
45
# File 'lib/veryfi/request.rb', line 43

def delete(path)
  make_request(:delete, path)
end

#get(path, params = {}) ⇒ Object



31
32
33
# File 'lib/veryfi/request.rb', line 31

def get(path, params = {})
  make_request(:get, path, params)
end

#post(path, params) ⇒ Object



39
40
41
# File 'lib/veryfi/request.rb', line 39

def post(path, params)
  make_request(:post, path, params)
end

#put(path, params) ⇒ Object



35
36
37
# File 'lib/veryfi/request.rb', line 35

def put(path, params)
  make_request(:put, path, params)
end