class Netdocuments::Base

Constants

END_POINT

Public Instance Methods

client() click to toggle source
# File lib/netdocuments/base.rb, line 32
def client
  Netdocuments::Client.instance
end
delete(opts = {}) click to toggle source
# File lib/netdocuments/base.rb, line 28
def delete(opts = {})
end
get(opts = {}) click to toggle source
# File lib/netdocuments/base.rb, line 14
def get(opts = {})
  HTTParty.get(END_POINT + opts[:url],
               query: opts[:query],
               headers: opts[:headers],
               timeout: 180)
end
post(opts = {}) click to toggle source
# File lib/netdocuments/base.rb, line 6
def post(opts = {})
  HTTParty.post(END_POINT + opts[:url],
                :body => opts[:body],
                :headers => opts[:headers],
                :timeout => 180)
end
put(opts = {}) click to toggle source
# File lib/netdocuments/base.rb, line 21
def put(opts = {})
  HTTParty.put(END_POINT + opts[:url],
               body: opts[:query],
               headers: opts[:headers])
end
validate_config!() click to toggle source
# File lib/netdocuments/base.rb, line 36
def validate_config!
  if client.access_token.nil?
    puts "--- Fetching first time token---"
    client.get_token
  elsif !client.access_token.valid?
    puts "--- Fetching New token ---"
    client.get_token
  end
end