instapi 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/examples/bookmark.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'instapi'
2
2
 
3
3
  # i = Instapi.new('username', 'password')
4
- i = Instapi.new(*ARGV)
4
+ i = Instapi.new(*ARGV).login!
5
5
  i.add('https://github.com/jugyo')
@@ -1,7 +1,7 @@
1
1
  require 'instapi'
2
2
 
3
3
  # i = Instapi.new('username', 'password')
4
- i = Instapi.new(*ARGV)
4
+ i = Instapi.new(*ARGV).login!
5
5
  i.unread.each do |bookmark|
6
6
  p bookmark
7
7
  end
data/lib/instapi.rb CHANGED
@@ -8,15 +8,20 @@ class Instapi
8
8
 
9
9
  def initialize(username, password)
10
10
  @username, @password = username, password
11
+ self
11
12
  end
12
13
 
13
14
  def client
14
15
  return @client if @client
15
16
  @client = HTTPClient.new
16
- @client.post("#{BASE_URL}/user/login", :username => username, :password => password)
17
17
  @client
18
18
  end
19
19
 
20
+ def login!
21
+ client.post("#{BASE_URL}/user/login", :username => username, :password => password)
22
+ self
23
+ end
24
+
20
25
  def add(url, options = {})
21
26
  get('/api/add', {:url => url, :username => username, :password => password}.merge(options))
22
27
  end
@@ -1,3 +1,3 @@
1
1
  class Instapi
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: instapi
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.0
5
+ version: 1.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - jugyo