Class: YiffSpace::Images::Banner::Discord
- Defined in:
- lib/yiffspace/images/banner/discord.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id) ⇒ Discord
constructor
A new instance of Discord.
- #update(hash) ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(id) ⇒ Discord
Returns a new instance of Discord.
11 12 13 |
# File 'lib/yiffspace/images/banner/discord.rb', line 11 def initialize(id) super(id, self.class.type) end |
Class Method Details
.type ⇒ Object
9 |
# File 'lib/yiffspace/images/banner/discord.rb', line 9 def self.type = :discord |
Instance Method Details
#update(hash) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/yiffspace/images/banner/discord.rb', line 19 def update(hash) raise(StandardError, "images.update_token config option must be set to use banner update") if YiffSpace.config.images.update_token.blank? response = HTTParty.post("#{YiffSpace.config.images.server_url}/banner/discord/update/#{id}", YiffSpace.config.images..deep_merge( headers: { "Authorization" => "Bearer #{YiffSpace.config.images.update_token}", "Content-Type" => "application/json", }, body: { hash: hash }.to_json, )) Rails.logger.error("banner update failed: #{response.to_json}") unless response.key?("updated") response.fetch("updated", false) end |