Class: WCC::Media::Client
- Inherits:
-
API::RestClient
- Object
- API::RestClient
- WCC::Media::Client
- Defined in:
- lib/wcc/media/client.rb,
lib/wcc/media/client/response.rb
Defined Under Namespace
Constant Summary collapse
- PARAMS =
%w[ limit offset order_by sort target ].freeze
- CONFIGURABLE_PARAMS =
PARAMS - %w[ offset ]
- RESOURCES =
{ 'messages' => WCC::Media::Message, 'series' => WCC::Media::Series, 'speakers' => WCC::Media::Speaker, 'tags' => WCC::Media::Tag, 'playlists' => WCC::Media::Playlist, 'streams' => WCC::Media::LiveStream }.freeze
Class Attribute Summary collapse
-
.default ⇒ Object
The default client.
Instance Method Summary collapse
-
#initialize(**options) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(**options) ⇒ Client
Returns a new instance of Client.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/wcc/media/client.rb', line 48 def initialize(**) = { api_url: 'https://media.watermark.org/api/v1/', response_class: Response, adapter: :typhoeus }.merge!() super(**) RESOURCES.each do |(endpoint, model)| instance_variable_set(:"@#{endpoint}", Resource.new(self, model, )) 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
21 22 23 |
# File 'lib/wcc/media/client.rb', line 21 def default @default ||= new end |