Class: Jumbotron::Deserializers::Clients::Espn::Status

Inherits:
Object
  • Object
show all
Defined in:
app/deserializers/jumbotron/deserializers/clients/espn/status.rb

Defined Under Namespace

Classes: Result

Class Method Summary collapse

Class Method Details

.call(payload) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/deserializers/jumbotron/deserializers/clients/espn/status.rb', line 21

def self.call(payload)
  Support.ensure_hash!(payload, label: "status")
  type = fetch_type!(payload)

  Result.build!(
    clock: Support.whole_number(Support.payload.fetch(payload, "clock")),
    display_clock: Support.payload.fetch(payload, "displayClock"),
    period: Support.payload.fetch(payload, "period"),
    type_id: coerce_string(Support.payload.fetch(type, "id")),
    type_name: Support.payload.fetch(type, "name"),
    type_state: Support.payload.fetch(type, "state"),
    type_completed: Support.payload.fetch(type, "completed"),
    type_description: Support.payload.fetch(type, "description"),
    type_detail: Support.payload.fetch(type, "detail"),
    type_short_detail: Support.payload.fetch(type, "shortDetail")
  )
end