Class: Client
- Inherits:
-
Object
- Object
- Client
- Defined in:
- lib/hackerearth_api/client.rb
Instance Attribute Summary collapse
-
#client_secret_key ⇒ Object
Returns the value of attribute client_secret_key.
Instance Method Summary collapse
-
#compile(params) ⇒ Object
compiles the code of the current object params must be a hash.
-
#initialize(client_secret_key) ⇒ Client
constructor
A new instance of Client.
-
#run(params) ⇒ Object
run the code of the current object params must be a hash.
Constructor Details
#initialize(client_secret_key) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/hackerearth_api/client.rb', line 11 def initialize(client_secret_key) if client_secret_key == nil raise(ExceptionHandler::InvalidParameterException, Message.client_secret_nil) end @client_secret_key = client_secret_key end |
Instance Attribute Details
#client_secret_key ⇒ Object
Returns the value of attribute client_secret_key.
9 10 11 |
# File 'lib/hackerearth_api/client.rb', line 9 def client_secret_key @client_secret_key end |
Instance Method Details
#compile(params) ⇒ Object
compiles the code of the current object params must be a hash
20 21 22 23 24 |
# File 'lib/hackerearth_api/client.rb', line 20 def compile(params) filtered_parameters = CompileParameters.get_params(params) filtered_parameters[:client_secret] = @client_secret_key Response.compile(filtered_parameters) end |
#run(params) ⇒ Object
run the code of the current object params must be a hash
28 29 30 31 32 |
# File 'lib/hackerearth_api/client.rb', line 28 def run(params) filtered_parameters = RunParameters.get_params(params) filtered_parameters[:client_secret] = @client_secret_key Response.run(filtered_parameters) end |