instagram_graph_api 0.0.10 → 0.0.11
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9153f06a78e929e20d035b7d31654ab321b7386d173d0d03adb75ed490cdb0cc
|
4
|
+
data.tar.gz: 0f9c5367c3fc0200877c1454a7820ee786cbe16a95694bfc6a68055190ca1343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1954017b27cf3fa50e6a50a04f64a12cf7edbc689adf0fd6cd59fa0bf3bb8ee19db87154aa2d07dd248afbc1f7c13d36293731535e433c4790ed2c7f2d527e07
|
7
|
+
data.tar.gz: ed977b4c4742ee3f8af8693e807e526836db551fb20a5359307c09457ace45c448b1c19afd3cd20ce443e50507326f8b1f9c9d25c66f71d20427a587ca2075e1
|
data/README.md
CHANGED
@@ -25,8 +25,14 @@ client = InstagramGraphApi.client(ACCESS_TOKEN)
|
|
25
25
|
|
26
26
|
#get an arraay of business accounts linked to the access_token
|
27
27
|
client.ig_business_accounts
|
28
|
+
#get an array of connected IG accounts linked to the access_token
|
29
|
+
client.connected_ig_accounts
|
28
30
|
|
29
|
-
#get
|
31
|
+
#to get specific fields from "id,name,biography,ig_id,followers_count,profile_picture_url,username"
|
32
|
+
client.ig_business_accounts("name,followers_count")
|
33
|
+
client.connected_ig_accounts("name,followers_count")
|
34
|
+
|
35
|
+
#get IG business account/ Connected IG account info
|
30
36
|
client.get_account_info(IG_BUSINESS_ID)
|
31
37
|
#to get specific fields
|
32
38
|
fields = "name, biography"
|
@@ -4,6 +4,7 @@ module InstagramGraphApi
|
|
4
4
|
class Client < Koala::Facebook::API
|
5
5
|
Dir[File.expand_path('../client/*.rb', __FILE__)].each{|f| require f}
|
6
6
|
|
7
|
+
include InstagramGraphApi::Client::Insights
|
7
8
|
include InstagramGraphApi::Client::Users
|
8
9
|
include InstagramGraphApi::Client::Media
|
9
10
|
include InstagramGraphApi::Client::Discovery
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module InstagramGraphApi
|
2
|
+
class Client
|
3
|
+
module Insights
|
4
|
+
|
5
|
+
METRIC_HASH = {
|
6
|
+
image: 'impressions,reach',
|
7
|
+
video: 'impressions,reach,video_views',
|
8
|
+
story: 'impressions,replies,reach,taps_forward,taps_back,exits'
|
9
|
+
}
|
10
|
+
|
11
|
+
def insights(object_id, type: "image", metrics: nil)
|
12
|
+
metrics ||= METRIC_HASH[type.to_sym]
|
13
|
+
@raw_insights = get_connections(object_id, "insights?metric=#{metrics}")
|
14
|
+
@raw_insights.reduce({}) do |result, insight_data|
|
15
|
+
result[insight_data["name"]] = insight_data["values"].first["value"]
|
16
|
+
result
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -3,12 +3,6 @@ module InstagramGraphApi
|
|
3
3
|
module Media
|
4
4
|
attr_accessor :media_info, :raw_insights
|
5
5
|
|
6
|
-
METRIC_HASH = {
|
7
|
-
image: 'impressions,reach',
|
8
|
-
video: 'impressions,reach,video_views',
|
9
|
-
story: 'impressions,replies,reach,taps_forward,taps_back,exits'
|
10
|
-
}
|
11
|
-
|
12
6
|
MEDIA_INFO_HASH = {
|
13
7
|
image: "comments_count,like_count,media_type,"\
|
14
8
|
"media_url,permalink,timestamp,thumbnail_url",
|
@@ -32,14 +26,6 @@ module InstagramGraphApi
|
|
32
26
|
get_connections(media_id , "?fields=#{fields}")
|
33
27
|
end
|
34
28
|
|
35
|
-
def insights(media_id, type: "image", metrics: nil)
|
36
|
-
metrics ||= METRIC_HASH[type.to_sym]
|
37
|
-
@raw_insights = get_connections(media_id , "insights?metric=#{metrics}")
|
38
|
-
@raw_insights.reduce({}) do |result, insight_data|
|
39
|
-
result[insight_data["name"]] = insight_data["values"].first["value"]
|
40
|
-
result
|
41
|
-
end
|
42
|
-
end
|
43
29
|
end
|
44
30
|
end
|
45
31
|
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.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rakesh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/instagram_graph_api.rb
|
87
87
|
- lib/instagram_graph_api/client.rb
|
88
88
|
- lib/instagram_graph_api/client/discovery.rb
|
89
|
+
- lib/instagram_graph_api/client/insights.rb
|
89
90
|
- lib/instagram_graph_api/client/media.rb
|
90
91
|
- lib/instagram_graph_api/client/users.rb
|
91
92
|
- lib/instagram_graph_api/version.rb
|
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
|
-
rubygems_version: 3.0.
|
112
|
+
rubygems_version: 3.0.6
|
112
113
|
signing_key:
|
113
114
|
specification_version: 4
|
114
115
|
summary: Instagram Graph API
|