Class: Booru::Client

Inherits:
Object
  • Object
show all
Includes:
API, API::Artist, API::Comment, API::Favorite, API::Note, API::Pool, API::Post, API::Tag, API::User, API::Wiki, Error, Request
Defined in:
lib/booru/client.rb

Direct Known Subclasses

Behoimi, Danbooru, Konachan, Yandere

Constant Summary

Constants included from Request

Request::HEADERS

Instance Method Summary collapse

Methods included from API::Wiki

#create_wiki_page, #destroy_wiki_page, #list_wiki_pages, #lock_wiki_page, #revert_wiki_page, #show_wiki_page, #unlock_wiki_page, #update_wiki_page, #wiki_page_history

Methods included from API::User

#search_users

Methods included from API::Tag

#list_related_tags, #list_tags, #update_tag

Methods included from API::Post

#create_post, #destroy_post, #list_posts, #post_vote, #revert_post_tags, #update_post

Methods included from API::Pool

#add_pool_post, #create_pool, #destroy_pool, #list_pool_posts, #list_pools, #remove_pool_post, #update_pool

Methods included from API::Note

#list_notes, #note_history, #revert_note, #search_notes, #update_note

Methods included from API::Favorite

#list_favorites

Methods included from API::Comment

#create_comment, #destroy_comment, #show_comment

Methods included from API::Artist

#create_artist, #destroy_artist, #list_artists, #update_artist

Methods included from API

#formatted_path, #parse, #query_string

Methods included from Request

#get, #post, #request

Constructor Details

#initialize(user = nil, pass = nil, format = 'json') ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
# File 'lib/booru/client.rb', line 18

def initialize(user=nil, pass=nil, format='json')
  @user = user
  @pass = pass ? hash_password(pass) : nil
  @format = format.to_sym
end

Instance Method Details

#hash_password(pass) ⇒ Object



24
25
26
# File 'lib/booru/client.rb', line 24

def hash_password(pass)
  Digest::SHA1.hexdigest(pass)
end

#url_file_segment(url, md5) ⇒ Object



28
29
30
# File 'lib/booru/client.rb', line 28

def url_file_segment(url, md5)
  CGI.unescape(url)
end