Class: Bixby::EncryptedJsonRequest

Inherits:
JsonRequest show all
Defined in:
lib/bixby-common/api/encrypted_json_request.rb

Instance Attribute Summary

Attributes inherited from JsonRequest

#operation, #params

Instance Method Summary collapse

Methods inherited from JsonRequest

#==, #to_s

Methods included from HttpClient

#http_get, #http_get_json, #http_post, #http_post_download, #http_post_json

Methods included from Jsonify

included, #to_json

Methods included from Hashify

#to_hash

Constructor Details

#initialize(json_request, private_key, public_key, uuid = "master") ⇒ EncryptedJsonRequest

Returns a new instance of EncryptedJsonRequest.



5
6
7
8
9
10
11
12
# File 'lib/bixby-common/api/encrypted_json_request.rb', line 5

def initialize(json_request, private_key, public_key, uuid="master")
  self.operation = json_request.operation
  self.params = json_request.params

  # encrypt
  data = json_request.to_json
  @body = Bixby::CryptoUtil.encrypt(data, uuid, public_key, private_key)
end

Instance Method Details

#to_wireObject



14
15
16
# File 'lib/bixby-common/api/encrypted_json_request.rb', line 14

def to_wire
  @body
end