Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 55 lines (35 sloc) 1.624 kb
a4278ff @mislav gem install instagram
authored
1 # [Instagram][] Ruby library
0d89980 @mislav Instagram is ours
authored
2
a4278ff @mislav gem install instagram
authored
3 This library acts as a client for the [unofficial Instagram API][wiki]. It was used to create [the missing Instagram web interface][web].
0d89980 @mislav Instagram is ours
authored
4
a4278ff @mislav gem install instagram
authored
5 $ gem install instagram
6
7 With it, you can:
0d89980 @mislav Instagram is ours
authored
8
9 * fetch popular photos;
10 * get user info;
11 * browse photos by a user.
12
13 Caveat: you need to know user IDs; usernames can't be used. However, you can start from the popular feed and drill down from there.
14
15 ## Example usage
16
17 require 'instagram'
18
19 photos = Instagram::popular
20 photo = photos.first
21
22 photo.caption #=> "Extreme dog closeup"
23 photo.likes.size #=> 54
b0356bf @mislav document `filter_name` and `image_url`
authored
24 photo.filter_name #=> "X-Pro II"
0d89980 @mislav Instagram is ours
authored
25
26 photo.user.username #=> "johndoe"
27 photo.user.full_name #=> "John Doe"
28 photo.comments[1].text #=> "That's so cute"
29 photo.images.last.width #=> 612
30
cd42290 @mislav add helpful comments to models code
authored
31 # available sizes: 150px / 306px / 612px square
b0356bf @mislav document `filter_name` and `image_url`
authored
32 photo.image_url(612)
cd42290 @mislav add helpful comments to models code
authored
33 # => "http://distillery.s3.amazonaws.com/media/-.jpg" (612×612px image)
0d89980 @mislav Instagram is ours
authored
34
35 # fetch extended info for John
36 john_info = Instagram::user_info(photo.user.id)
37
96b01ee @mislav deprecate `User#following`, `#followers`, `#avatar`
authored
38 john_info.media_count #=> 32
39 john_info.follower_count #=> 160
0d89980 @mislav Instagram is ours
authored
40
41
42 # find more photos by John
43 photos_by_john = Instagram::by_user(photo.user.id)
44
cd42290 @mislav add helpful comments to models code
authored
45 To see which models and properties are available, see [models.rb][models].
0d89980 @mislav Instagram is ours
authored
46
47 ## Credits
48
a4278ff @mislav gem install instagram
authored
49 Instagram API documentation and Ruby library written by Mislav Marohnić.
0d89980 @mislav Instagram is ours
authored
50
51
52 [instagram]: http://instagr.am/
a4278ff @mislav gem install instagram
authored
53 [web]: http://instagram.heroku.com
cd42290 @mislav add helpful comments to models code
authored
54 [wiki]: https://github.com/mislav/instagram/wiki "Instagram API"
55 [models]: https://github.com/mislav/instagram/blob/master/lib/instagram/models.rb
Something went wrong with that request. Please try again.