Class: FreshdeskAPI::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/freshdesk_api/configuration.rb

Overview

Holds the configuration options for the client and connection

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



30
31
32
# File 'lib/freshdesk_api/configuration.rb', line 30

def initialize
  @client_options = {}
end

Instance Attribute Details

#allow_httpBoolean

Returns Whether to allow non-HTTPS connections for development purposes.

Returns:

  • (Boolean)

    Whether to allow non-HTTPS connections for development purposes.



23
24
25
# File 'lib/freshdesk_api/configuration.rb', line 23

def allow_http
  @allow_http
end

#apitokenString

Returns The basic auth token.

Returns:

  • (String)

    The basic auth token.



11
12
13
# File 'lib/freshdesk_api/configuration.rb', line 11

def apitoken
  @apitoken
end

#base_urlString

Returns The API url. Must be https unless #allow_http is set.

Returns:

  • (String)

    The API url. Must be https unless #allow_http is set.



14
15
16
# File 'lib/freshdesk_api/configuration.rb', line 14

def base_url
  @base_url
end

#client_optionsHash

Returns Client configurations.

Returns:

  • (Hash)

    Client configurations



20
21
22
# File 'lib/freshdesk_api/configuration.rb', line 20

def client_options
  @client_options
end

#loggerLogger

Returns Logger to use when logging requests.

Returns:

  • (Logger)

    Logger to use when logging requests.



17
18
19
# File 'lib/freshdesk_api/configuration.rb', line 17

def logger
  @logger
end

#open_timeoutObject

:read_timeout and :open_timeout are how long to wait for a response and to open a connection, in seconds. Pass nil to disable the timeout.



27
28
29
# File 'lib/freshdesk_api/configuration.rb', line 27

def open_timeout
  @open_timeout
end

#passwordString

Returns The basic auth password.

Returns:

  • (String)

    The basic auth password.



8
9
10
# File 'lib/freshdesk_api/configuration.rb', line 8

def password
  @password
end

#read_timeoutObject

Returns the value of attribute read_timeout.



28
29
30
# File 'lib/freshdesk_api/configuration.rb', line 28

def read_timeout
  @read_timeout
end

#usernameString

Returns The basic auth username.

Returns:

  • (String)

    The basic auth username



5
6
7
# File 'lib/freshdesk_api/configuration.rb', line 5

def username
  @username
end

Instance Method Details

#optionsHash

Sets accept and user_agent headers, and url

Returns:

  • (Hash)

    RestClient-formatted hash of options.



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/freshdesk_api/configuration.rb', line 37

def options
  {
    headers: {
      accept: :json,
      content_type: :json,
      accept_encoding: 'gzip ,deflate',
      user_agent: "FreshdeskAPI API #{FreshdeskAPI::VERSION}"
    },
    read_timeout: nil,
    open_timeout: nil,
    base_url: @base_url
  }.merge(client_options)
end