Class: ApiPattern::Client

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/api-pattern/client.rb

Constant Summary

Constants included from Constants

ApiPattern::Constants::AUTH_TYPES, ApiPattern::Constants::BASE_PORT, ApiPattern::Constants::DEFAULT_AUTH_TYPE, ApiPattern::Constants::EMPTY_AUTH, ApiPattern::Constants::EMPTY_PARAMETER

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_path:, content_type:, port: BASE_PORT, auth: EMPTY_AUTH, auth_type: DEFAULT_AUTH_TYPE, token: EMPTY_PARAMETER, api_token: EMPTY_PARAMETER, access_token: EMPTY_PARAMETER, username: EMPTY_PARAMETER, key: EMPTY_PARAMETER, password: EMPTY_PARAMETER, secret: EMPTY_PARAMETER, limit: EMPTY_PARAMETER) ⇒ Client

Returns a new instance of Client.



17
18
19
20
21
22
23
24
# File 'lib/api-pattern/client.rb', line 17

def initialize(base_path:, content_type:, port: BASE_PORT, auth: EMPTY_AUTH, auth_type: DEFAULT_AUTH_TYPE, token: EMPTY_PARAMETER, api_token: EMPTY_PARAMETER, access_token: EMPTY_PARAMETER, username: EMPTY_PARAMETER, key: EMPTY_PARAMETER, password: EMPTY_PARAMETER, secret: EMPTY_PARAMETER, limit: EMPTY_PARAMETER)
  process_auth(auth, auth_type, token, api_token, access_token, username, key, password, secret)

  @content_type = content_type
  @base_path = base_path
  @port = port
  @limit = limit
end

Instance Attribute Details

#authObject (readonly)

Other auth parameters may be removed in the future For now making sure this base is compatible with all my API clients



9
10
11
# File 'lib/api-pattern/client.rb', line 9

def auth
  @auth
end

#auth_typeObject (readonly)

Other auth parameters may be removed in the future For now making sure this base is compatible with all my API clients



9
10
11
# File 'lib/api-pattern/client.rb', line 9

def auth_type
  @auth_type
end

#base_pathObject (readonly)

Returns the value of attribute base_path.



5
6
7
# File 'lib/api-pattern/client.rb', line 5

def base_path
  @base_path
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



5
6
7
# File 'lib/api-pattern/client.rb', line 5

def content_type
  @content_type
end

#expiryObject (readonly)

Response instance variables



15
16
17
# File 'lib/api-pattern/client.rb', line 15

def expiry
  @expiry
end

#keyObject (readonly)

Returns the value of attribute key.



11
12
13
# File 'lib/api-pattern/client.rb', line 11

def key
  @key
end

#limitObject (readonly)

Returns the value of attribute limit.



5
6
7
# File 'lib/api-pattern/client.rb', line 5

def limit
  @limit
end

#login_responseObject (readonly)

Response instance variables



15
16
17
# File 'lib/api-pattern/client.rb', line 15

def 
  @login_response
end

#passwordObject (readonly)

Returns the value of attribute password.



12
13
14
# File 'lib/api-pattern/client.rb', line 12

def password
  @password
end

#portObject (readonly)

Returns the value of attribute port.



5
6
7
# File 'lib/api-pattern/client.rb', line 5

def port
  @port
end

Response instance variables



15
16
17
# File 'lib/api-pattern/client.rb', line 15

def raw_cookie
  @raw_cookie
end

#secretObject (readonly)

Returns the value of attribute secret.



12
13
14
# File 'lib/api-pattern/client.rb', line 12

def secret
  @secret
end

#tokenObject (readonly)

Returns the value of attribute token.



10
11
12
# File 'lib/api-pattern/client.rb', line 10

def token
  @token
end

#usernameObject (readonly)

Returns the value of attribute username.



11
12
13
# File 'lib/api-pattern/client.rb', line 11

def username
  @username
end

Class Method Details

.api_versionObject

This is the version of the API docs this client was built off-of

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/api-pattern/client.rb', line 31

def self.api_version
  raise NotImplementedError
end

.compatible_api_versionObject

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/api-pattern/client.rb', line 26

def self.compatible_api_version
  raise NotImplementedError
end