Class: Booru::Danbooru

Inherits:
Client
  • Object
show all
Defined in:
lib/booru/client/danbooru.rb

Constant Summary

Constants included from Request

Request::HEADERS

Instance Attribute Summary collapse

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) ⇒ Danbooru

Returns a new instance of Danbooru.



6
7
8
9
10
# File 'lib/booru/client/danbooru.rb', line 6

def initialize(user = nil, pass = nil)
  @host    = "http://danbooru.donmai.us"
  @referer = "http://danbooru.donmai.us"
  super
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



4
5
6
# File 'lib/booru/client/danbooru.rb', line 4

def host
  @host
end

#refererObject

Returns the value of attribute referer.



4
5
6
# File 'lib/booru/client/danbooru.rb', line 4

def referer
  @referer
end

Instance Method Details

#hash_password(pass) ⇒ Object



12
13
14
15
16
17
# File 'lib/booru/client/danbooru.rb', line 12

def hash_password(pass)
  salt = 'choujin-steiner'
  salted_pass = "#{salt}--#{pass}--"
  Digest::SHA1.hexdigest(salted_pass)
  super
end

#url_file_segment(url, md5) ⇒ Object



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

def url_file_segment(url, md5)
  url = url.gsub(/http:\/\/.+\/.+\//, "")
  super
end