Class: WorkSurfer::Client
- Inherits:
-
Object
- Object
- WorkSurfer::Client
- Defined in:
- lib/work_surfer/client.rb
Constant Summary collapse
- OPTIONS_WITH_CLASS_DEFAULT =
[ :api_key, :connection_builder, :connection_options, :default_headers, :default_territory_id, :url_base, ].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**options) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(**options) ⇒ Client
Returns a new instance of Client.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/work_surfer/client.rb', line 55 def initialize(**) = .keys - OPTIONS_WITH_CLASS_DEFAULT raise ArgumentError, "Unknown option key(s): #{.join(", ")}. Valid options are: #{OPTIONS_WITH_CLASS_DEFAULT.join(", ")}." if .any? OPTIONS_WITH_CLASS_DEFAULT.each do |option| value = [option].nil? ? self.class.public_send(option) : [option] public_send("#{option}=", value) end self end |
Class Method Details
.default_client ⇒ Object
91 92 93 |
# File 'lib/work_surfer/client.rb', line 91 def default_client @default_client ||= new end |
.default_client=(client) ⇒ Object
95 96 97 |
# File 'lib/work_surfer/client.rb', line 95 def default_client=(client) @default_client = client end |