Module: WeebSh::API::Shimakaze

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

Overview

API endpoints for Shimakaze

Constant Summary collapse

BASE =
'/reputation'.freeze

Class Method Summary collapse

Class Method Details

.decrease(interface, bot, user, amount) ⇒ Object


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

def decrease(interface, bot, user, amount)
  WeebSh::API.request(
    :post,
    "#{interface.api_url}#{BASE}/#{bot}/#{user}/decrease",
    {
      decrease: amount
    }.to_json,
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.get(interface, bot, user) ⇒ Object


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

def get(interface, bot, user)
  WeebSh::API.request(
    :get,
    "#{interface.api_url}#{BASE}/#{bot}/#{user}",
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.get_settings(interface) ⇒ Object


79
80
81
82
83
84
85
86
87
88
# File 'lib/weeb/api/shimakaze.rb', line 79

def get_settings(interface)
  WeebSh::API.request(
    :get,
    "#{interface.api_url}#{BASE}/settings",
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.give(interface, bot, from, to) ⇒ Object


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

def give(interface, bot, from, to)
  WeebSh::API.request(
    :post,
    "#{interface.api_url}#{BASE}/#{bot}/#{to}",
    {
      source_user: from
    }.to_json,
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.increase(interface, bot, user, amount) ⇒ Object


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

def increase(interface, bot, user, amount)
  WeebSh::API.request(
    :post,
    "#{interface.api_url}#{BASE}/#{bot}/#{user}/increase",
    {
      increase: amount
    }.to_json,
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.reset(interface, bot, user, reset_cooldown = true) ⇒ Object


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

def reset(interface, bot, user, reset_cooldown = true)
  WeebSh::API.request(
    :post,
    "#{interface.api_url}#{BASE}/#{bot}/#{user}/reset",
    {
      cooldown: reset_cooldown
    }.to_json,
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end

.set_settings(interface, settings) ⇒ Object


90
91
92
93
94
95
96
97
98
99
100
# File 'lib/weeb/api/shimakaze.rb', line 90

def set_settings(interface, settings)
  WeebSh::API.request(
    :post,
    settings.to_json,
    "#{interface.api_url}#{BASE}/settings",
    {
      Authorization: interface.auth,
      'User-Agent': interface.user_agent
    }
  )
end