instagram_api_client 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +64 -4
- data/instagram_api.gemspec +2 -2
- data/lib/instagram_api/common.rb +2 -1
- data/lib/instagram_api/location.rb +5 -0
- data/lib/instagram_api/tag.rb +4 -0
- data/lib/instagram_api/user.rb +4 -0
- data/lib/instagram_api/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 887baccb0b7d3120a0ee92699dcd921b4c570b72
|
4
|
+
data.tar.gz: 814b97dfe0ed9fa03a0288083eca1d9ab40d3619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4914cbf47863676d499ed7cc7373cab55fef640358d0d2c6abcca69112d7459a639557cb0e1a711f23cdce7cc6249d51b6925c27704d03635f0330a5b107e582
|
7
|
+
data.tar.gz: bf86c1804a3e89fe4028413354dd88d303f811746bcdd6954e1deed75b2ab38d520051917ff29fb60b6e4b79045a8f4ae46b4f3ca94763881915de9cf0e2997f
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://github.com/agilie/
|
1
|
+
[](https://github.com/agilie/instagram_api_gem)
|
2
2
|
|
3
3
|
# InstagramApi
|
4
4
|
|
@@ -8,7 +8,7 @@ You can see the api endpoints here https://www.instagram.com/developer/endpoints
|
|
8
8
|
## Installation
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
gem install
|
11
|
+
gem install instagram_api_client
|
12
12
|
```
|
13
13
|
|
14
14
|
## Usage
|
@@ -26,6 +26,66 @@ As for now Instagram access token doesn't change or expire, so you can use this
|
|
26
26
|
to generate it http://services.chrisriversdesign.com/instagram-token/
|
27
27
|
I the nearest future the OAuth authorization for access token fetching will be implemented.
|
28
28
|
|
29
|
+
The main module of the gem is `InstagramAPI`. It provides a series of methods, regarding each Instagram resource. They are:
|
30
|
+
`Users`, `Media`, `Comments`, `Likes`, `Tags` and `Locations`. So the `Users` resource methods can be accessed by `InstagramAPI.user`
|
31
|
+
method, `Tags` by `InstagramAPI.tag` and so on.
|
32
|
+
|
33
|
+
The main methods of each resource are `show`, `index`, `create`, `destroy` and `search`. The methods and API endpoints
|
34
|
+
correspondence is as follows
|
35
|
+
|
36
|
+
| | |
|
37
|
+
| -------- | ----- |
|
38
|
+
| **User Resource** | |
|
39
|
+
| InstagramAPI.user.show | GET /users/self |
|
40
|
+
| InstagramAPI.user(**user_id**).show | GET /users/**user_id** |
|
41
|
+
| InstagramAPI.user.recent_media | GET /users/self/media/recent |
|
42
|
+
| InstagramAPI.user(**user_id**).recent_media | GET /users/**user_id**/media/recent |
|
43
|
+
| InstagramAPI.user.liked_media | GET /users/self/media/liked |
|
44
|
+
| InstagramAPI.user.search(**search_query**) | GET /users/search |
|
45
|
+
| *Relationship Endpoints block* | |
|
46
|
+
| InstagramAPI.user.follows | GET /users/self/follows |
|
47
|
+
| InstagramAPI.user.followed_by | GET /users/self/followed-by |
|
48
|
+
| InstagramAPI.user.requested_by | GET /users/self/requested-by |
|
49
|
+
| InstagramAPI.user.check_relationship(**user_id**) | GET /users/**user_id**/relathionship |
|
50
|
+
| InstagramAPI.user.change_relationship(**user_id**) | POST /users/**user_id**/relathionship |
|
51
|
+
| **Media Resource** | |
|
52
|
+
| InstagramAPI.media(**media_id**).show | GET /media/**media_id** |
|
53
|
+
| InstagramAPI.media.short_code(**short_code**) | GET /media/shortcode/**shortcode** |
|
54
|
+
| InstagramAPI.media.search(**search_query**) | GET /media/search |
|
55
|
+
| *Likes Endpoints block* | |
|
56
|
+
| InstagramAPI.media(media_id).likes | GET /media/**media_id**/likes |
|
57
|
+
| InstagramAPI.media(media_id).add_like | POST /media/**media_id**/likes |
|
58
|
+
| InstagramAPI.media(media_id).delete_like | DELETE /media/**media_id**/likes |
|
59
|
+
| *Comment Endpoints block* | |
|
60
|
+
| InstagramAPI.media(media_id).comments | GET /media/**media_id**/comments |
|
61
|
+
| InstagramAPI.media(media_id).add_comment | POST /media/**media_id**/comments |
|
62
|
+
| InstagramAPI.media(media_id).delete_comment(**comment_id**) | DELETE /media/**media_id**/comments/**comment_id** |
|
63
|
+
| **Tag Resource** | |
|
64
|
+
| InstagramAPI.tag(**tag_name**).show | GET /tags/**tag_name** |
|
65
|
+
| InstagramAPI.tag(**tag_name**).recent_media | GET /tags/**tag_name**/media/recent |
|
66
|
+
| InstagramAPI.tag.search(**search_query**) | GET /tags/search |
|
67
|
+
| **Location Resource** | |
|
68
|
+
| InstagramAPI.location(**location_id**).show | GET /locations/**location_id** |
|
69
|
+
| InstagramAPI.location(**location_id**).recent_media | GET /locations/**location_id**/media/recent |
|
70
|
+
| InstagramAPI.location.search(**search_query**) | GET /locations/search |
|
71
|
+
|
72
|
+
Each method from the list above accepts a hash as a second argument with additional params according to official
|
73
|
+
[instagram developers documentation](https://www.instagram.com/developer/endpoints/) i.e.
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
InstagramAPI.user.search('mell', {count: 10})
|
77
|
+
InstagramAPI.user('my_user_id').recent_media({min_id: '22721881'})
|
78
|
+
```
|
79
|
+
|
80
|
+
Search method can get either a query string or a hash. It depends on API requirements, i.e.
|
81
|
+
```ruby
|
82
|
+
InstagramAPI.user.search('mell')
|
83
|
+
InstagramAPI.location.search({lat: 33.10, lng: 15.40})
|
84
|
+
```
|
85
|
+
|
86
|
+
Response is a `Hashie::Mash` object
|
87
|
+
|
88
|
+
|
29
89
|
## TODOS
|
30
90
|
|
31
91
|
1. OAuth authorization for access token fetching
|
@@ -39,7 +99,7 @@ the solution or create an new issue that we will fix asap. Feel free to contribu
|
|
39
99
|
This project is intended to be a safe, welcoming space for collaboration.
|
40
100
|
|
41
101
|
## Author
|
42
|
-
This gem is open-sourced by [Agilie Team](https://www.agilie.com) ([info@agilie.com](mailto:info@agilie.com))
|
102
|
+
This gem is open-sourced by [Agilie Team](https://www.agilie.com?utm_source=github&utm_medium=referral&utm_campaign=Git_Ruby&utm_term=instagram_api_gem) ([info@agilie.com](mailto:info@agilie.com))
|
43
103
|
|
44
104
|
## Contributor
|
45
105
|
[Sergey Mell](https://github.com/SergeyMell)
|
@@ -52,5 +112,5 @@ We will continue publishing new open-source projects. Stay with us, more updates
|
|
52
112
|
|
53
113
|
## License
|
54
114
|
|
55
|
-
The gem is available as open source under the [MIT](LICENSE.md) License (MIT) Copyright © 2017 [Agilie Team](https://www.agilie.com)
|
115
|
+
The gem is available as open source under the [MIT](LICENSE.md) License (MIT) Copyright © 2017 [Agilie Team](https://www.agilie.com?utm_source=github&utm_medium=referral&utm_campaign=Git_Ruby&utm_term=instagram_api_gem)
|
56
116
|
|
data/instagram_api.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'instagram_api/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'instagram_api_client'
|
8
8
|
spec.version = InstagramApi::VERSION
|
9
|
-
spec.authors = ['
|
10
|
-
spec.email = ['sergey.mell@agilie.com']
|
9
|
+
spec.authors = ['Sergey Mell', 'Agilie Team']
|
10
|
+
spec.email = ['sergey.mell@agilie.com', 'web@agilie.com']
|
11
11
|
|
12
12
|
spec.summary = 'A Ruby wrapper for the Instagram API'
|
13
13
|
spec.description = 'A Ruby wrapper for the Instagram API'
|
data/lib/instagram_api/common.rb
CHANGED
@@ -6,7 +6,8 @@ module InstagramApi
|
|
6
6
|
include Client
|
7
7
|
|
8
8
|
def search(query, options = {})
|
9
|
-
|
9
|
+
options = query.is_a?(Hash) ? options.merge(query) : options.merge(q: query)
|
10
|
+
make_request resource_path('search'), query: options
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
@@ -4,11 +4,16 @@ module InstagramApi
|
|
4
4
|
|
5
5
|
class Location
|
6
6
|
include Search
|
7
|
+
include Resource
|
7
8
|
|
8
9
|
def initialize(location_id = nil)
|
9
10
|
@location_id = location_id
|
10
11
|
end
|
11
12
|
|
13
|
+
def show
|
14
|
+
super @location_id
|
15
|
+
end
|
16
|
+
|
12
17
|
def recent_media(options = {})
|
13
18
|
index @location_id, 'media/recent', options
|
14
19
|
end
|
data/lib/instagram_api/tag.rb
CHANGED
data/lib/instagram_api/user.rb
CHANGED
@@ -30,6 +30,10 @@ module InstagramApi
|
|
30
30
|
make_request resource_path('self/followed-by'), query: options
|
31
31
|
end
|
32
32
|
|
33
|
+
def requested_by(options = {})
|
34
|
+
make_request resource_path('self/requested-by'), query: options
|
35
|
+
end
|
36
|
+
|
33
37
|
def check_relationship(user_id, options = {})
|
34
38
|
make_request resource_path("#{user_id}/relationship"), query: options
|
35
39
|
end
|
metadata
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instagram_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Sergey Mell
|
8
|
+
- Agilie Team
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
@@ -97,6 +98,7 @@ dependencies:
|
|
97
98
|
description: A Ruby wrapper for the Instagram API
|
98
99
|
email:
|
99
100
|
- sergey.mell@agilie.com
|
101
|
+
- web@agilie.com
|
100
102
|
executables: []
|
101
103
|
extensions: []
|
102
104
|
extra_rdoc_files: []
|