Class: Nifi

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

Constant Summary collapse

DEFAULT_HOST =
'localhost'
DEFAULT_SCHEMA =
'http'
DEFAULT_PORT =
'8080'
DEFAULT_DEBUG =
false
DEFAULT_ACYNC =
false

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Nifi

Returns a new instance of Nifi.



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/nifi_sdk_ruby.rb', line 27

def initialize(*args)

  args = args.reduce Hash.new, :merge

  @@schema      = args[:schema] ? args[:schema] : DEFAULT_SCHEMA
  @@host        = args[:host] ? args[:host] : DEFAULT_HOST
  @@port        = args[:port] ? args[:port] : DEFAULT_PORT
  @@base_url    = @@schema + '://' + @@host + ':' + @@port + '/nifi-api'
  @@debug       = DEFAULT_DEBUG
  @@async       = DEFAULT_ACYNC
  @@sdk_name    = 'ruby'
  @@sdk_version = NifiSdkRuby::VERSION
end

Instance Method Details

#get_api_keyObject



73
74
75
# File 'lib/nifi_sdk_ruby.rb', line 73

def get_api_key()
  @@api_key
end

#get_asyncObject



69
70
71
# File 'lib/nifi_sdk_ruby.rb', line 69

def get_async()
  @@async
end

#get_base_urlObject



85
86
87
# File 'lib/nifi_sdk_ruby.rb', line 85

def get_base_url()
 	@@base_url
end

#get_debugObject



53
54
55
# File 'lib/nifi_sdk_ruby.rb', line 53

def get_debug()
  @@debug
end

#get_hostObject



81
82
83
# File 'lib/nifi_sdk_ruby.rb', line 81

def get_host()
 	@@host
end

#get_process_group(*args) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/nifi_sdk_ruby.rb', line 89

def get_process_group(*args)

  args = args.reduce Hash.new, :merge

  process_group = args[:pg_id] ? args[:pg_id] : 'root'

  base_url = @@base_url + "/process-groups/#{process_group}"
  res = self.class.http_client(base_url)

  if args[:attr]
    return res[args[:attr]]
  end

  return res
end

#get_schemaObject



77
78
79
# File 'lib/nifi_sdk_ruby.rb', line 77

def get_schema()
  @@schema
end

#set_async(async = nil) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/nifi_sdk_ruby.rb', line 57

def set_async(async = nil)
  if async.nil?
    abort 'missing async'
  end

  if !(!!async == async)
    abort 'async msut be a boolean'
  end

  @@async = async
end

#set_debug(debug = nil) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/nifi_sdk_ruby.rb', line 41

def set_debug(debug = nil)
  if debug.nil?
    abort 'missing debug'
  end

  if !(!!debug == debug)
    abort 'debug msut be a boolean'
  end

  @@debug = debug
end