Class: Ibanity::Client
- Inherits:
-
Object
- Object
- Ibanity::Client
- Defined in:
- lib/ibanity/client.rb
Instance Attribute Summary collapse
-
#application_id ⇒ Object
readonly
Returns the value of attribute application_id.
-
#base_uri ⇒ Object
readonly
Returns the value of attribute base_uri.
-
#isabel_connect_client_id ⇒ Object
readonly
Returns the value of attribute isabel_connect_client_id.
-
#isabel_connect_client_secret ⇒ Object
readonly
Returns the value of attribute isabel_connect_client_secret.
-
#ponto_connect_client_id ⇒ Object
readonly
Returns the value of attribute ponto_connect_client_id.
-
#ponto_connect_client_secret ⇒ Object
readonly
Returns the value of attribute ponto_connect_client_secret.
-
#signature_certificate ⇒ Object
readonly
Returns the value of attribute signature_certificate.
-
#signature_key ⇒ Object
readonly
Returns the value of attribute signature_key.
Instance Method Summary collapse
- #build_uri(path) ⇒ Object
- #delete(uri:, query_params: {}, customer_access_token: nil, json: true) ⇒ Object
- #get(uri:, query_params: {}, customer_access_token: nil, headers: nil, json: true) ⇒ Object
-
#initialize(certificate:, key:, key_passphrase:, signature_certificate: nil, signature_certificate_id: nil, signature_key: nil, signature_key_passphrase: nil, api_scheme: "https", api_host: "api.ibanity.com", ssl_ca_file: nil, isabel_connect_client_id: nil, isabel_connect_client_secret: nil, ponto_connect_client_id: nil, ponto_connect_client_secret: nil, application_id: nil, debug_http_requests: false, timeout: 60) ⇒ Client
constructor
A new instance of Client.
- #patch(uri:, payload:, query_params: {}, customer_access_token: nil, idempotency_key: nil, json: true) ⇒ Object
- #post(uri:, payload:, query_params: {}, customer_access_token: nil, idempotency_key: nil, json: true, headers: nil) ⇒ Object
Constructor Details
#initialize(certificate:, key:, key_passphrase:, signature_certificate: nil, signature_certificate_id: nil, signature_key: nil, signature_key_passphrase: nil, api_scheme: "https", api_host: "api.ibanity.com", ssl_ca_file: nil, isabel_connect_client_id: nil, isabel_connect_client_secret: nil, ponto_connect_client_id: nil, ponto_connect_client_secret: nil, application_id: nil, debug_http_requests: false, timeout: 60) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ibanity/client.rb', line 6 def initialize( certificate:, key:, key_passphrase:, signature_certificate: nil, signature_certificate_id: nil, signature_key: nil, signature_key_passphrase: nil, api_scheme: "https", api_host: "api.ibanity.com", ssl_ca_file: nil, isabel_connect_client_id: nil, isabel_connect_client_secret: nil, ponto_connect_client_id: nil, ponto_connect_client_secret: nil, application_id: nil, debug_http_requests: false, timeout: 60 ) @isabel_connect_client_id = isabel_connect_client_id @isabel_connect_client_secret = isabel_connect_client_secret @ponto_connect_client_id = ponto_connect_client_id @ponto_connect_client_secret = ponto_connect_client_secret @certificate = OpenSSL::X509::Certificate.new(certificate) @key = OpenSSL::PKey::RSA.new(key, key_passphrase) @http_debug = debug_http_requests if signature_certificate @signature_certificate = OpenSSL::X509::Certificate.new(signature_certificate) @signature_certificate_id = signature_certificate_id @signature_key = OpenSSL::PKey::RSA.new(signature_key, signature_key_passphrase) end @base_uri = "#{api_scheme}://#{api_host}" @ssl_ca_file = ssl_ca_file @application_id = application_id @timeout = timeout end |
Instance Attribute Details
#application_id ⇒ Object (readonly)
Returns the value of attribute application_id.
4 5 6 |
# File 'lib/ibanity/client.rb', line 4 def application_id @application_id end |
#base_uri ⇒ Object (readonly)
Returns the value of attribute base_uri.
4 5 6 |
# File 'lib/ibanity/client.rb', line 4 def base_uri @base_uri end |
#isabel_connect_client_id ⇒ Object (readonly)
Returns the value of attribute isabel_connect_client_id.
4 5 6 |
# File 'lib/ibanity/client.rb', line 4 def isabel_connect_client_id @isabel_connect_client_id end |
#isabel_connect_client_secret ⇒ Object (readonly)
Returns the value of attribute isabel_connect_client_secret.
4 5 6 |
# File 'lib/ibanity/client.rb', line 4 def isabel_connect_client_secret @isabel_connect_client_secret end |
#ponto_connect_client_id ⇒ Object (readonly)
Returns the value of attribute ponto_connect_client_id.
4 5 6 |
# File 'lib/ibanity/client.rb', line 4 def ponto_connect_client_id @ponto_connect_client_id end |
#ponto_connect_client_secret ⇒ Object (readonly)
Returns the value of attribute ponto_connect_client_secret.
4 5 6 |
# File 'lib/ibanity/client.rb', line 4 def ponto_connect_client_secret @ponto_connect_client_secret end |
#signature_certificate ⇒ Object (readonly)
Returns the value of attribute signature_certificate.
4 5 6 |
# File 'lib/ibanity/client.rb', line 4 def signature_certificate @signature_certificate end |
#signature_key ⇒ Object (readonly)
Returns the value of attribute signature_key.
4 5 6 |
# File 'lib/ibanity/client.rb', line 4 def signature_key @signature_key end |
Instance Method Details
#build_uri(path) ⇒ Object
63 64 65 |
# File 'lib/ibanity/client.rb', line 63 def build_uri(path) URI.join(@base_uri, path).to_s end |
#delete(uri:, query_params: {}, customer_access_token: nil, json: true) ⇒ Object
58 59 60 61 |
# File 'lib/ibanity/client.rb', line 58 def delete(uri:, query_params: {}, customer_access_token: nil, json: true) headers = build_headers(customer_access_token: customer_access_token, json: json) execute(method: :delete, uri: uri, headers: headers, query_params: query_params, json: json) end |
#get(uri:, query_params: {}, customer_access_token: nil, headers: nil, json: true) ⇒ Object
43 44 45 46 |
# File 'lib/ibanity/client.rb', line 43 def get(uri:, query_params: {}, customer_access_token: nil, headers: nil, json: true) headers = build_headers(customer_access_token: customer_access_token, extra_headers: headers, json: json) execute(method: :get, uri: uri, headers: headers, query_params: query_params, json: json) end |
#patch(uri:, payload:, query_params: {}, customer_access_token: nil, idempotency_key: nil, json: true) ⇒ Object
53 54 55 56 |
# File 'lib/ibanity/client.rb', line 53 def patch(uri:, payload:, query_params: {}, customer_access_token: nil, idempotency_key: nil, json: true) headers = build_headers(customer_access_token: customer_access_token, idempotency_key: idempotency_key, json: json, payload: payload) execute(method: :patch, uri: uri, headers: headers, query_params: query_params, payload: payload, json: json) end |
#post(uri:, payload:, query_params: {}, customer_access_token: nil, idempotency_key: nil, json: true, headers: nil) ⇒ Object
48 49 50 51 |
# File 'lib/ibanity/client.rb', line 48 def post(uri:, payload:, query_params: {}, customer_access_token: nil, idempotency_key: nil, json: true, headers: nil) headers = build_headers(customer_access_token: customer_access_token, idempotency_key: idempotency_key, extra_headers: headers, json: json, payload: payload) execute(method: :post, uri: uri, headers: headers, query_params: query_params, payload: payload, json: json) end |