From 62098418d684632de068a21399bbe3840fa155ae Mon Sep 17 00:00:00 2001 From: stve Date: Sat, 14 Feb 2015 00:25:29 -0500 Subject: [PATCH] remove connection_options --- lib/instapaper/client.rb | 6 +----- lib/instapaper/error.rb | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/lib/instapaper/client.rb b/lib/instapaper/client.rb index 0bda158..9c1a59e 100644 --- a/lib/instapaper/client.rb +++ b/lib/instapaper/client.rb @@ -17,7 +17,7 @@ module Instapaper :oauth_token_secret, :proxy, :user_agent, - :connection_options].freeze + ].freeze # By default, don't set an application key DEFAULT_CONSUMER_KEY = nil @@ -40,8 +40,6 @@ module Instapaper # The user agent that will be sent to the API endpoint if none is set DEFAULT_USER_AGENT = "Instapaper Ruby Gem #{Instapaper::VERSION}".freeze - DEFAULT_CONNECTION_OPTIONS = {} - # @private attr_accessor :consumer_key attr_accessor :consumer_secret @@ -50,7 +48,6 @@ module Instapaper attr_accessor :oauth_token_secret attr_accessor :proxy attr_accessor :user_agent - attr_accessor :connection_options # Creates a new Instapaper::Client def initialize(options = {}) @@ -97,7 +94,6 @@ module Instapaper @oauth_token_secret = DEFAULT_OAUTH_TOKEN_SECRET @proxy = DEFAULT_PROXY @user_agent = DEFAULT_USER_AGENT - @connection_options = DEFAULT_CONNECTION_OPTIONS end end end diff --git a/lib/instapaper/error.rb b/lib/instapaper/error.rb index 28593e2..7707189 100644 --- a/lib/instapaper/error.rb +++ b/lib/instapaper/error.rb @@ -1,4 +1,43 @@ module Instapaper + # Custom error class for rescuing from all Instapaper errors class Error < StandardError + # @return [Integer] + attr_reader :code + +# RateLimitExceeded = Class.new(self) +# PremiumAccountRequired = Class.new(self) +# SuspendedApplication = Class.new(self) +# +# # 1040: Rate-limit exceeded +# # 1041: Premium account required +# # 1042: Application is suspended +# +# BookmarkError = Class.new(self) +# +# Bookmark errors: +# +# 1220: Domain requires full content to be supplied +# 1221: Domain has opted out of Instapaper compatibility +# 1240: Invalid URL specified +# 1241: Invalid or missing bookmark_id +# 1242: Invalid or missing folder_id +# 1243: Invalid or missing progress +# 1244: Invalid or missing progress_timestamp +# 1245: Private bookmarks require supplied content +# 1250: Unexpected error when saving bookmark +# Folder errors: +# +# 1250: Invalid or missing title +# 1251: User already has a folder with this title +# 1252: Cannot add bookmarks to this folder +# Operational errors: +# +# 1500: Unexpected service error +# 1550: Error generating text version of this URL +# Highlight Errors: +# +# 1600: Cannot create highlight with empty text +# 1601: Duplicate highlight + end end