Class: Wiq::Commands::Locations

Inherits:
Base
  • Object
show all
Defined in:
lib/wiq/commands/locations.rb

Instance Method Summary collapse

Methods inherited from Base

exit_on_failure?

Instance Method Details

#listObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/wiq/commands/locations.rb', line 29

def list
  params = { "per_page" => 100 }
  params["include_archived"] = true if options[:include_archived]

  records, total = fetch_index("/api/v1/locations", params, key: "locations")
  render_index(
    records, total: total,
    summary: "Listed #{records.size} locations#{options[:include_archived] ? " (including archived)" : ""}.",
    breadcrumbs: [
      { "cmd" => "wiq locations show <id>", "description" => "Inspect a single location" },
      { "cmd" => "wiq rosters list --location <id>", "description" => "Rosters at a location" },
      { "cmd" => "wiq metrics show mrr --location <id>",
        "description" => "Finance metrics scoped to a location (admin only)" }
    ]
  )
end

#show(id) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/wiq/commands/locations.rb', line 51

def show(id)
  location = client.get("/api/v1/locations/#{id}")
  render(location,
         summary: "Location #{location["id"]}#{location["name"]}",
         breadcrumbs: [
           { "cmd" => "wiq rosters list --location #{location["id"]}",
             "description" => "Rosters at this location" },
           { "cmd" => "wiq wrestlers list --location #{location["id"]}",
             "description" => "Wrestlers on any roster at this location" }
         ])
end