lib/ppds/tumblr.rb in grumblr-2.3.1 vs lib/ppds/tumblr.rb in grumblr-2.3.3
- old
+ new
@@ -2,17 +2,40 @@
require 'rest_client'
require 'xml'
module Ppds
class User < ClassFactory
- attr_accessor :default_post_format, :can_upload_audio, :can_upload_aiff,
- :can_upload_video, :vimeo_login_url, :max_video_bytes_uploaded
+ attr_accessor :can_ask_question,
+ :can_upload_aiff,
+ :can_upload_audio,
+ :can_upload_video,
+ :default_post_format,
+ :liked_post_count,
+ :max_video_bytes_uploaded,
+ :vimeo_login_url
end
class Blog < ClassFactory
- attr_accessor :type, :title, :name, :url, :avatar_url,
- :is_primary, :private_id
+ attr_accessor :avatar_url,
+ :backup_post_limit,
+ :draft_count,
+ :followers,
+ :is_admin,
+ :is_primary,
+ :messages_count,
+ :name,
+ :posts,
+ :private_id,
+ :queue_count,
+ :title,
+ :twitter_enabled,
+ :type,
+ :url,
+ # with include-theme=1:
+ :description,
+ :custom_css,
+ :theme_source
end
class Tumblr
attr_accessor :user, :blogs
@@ -21,21 +44,21 @@
'link' => ['url'],
'chat' => ['conversation'],
'quote' => ['quote'],
'photo' => [],
'video' => [],
- 'audio' => ['data']
+ 'audio' => []
}
CONCURENT_FIELDS = {
'text' => [],
'link' => [],
'chat' => [],
'quote' => [],
'photo' => ['source', 'data'],
'video' => ['embed', 'data'],
- 'audio' => []
+ 'audio' => ['data', 'externally-hosted-url']
}
OPTIONAL_FIELDS = {
'text' => ['title'],
'link' => ['name', 'description'],
@@ -54,9 +77,10 @@
end
def query(action, data)
raise 'Cannot authenticate without credentials' unless data[:email] and data[:password]
response = RestClient.post(API_URL + action, data)
+ dump(response) if DEBUG
response.to_str
rescue RestClient::RequestFailed => e
raise 'Query failed: %s' % e.response.body
rescue RestClient::RequestTimeout
raise 'Timeout occured'