Class: TRMNL::API::Endpoints::CurrentScreen

Inherits:
Object
  • Object
show all
Includes:
Pipeable
Defined in:
lib/trmnl/api/endpoints/current_screen.rb

Overview

Handles API request/response.

Instance Method Summary collapse

Instance Method Details

#call(token:) ⇒ Object



20
21
22
23
24
25
# File 'lib/trmnl/api/endpoints/current_screen.rb', line 20

def call token:
  pipe requester.get("current_screen", headers: {"Access-Token" => token}),
       try(:parse, catch: JSON::ParserError),
       validate(contract, as: :to_h),
       to(model, :for)
end