Module: WeebSh::API::Korra

Defined in:
lib/weeb/api/korra.rb

Overview

API endpoints for Korra

Constant Summary collapse

BASE =
'/auto-image'.freeze

Class Method Summary collapse

Class Method Details

.discord_status(interface, query) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/weeb/api/korra.rb', line 12

def discord_status(interface, query)
  WeebSh::API.request(
    :get,
    "#{interface.api_url}#{BASE}/discord-status?#{URI.encode_www_form(query)}",
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.license(interface, title, avatar, badges, widgets) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/weeb/api/korra.rb', line 34

def license(interface, title, avatar, badges, widgets)
  WeebSh::API.request(
    :post,
    "#{interface.api_url}#{BASE}/license",
    {
      title: title,
      avatar: avatar,
      badges: badges,
      widgets: widgets
    }.to_json,
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.love_ship(interface, target1, target2) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/weeb/api/korra.rb', line 63

def love_ship(interface, target1, target2)
  WeebSh::API.request(
    :post,
    "#{interface.api_url}#{BASE}/love-ship",
    {
      targetOne: target1,
      targetTwo: target2
    }.to_json,
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.simple(interface, query) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/weeb/api/korra.rb', line 23

def simple(interface, query)
  WeebSh::API.request(
    :get,
    "#{interface.api_url}#{BASE}/generate?#{URI.encode_www_form(query)}",
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.waifu_insult(interface, url) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/weeb/api/korra.rb', line 51

def waifu_insult(interface, url)
  WeebSh::API.request(
    :post,
    "#{interface.api_url}#{BASE}/waifu-insult",
    { avatar: url }.to_json,
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end