Class: HikOpenapi::Client
- Inherits:
-
Object
- Object
- HikOpenapi::Client
- Defined in:
- lib/hik_openapi.rb
Instance Attribute Summary collapse
-
#app_key ⇒ Object
Returns the value of attribute app_key.
-
#app_secret ⇒ Object
Returns the value of attribute app_secret.
-
#host ⇒ Object
Returns the value of attribute host.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#timeouts ⇒ Object
Returns the value of attribute timeouts.
-
#user_agent ⇒ Object
writeonly
Sets the attribute user_agent.
Instance Method Summary collapse
- #get(path, params) ⇒ Object
-
#initialize(options = {}) {|_self| ... } ⇒ Client
constructor
A new instance of Client.
- #post(path, params) ⇒ Object
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 |
# File 'lib/hik_openapi.rb', line 13 def initialize( = {}) .each do |key, value| instance_variable_set("@#{key}", value) end yield(self) if block_given? end |
Instance Attribute Details
#app_key ⇒ Object
Returns the value of attribute app_key.
10 11 12 |
# File 'lib/hik_openapi.rb', line 10 def app_key @app_key end |
#app_secret ⇒ Object
Returns the value of attribute app_secret.
10 11 12 |
# File 'lib/hik_openapi.rb', line 10 def app_secret @app_secret end |
#host ⇒ Object
Returns the value of attribute host.
10 11 12 |
# File 'lib/hik_openapi.rb', line 10 def host @host end |
#prefix ⇒ Object
Returns the value of attribute prefix.
10 11 12 |
# File 'lib/hik_openapi.rb', line 10 def prefix @prefix end |
#proxy ⇒ Object
Returns the value of attribute proxy.
10 11 12 |
# File 'lib/hik_openapi.rb', line 10 def proxy @proxy end |
#timeouts ⇒ Object
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
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 |