Class: HatenablogPublisher::Photolife
- Inherits:
-
Object
- Object
- HatenablogPublisher::Photolife
- Includes:
- RequestLogger
- Defined in:
- lib/hatenablog_publisher/photolife.rb
Constant Summary collapse
- ENDPOINT =
'https://f.hatena.ne.jp'.freeze
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize ⇒ Photolife
constructor
A new instance of Photolife.
- #upload(image) ⇒ Object
Methods included from RequestLogger
Constructor Details
#initialize ⇒ Photolife
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
#client ⇒ Object (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 |