Class: Wiq::Commands::Parents

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

Constant Summary collapse

DEFAULT_PER_PAGE =
20

Instance Method Summary collapse

Methods inherited from Base

exit_on_failure?

Instance Method Details

#listObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/wiq/commands/parents.rb', line 41

def list
  params = build_list_params

  records, total = fetch_index("/api/v1/parents", params, key: "parent_profiles")
  render_index(
    records, total: total,
    summary: "Listed #{records.size} parents#{summary_filters_suffix}.",
    breadcrumbs: [
      { "cmd" => "wiq parents show <id>", "description" => "Drill into one parent" },
      { "cmd" => "wiq billing_profiles show <id> --profile-type ParentProfile",
        "description" => "Billing profile for a parent (admin only)" },
      { "cmd" => "wiq wrestlers list --last-name <name>",
        "description" => "Find the family's wrestlers (parent refs embedded)" }
    ]
  )
end

#show(id) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/wiq/commands/parents.rb', line 72

def show(id)
  params = {}
  params["expand_notification_preferences"] = true if expand_includes?("notification_preferences")
  parent = client.get("/api/v1/parents/#{id}", params)
  render(parent,
         summary: "Parent #{parent["id"]}#{parent["full_name"]}",
         breadcrumbs: [
           { "cmd" => "wiq billing_profiles show #{parent["id"]} --profile-type ParentProfile",
             "description" => "Billing profile for this parent (admin only)" },
           { "cmd" => "wiq wrestlers list --last-name #{parent["last_name"]}",
             "description" => "Likely wrestlers for this family" }
         ])
end