Class: CryptApi::Main

Inherits:
Object
  • Object
show all
Extended by:
EncryptFactory, Sender
Defined in:
lib/crypt_api.rb

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from EncryptFactory

decrypt_data, encrypt_data, make_signature

Methods included from Sender

post_data

Class Attribute Details

.encrypt_algorithmObject

Returns the value of attribute encrypt_algorithm.



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

def encrypt_algorithm
  @encrypt_algorithm
end

.make_signatureObject

Returns the value of attribute make_signature.



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

def make_signature
  @make_signature
end

.secret_keyObject

Returns the value of attribute secret_key.



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

def secret_key
  @secret_key
end

.signature_tokenObject

Returns the value of attribute signature_token.



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

def signature_token
  @signature_token
end

.urlObject

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.decrypt_response(encrypted_response) ⇒ Object



32
33
34
# File 'lib/crypt_api.rb', line 32

def self.decrypt_response(encrypted_response)
  decrypt_data(encrypted_response, self.secret_key, self.encrypt_algorithm)
end

.send_encrypted_request(data) ⇒ Object



27
28
29
30
# File 'lib/crypt_api.rb', line 27

def self.send_encrypted_request(data)
  encrypted_data = encrypt_data(data.to_s, self.secret_key, self.encrypt_algorithm)
  post_data({data: encrypted_data}, self.url)
end

.set_configs {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



23
24
25
# File 'lib/crypt_api.rb', line 23

def self.set_configs
  yield(self) 
end