module DDAPI::API
List of methods representing endpoints in Discord Dungeons's API
Constants
- APIBASE
The base URL of the Discord Dungeons REST
API
.- RESBASE
The base URL of the Discord Dungeons Alternate Resources.
Public Instance Methods
all_guild_items(app)
click to toggle source
# File lib/dd-api/api.rb, line 70 def all_guild_items(app) get('all/gitems', app)['data'] end
all_guilds(app)
click to toggle source
# File lib/dd-api/api.rb, line 58 def all_guilds(app) get('all/guilds', app)['data'] end
all_items(app)
click to toggle source
# File lib/dd-api/api.rb, line 66 def all_items(app) get('all/items', app)['data'] end
all_users(app)
click to toggle source
# File lib/dd-api/api.rb, line 62 def all_users(app) get('all/users', app)['data'] end
api_base()
click to toggle source
@return [String] the currently used API
base URL.
# File lib/dd-api/api.rb, line 16 def api_base APIBASE end
get(endpoint, app)
click to toggle source
# File lib/dd-api/api.rb, line 38 def get(endpoint, app) JSON.parse(RestClient.get("#{api_base}/"+endpoint, :'X-Api-Key' => app.api_key, :'User-Agent' => app.user_agent)) end
get_guild(app, id)
click to toggle source
# File lib/dd-api/api.rb, line 46 def get_guild(app, id) get('guild/'+id, app)['data'] end
get_guild_item(app, id)
click to toggle source
# File lib/dd-api/api.rb, line 54 def get_guild_item(app, id) get('gitem/'+id, app)['data'] end
get_item(app, id)
click to toggle source
# File lib/dd-api/api.rb, line 50 def get_item(app, id) get('item/'+id, app)['data'] end
get_user(app, id)
click to toggle source
# File lib/dd-api/api.rb, line 42 def get_user(app, id) get('user/'+id.to_s, app)['user'] end
guild_icon_url(icon)
click to toggle source
Make an item image URL from the item image
# File lib/dd-api/api.rb, line 30 def guild_icon_url(icon) "#{res_base}/twemoji/"+icon.gsub(/\u0026#x/, "").gsub(/[;]/, "").gsub(/\u0026amp/, "-").downcase+".png" end
image_url(image)
click to toggle source
Make an item image URL from the item image
# File lib/dd-api/api.rb, line 26 def image_url(image) "#{res_base}/#{image}" end
res_base()
click to toggle source
@return [String] the currently used resource base URL.
# File lib/dd-api/api.rb, line 21 def res_base RESBASE end
rget(endpoint, api_key, user_agent)
click to toggle source
# File lib/dd-api/api.rb, line 34 def rget(endpoint, api_key, user_agent) JSON.parse(RestClient.get("#{api_base}/"+endpoint, :'X-Api-Key' => api_key, :'User-Agent' => user_agent)) end