Class: HelpScoutDocs::Client
- Inherits:
-
Object
- Object
- HelpScoutDocs::Client
- Defined in:
- lib/help_scout_docs/client.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#get(path = nil, params = {}) ⇒ Object
Perform an HTTP GET request.
-
#initialize(options = {}) ⇒ HelpScoutDocs::Client
constructor
Initializes a new Client object.
-
#post(path = nil, params = {}) ⇒ Object
Perform an HTTP POST request.
Constructor Details
#initialize(options = {}) ⇒ HelpScoutDocs::Client
Initializes a new Client object
13 14 15 16 17 18 |
# File 'lib/help_scout_docs/client.rb', line 13 def initialize(={}) @logger = .delete(:logger) || self.class.logger HelpScoutDocs::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", [key] || HelpScoutDocs.instance_variable_get(:"@#{key}")) end end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
6 7 8 |
# File 'lib/help_scout_docs/client.rb', line 6 def format @format end |
#logger ⇒ Object (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
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
33 34 35 36 |
# File 'lib/help_scout_docs/client.rb', line 33 def post(path=nil, params={}) @path ||= path request(:post, params) end |