Class: HikOpenapi::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:



13
14
15
16
17
18
# File 'lib/hik_openapi.rb', line 13

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  yield(self) if block_given?
end

Instance Attribute Details

#app_keyObject

Returns the value of attribute app_key.



10
11
12
# File 'lib/hik_openapi.rb', line 10

def app_key
  @app_key
end

#app_secretObject

Returns the value of attribute app_secret.



10
11
12
# File 'lib/hik_openapi.rb', line 10

def app_secret
  @app_secret
end

#hostObject

Returns the value of attribute host.



10
11
12
# File 'lib/hik_openapi.rb', line 10

def host
  @host
end

#prefixObject

Returns the value of attribute prefix.



10
11
12
# File 'lib/hik_openapi.rb', line 10

def prefix
  @prefix
end

#proxyObject

Returns the value of attribute proxy.



10
11
12
# File 'lib/hik_openapi.rb', line 10

def proxy
  @proxy
end

#timeoutsObject

Returns the value of attribute timeouts.



10
11
12
# File 'lib/hik_openapi.rb', line 10

def timeouts
  @timeouts
end

#user_agent=(value) ⇒ Object (writeonly)

Sets the attribute user_agent

Parameters:

  • value

    the value to set the attribute user_agent to.



11
12
13
# File 'lib/hik_openapi.rb', line 11

def user_agent=(value)
  @user_agent = value
end

Instance Method Details

#get(path, params) ⇒ Object



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

def get(path, params)
  request(:get, path, params)
end

#post(path, params) ⇒ Object



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

def post(path, params)
  request(:post, path, params)
end