Class: Trueform::Client
- Inherits:
-
Object
- Object
- Trueform::Client
- Defined in:
- lib/trueform/client.rb
Constant Summary collapse
- DEFAULT_BASE_URL =
"https://api.trueform.cloud"- DEFAULT_TIMEOUT =
10- DEFAULT_MAX_RETRIES =
2- MAX_RETRY_DELAY =
60
Instance Attribute Summary collapse
-
#validations ⇒ Object
readonly
Returns the value of attribute validations.
Instance Method Summary collapse
-
#initialize(base_url: DEFAULT_BASE_URL, timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_MAX_RETRIES, transport: Transport::NetHTTP.new) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(base_url: DEFAULT_BASE_URL, timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_MAX_RETRIES, transport: Transport::NetHTTP.new) ⇒ Client
Returns a new instance of Client.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/trueform/client.rb', line 18 def initialize( base_url: DEFAULT_BASE_URL, timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_MAX_RETRIES, transport: Transport::NetHTTP.new ) @base_url = normalize_base_url(base_url) @timeout = positive_number(timeout, :timeout) @max_retries = non_negative_integer(max_retries, :max_retries) @transport = transport @validations = Resources::Validations.new do |email, timeout: nil, max_retries: nil| request( method: :post, path: "/v1/validations", body: {email: email}, timeout: timeout, max_retries: max_retries ) end end |
Instance Attribute Details
#validations ⇒ Object (readonly)
Returns the value of attribute validations.
16 17 18 |
# File 'lib/trueform/client.rb', line 16 def validations @validations end |