Class: HatenablogPublisher::Photolife

Inherits:
Object
  • Object
show all
Includes:
RequestLogger
Defined in:
lib/hatenablog_publisher/photolife.rb

Constant Summary collapse

ENDPOINT =
'https://f.hatena.ne.jp'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RequestLogger

#log, #with_logging_request

Constructor Details

#initializePhotolife

Returns a new instance of Photolife.



11
12
13
# File 'lib/hatenablog_publisher/photolife.rb', line 11

def initialize
  @client = HatenablogPublisher::Api.new(ENDPOINT)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/hatenablog_publisher/photolife.rb', line 7

def client
  @client
end

Instance Method Details

#upload(image) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/hatenablog_publisher/photolife.rb', line 15

def upload(image)
  body = format_body(image)

  res = with_logging_request(image.title, body) do
    @client.request('/atom/post', body)
  end

  parse_response(res.body)
end