Class: VoiceNotes::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token: nil, base_url: nil) ⇒ Client

Returns a new instance of Client.



11
12
13
14
# File 'lib/voice_notes/client.rb', line 11

def initialize(access_token: nil, base_url: nil)
  @access_token = access_token || VoiceNotes.configuration&.api_key
  @base_url = base_url || VoiceNotes.configuration&.base_url
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



9
10
11
# File 'lib/voice_notes/client.rb', line 9

def access_token
  @access_token
end

Instance Method Details

#authObject



16
17
18
# File 'lib/voice_notes/client.rb', line 16

def auth
  @auth ||= Resources::Auth.new(self)
end

#delete(path) ⇒ Object



36
37
38
# File 'lib/voice_notes/client.rb', line 36

def delete(path)
  request(:delete, path)
end

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



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

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

#notesObject



20
21
22
# File 'lib/voice_notes/client.rb', line 20

def notes
  @notes ||= Resources::Notes.new(self)
end

#post(path, body = {}) ⇒ Object



28
29
30
# File 'lib/voice_notes/client.rb', line 28

def post(path, body = {})
  request(:post, path, body)
end

#put(path, body = {}) ⇒ Object



32
33
34
# File 'lib/voice_notes/client.rb', line 32

def put(path, body = {})
  request(:put, path, body)
end