module Dhis2

Constants

VERSION

Public Class Methods

client() click to toggle source
# File lib/dhis2.rb, line 64
def client
  @client ||= Dhis2::Client.new(config.client_params)
end
config() click to toggle source
# File lib/dhis2.rb, line 72
def config
  @configuration ||= Dhis2::Configuration.new
end
configure() { |config| ... } click to toggle source
# File lib/dhis2.rb, line 68
def configure
  yield config
end
get_version(params) click to toggle source

params: { user: , password:, url: }

# File lib/dhis2.rb, line 77
def get_version(params)
  check_config = Dhis2::Configuration.new.tap do |conf|
    conf.url      = params.fetch(:url)
    conf.password = params.fetch(:password)
    conf.user     = params.fetch(:user)
  end
  response = RestClient.get(
    Dhis2::Client.uri(check_config.client_params[:url], "/system/info")
  )
  JSON.parse(response.body)["version"]
end
play(debug = false, version: "2.28") click to toggle source
# File lib/dhis2.rb, line 60
def play(debug = false, version:  "2.28")
  Dhis2::Client.new(config.play_params(debug, version))
end