Class: DiandianOAuth::API::Interface::BlogAvatar

Inherits:
Base
  • Object
show all
Defined in:
lib/diandian_oauth/api/interface.rb

Overview

BlogInfo

Constant Summary collapse

VALID_SIZES =
%w{57 72 114 144}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#apply, param, params, verb

Class Method Details

.is_valid_size(size) ⇒ Object



183
184
185
# File 'lib/diandian_oauth/api/interface.rb', line 183

def self.is_valid_size size
  VALID_SIZES.include? size.to_s
end

Instance Method Details

#request_url(params = {}) ⇒ Object



173
174
175
176
177
178
179
180
181
# File 'lib/diandian_oauth/api/interface.rb', line 173

def request_url params={}
  path = [self.blog_request_url(params), 'avatar'].join('/')
  size = params[:size]
  if size
    unless BlogAvatar.is_valid_size size
      raise IllegalParamError.new("'#{size}' is illegal")
    end
  end # if
end