Module: InstagramGraphApi::Client::Discovery
- Included in:
- InstagramGraphApi::Client
- Defined in:
- lib/instagram_graph_api/client/discovery.rb
Instance Method Summary collapse
- #discover_user(username, fields = nil) ⇒ Object
- #discover_user_media(username, fields = nil, options = {}) ⇒ Object
Instance Method Details
#discover_user(username, fields = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/instagram_graph_api/client/discovery.rb', line 4 def discover_user(username, fields = nil) fields ||= "id,followers_count,media_count,ig_id" bg_id = get_business_account_id raise "No business-account found, you need to have atleast one IG business-account" unless bg_id query = "?fields=business_discovery.username(#{username}){#{fields}}" get_connections(bg_id, query) rescue Exception => e puts e. end |
#discover_user_media(username, fields = nil, options = {}) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/instagram_graph_api/client/discovery.rb', line 14 def discover_user_media(username, fields = nil, ={}) fields ||= "caption,media_url,media_type,like_count,comments_count,id" = ".after(#{['after']})" if ["after"] = ".after(#{['before']})" if ["before"] discover_user(username, "media#{}{#{fields}}") end |