instapi 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/instapi/version.rb +1 -1
  2. data/lib/instapi.rb +4 -0
  3. metadata +2 -2
@@ -1,3 +1,3 @@
1
1
  class Instapi
2
- VERSION = "1.3.1"
2
+ VERSION = "1.4.0"
3
3
  end
data/lib/instapi.rb CHANGED
@@ -2,6 +2,8 @@ require 'httpclient'
2
2
  require 'nokogiri'
3
3
 
4
4
  class Instapi
5
+ class LoginError < StandardError; end
6
+
5
7
  BASE_URL = "https://www.instapaper.com"
6
8
 
7
9
  attr_reader :username, :password
@@ -14,8 +16,10 @@ class Instapi
14
16
  return @client if @client
15
17
  @client = HTTPClient.new
16
18
  @client.post("#{BASE_URL}/user/login", :username => username, :password => password)
19
+ raise LoginError if @client.cookies.empty?
17
20
  @client
18
21
  end
22
+ alias_method :login!, :client
19
23
 
20
24
  def add(url, options = {})
21
25
  get('/api/add', {:url => url, :username => username, :password => password}.merge(options))
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: instapi
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.1
5
+ version: 1.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - jugyo
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-01-23 00:00:00 Z
13
+ date: 2012-01-25 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httpclient