class FIS::Client::Base
Constants
- API_ROOT
- BASE_URL
- CLIENT_ERROR_STATUSES
- ERROR_STATUSES
- SERVER_ERROR_STATUSES
Attributes
client[R]
Public Class Methods
new(token:)
click to toggle source
# File lib/fis/client/base.rb, line 16 def initialize(token:) url = [BASE_URL, API_ROOT].join @client = Faraday.new(url: url) do |conn| conn.authorization :Bearer, token conn.response :json, content_type: 'application/json', parser_options: { object_class: OpenStruct } conn.request :retry, max: 3, interval: 2, interval_randomness: 0.5, backoff_factor: 2, methods: Faraday::Request::Retry::IDEMPOTENT_METHODS + [:post], retry_statuses: ERROR_STATUSES, exceptions: Faraday::Request::Retry::DEFAULT_EXCEPTIONS conn.adapter Faraday.default_adapter end end
Public Instance Methods
user()
click to toggle source
# File lib/fis/client/base.rb, line 45 def user @user ||= User.new(base: self) end
valid_token?()
click to toggle source
# File lib/fis/client/base.rb, line 41 def valid_token? !!user.data end