instagram_graph_api 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9153f06a78e929e20d035b7d31654ab321b7386d173d0d03adb75ed490cdb0cc
4
- data.tar.gz: 0f9c5367c3fc0200877c1454a7820ee786cbe16a95694bfc6a68055190ca1343
3
+ metadata.gz: 15be12b49a31da27c8d3978f2aaebb969091477d1c4d5e1a842dc4b9fd3f7b54
4
+ data.tar.gz: 5a20b15b6abf7dbc84cbccecfaecb7fd9ca46978140e6b548104c6e314d5debf
5
5
  SHA512:
6
- metadata.gz: 1954017b27cf3fa50e6a50a04f64a12cf7edbc689adf0fd6cd59fa0bf3bb8ee19db87154aa2d07dd248afbc1f7c13d36293731535e433c4790ed2c7f2d527e07
7
- data.tar.gz: ed977b4c4742ee3f8af8693e807e526836db551fb20a5359307c09457ace45c448b1c19afd3cd20ce443e50507326f8b1f9c9d25c66f71d20427a587ca2075e1
6
+ metadata.gz: 743679160256cd91df0a4466adea7c5c9bb68c12991c87f855986f758ca9f4de41522fc590b1098beb39fbcfb0419449ca7341963d2996cd98d49380aa180de7
7
+ data.tar.gz: 03daa42f1f38d45dd5d870f658c83ca44cca73dae56a580652a9143f790ef057f6d590b469c33997ca9ff64253317f86c48bf5c18667a4fc9ddaea27fdd818cc
data/README.md CHANGED
@@ -55,6 +55,16 @@ client.discover_user(USERNAME, fields)
55
55
 
56
56
  #discover user media, fields can be "caption,media_url,media_type,like_count,comments_count,id"
57
57
  client.discover_user_media(USERNAME, fields)
58
+
59
+ #Search for a tag,
60
+ client.tag_media(page_token, tag_name)
61
+ #fields can be "media_type,comments_count,like_count,media_url,permalink"
62
+ fields="media_url,permalink"
63
+ client.tag_media(page_token, tag_name, fields)
64
+ #custom edge can be provided, default is 'top_media'
65
+ tag_media = client.tag_media(page_token, tag_name, edge: "recent_media")
66
+ # Note: We can run `tag_media.next_page` to fetch next set of results
67
+ # additional arguent options can also be passed for page params like before/after or any other custom filter
58
68
  ```
59
69
 
60
70
  ## Development
@@ -8,6 +8,6 @@ module InstagramGraphApi
8
8
  include InstagramGraphApi::Client::Users
9
9
  include InstagramGraphApi::Client::Media
10
10
  include InstagramGraphApi::Client::Discovery
11
-
11
+ include InstagramGraphApi::Client::Tag
12
12
  end
13
13
  end
@@ -0,0 +1,21 @@
1
+ module InstagramGraphApi
2
+ class Client
3
+ module Tag
4
+ def tag_media(page_token, tag_name, fields = nil, edge: "top_media", options: {})
5
+ user_id = get_ig_id_from_token(page_token)
6
+ tag_info = graph_call("ig_hashtag_search?user_id=#{user_id}&q=#{tag_name}")[0]
7
+ fields ||= "id,media_type,comments_count,like_count,media_url,permalink"
8
+ query = "#{edge}?user_id=#{user_id}&fields=#{fields}"
9
+ query += options.reduce(""){|s, (k, v)| s+= "&#{k}=#{v}" }
10
+ get_connections(tag_info["id"], query)
11
+ end
12
+
13
+ private
14
+
15
+ def get_ig_id_from_token(token)
16
+ account_info = get_connections('me', "?fields=connected_instagram_account")
17
+ account_info.dig("connected_instagram_account", "id")
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module InstagramGraphApi
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instagram_graph_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rakesh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-09 00:00:00.000000000 Z
11
+ date: 2020-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,6 +88,7 @@ files:
88
88
  - lib/instagram_graph_api/client/discovery.rb
89
89
  - lib/instagram_graph_api/client/insights.rb
90
90
  - lib/instagram_graph_api/client/media.rb
91
+ - lib/instagram_graph_api/client/tag.rb
91
92
  - lib/instagram_graph_api/client/users.rb
92
93
  - lib/instagram_graph_api/version.rb
93
94
  homepage: https://github.com/rakeshpatra/instagram_graph_api