Class: TildaRuby::Client
- Inherits:
-
Internal::Transport::BaseClient
- Object
- Internal::Transport::BaseClient
- TildaRuby::Client
- Defined in:
- lib/tilda_ruby/client.rb
Constant Summary collapse
- DEFAULT_MAX_RETRIES =
Default max number of retries to attempt after a failed retryable request.
2- DEFAULT_TIMEOUT_IN_SECONDS =
Default per-request timeout.
60.0- DEFAULT_INITIAL_RETRY_DELAY =
Default initial retry delay in seconds. Overall delay is calculated using exponential backoff + jitter.
0.5- DEFAULT_MAX_RETRY_DELAY =
Default max retry delay in seconds.
8.0
Constants inherited from Internal::Transport::BaseClient
Internal::Transport::BaseClient::MAX_REDIRECTS, Internal::Transport::BaseClient::PLATFORM_HEADERS
Instance Attribute Summary collapse
- #export ⇒ TildaRuby::Resources::Export readonly
- #pages ⇒ TildaRuby::Resources::Pages readonly
- #projects ⇒ TildaRuby::Resources::Projects readonly
-
#publickey ⇒ String?
readonly
Tilda API public key.
-
#secretkey ⇒ String?
readonly
Tilda API secret key.
Attributes inherited from Internal::Transport::BaseClient
#base_url, #headers, #idempotency_header, #initial_retry_delay, #max_retries, #max_retry_delay, #requester, #timeout
Instance Method Summary collapse
-
#initialize(publickey: nil, secretkey: nil, base_url: ENV["TILDA_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY) ⇒ Client
constructor
Creates and returns a new client for interacting with the API.
Methods inherited from Internal::Transport::BaseClient
follow_redirect, #inspect, reap_connection!, #request, #send_request, should_retry?, validate!
Methods included from Internal::Util::SorbetRuntimeSupport
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type
Constructor Details
#initialize(publickey: nil, secretkey: nil, base_url: ENV["TILDA_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY) ⇒ Client
Creates and returns a new client for interacting with the API.
‘“api.example.com/v2/”`. Defaults to `ENV`
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/tilda_ruby/client.rb', line 72 def initialize( publickey: nil, secretkey: nil, base_url: ENV["TILDA_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY ) base_url ||= "https://api.tildacdn.info" @publickey = publickey&.to_s @secretkey = secretkey&.to_s super( base_url: base_url, timeout: timeout, max_retries: max_retries, initial_retry_delay: initial_retry_delay, max_retry_delay: max_retry_delay ) @projects = TildaRuby::Resources::Projects.new(client: self) @pages = TildaRuby::Resources::Pages.new(client: self) @export = TildaRuby::Resources::Export.new(client: self) end |
Instance Attribute Details
#export ⇒ TildaRuby::Resources::Export (readonly)
33 34 35 |
# File 'lib/tilda_ruby/client.rb', line 33 def export @export end |
#pages ⇒ TildaRuby::Resources::Pages (readonly)
30 31 32 |
# File 'lib/tilda_ruby/client.rb', line 30 def pages @pages end |
#projects ⇒ TildaRuby::Resources::Projects (readonly)
27 28 29 |
# File 'lib/tilda_ruby/client.rb', line 27 def projects @projects end |
#publickey ⇒ String? (readonly)
Tilda API public key
20 21 22 |
# File 'lib/tilda_ruby/client.rb', line 20 def publickey @publickey end |
#secretkey ⇒ String? (readonly)
Tilda API secret key
24 25 26 |
# File 'lib/tilda_ruby/client.rb', line 24 def secretkey @secretkey end |