Class: HelpScoutDocs::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ HelpScoutDocs::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})


13
14
15
16
17
18
# File 'lib/help_scout_docs/client.rb', line 13

def initialize(options={})
  @logger = options.delete(:logger) || self.class.logger
  HelpScoutDocs::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || HelpScoutDocs.instance_variable_get(:"@#{key}"))
  end
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



6
7
8
# File 'lib/help_scout_docs/client.rb', line 6

def format
  @format
end

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/help_scout_docs/client.rb', line 6

def logger
  @logger
end

Instance Method Details

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

Perform an HTTP GET request

Parameters:

  • action (Array)


24
25
26
27
# File 'lib/help_scout_docs/client.rb', line 24

def get(path=nil, params={})
  @path ||= path
  request(:get, params)
end

#post(path = nil, params = {}) ⇒ Object

Perform an HTTP POST request

Parameters:

  • action (Array)


33
34
35
36
# File 'lib/help_scout_docs/client.rb', line 33

def post(path=nil, params={})
  @path ||= path
  request(:post, params)
end