Class: RaindropIo::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/raindrop_io/api.rb

Overview

Api configuration Usage: RaindropIo::Api.configure do |config| config.api_token = ENV["RAINDROP_TOKEN"] end

Defined Under Namespace

Classes: Configuration

Class Method Summary collapse

Class Method Details

.configurationObject



48
49
50
# File 'lib/raindrop_io/api.rb', line 48

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



52
53
54
# File 'lib/raindrop_io/api.rb', line 52

def configure
  yield(configuration)
end

.delete(path, options = {}) ⇒ Object



74
75
76
77
78
# File 'lib/raindrop_io/api.rb', line 74

def delete(path, options = {})
  resp = HTTP.headers(headers).delete(build_url(path), options)
  log_response_headers(resp)
  resp
end

.get(path, options = {}) ⇒ Object



56
57
58
59
60
# File 'lib/raindrop_io/api.rb', line 56

def get(path, options = {})
  resp = HTTP.headers(headers).get(build_url(path), params: options)
  log_response_headers(resp)
  resp
end

.get_configObject



80
81
82
# File 'lib/raindrop_io/api.rb', line 80

def get_config
  configuration
end

.post(path, options = {}) ⇒ Object



68
69
70
71
72
# File 'lib/raindrop_io/api.rb', line 68

def post(path, options = {})
  resp = HTTP.headers(headers).post(build_url(path), options)
  log_response_headers(resp)
  resp
end

.put(path, options = {}) ⇒ Object



62
63
64
65
66
# File 'lib/raindrop_io/api.rb', line 62

def put(path, options = {})
  resp = HTTP.headers(headers).put(build_url(path), options)
  log_response_headers(resp)
  resp
end