Class: HelpScoutDocs::Method

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/help_scout_docs/method.rb

Direct Known Subclasses

Article, Category, Collection, Site

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client = nil, options = {}) ⇒ Method

Returns a new instance of Method.



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

def initialize(client=nil, options={})
  @options ||= options
  @client = client || initialize_client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/help_scout_docs/method.rb', line 4

def client
  @client
end

#methodObject

Returns the value of attribute method.



4
5
6
# File 'lib/help_scout_docs/method.rb', line 4

def method
  @method
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/help_scout_docs/method.rb', line 4

def options
  @options
end

Instance Method Details

#client?Boolean

Has a client been initialized?

Returns:

  • (Boolean)


28
29
30
# File 'lib/help_scout_docs/method.rb', line 28

def client?
  !!@client
end

#initialize_clientHelpScoutDocs::Client

Delegate to a HelpScoutDocs::Client



19
20
21
22
# File 'lib/help_scout_docs/method.rb', line 19

def initialize_client
  @client = HelpScoutDocs::Client.new(@options) unless defined?(@client) && @client.hash == @options.hash
  @client
end