Class: WCC::Media::Client
- Inherits:
-
RestClient
- Object
- RestClient
- WCC::Media::Client
- Defined in:
- lib/wcc/media/client.rb,
lib/wcc/media/client/version.rb,
lib/wcc/media/client/response.rb
Defined Under Namespace
Constant Summary collapse
- PARAMS =
%w[ limit offset order_by sort target ].freeze
- RESOURCES =
{ 'messages' => WCC::Media::Message, 'series' => WCC::Media::Series, 'speakers' => WCC::Media::Speaker, 'tags' => WCC::Media::Tag }.freeze
- VERSION =
'0.2.1'.freeze
Constants inherited from RestClient
Class Attribute Summary collapse
-
.default ⇒ Object
The default client.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from RestClient
Instance Method Summary collapse
-
#initialize(**options) ⇒ Client
constructor
A new instance of Client.
Methods inherited from RestClient
Constructor Details
#initialize(**options) ⇒ Client
Returns a new instance of Client.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/wcc/media/client.rb', line 38 def initialize(**) = { api_url: 'https://media.watermark.org/api/v1/', response_class: Response }.merge!() super(**) RESOURCES.each do |(endpoint, model)| instance_variable_set("@#{endpoint}", Resource.new(self, model, @options)) end end |
Class Attribute Details
.default ⇒ Object
The default client. Set this in an initializer to change the client used by all the WCC::Media models
15 16 17 |
# File 'lib/wcc/media/client.rb', line 15 def default @default ||= new end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
36 37 38 |
# File 'lib/wcc/media/client.rb', line 36 def @options end |