class Send
Public Class Methods
new(image_url, caption, config, request)
click to toggle source
# File lib/instagram/post.rb, line 10 def initialize(image_url, caption, config, request) @image_url = image_url @caption = caption @config = config @request = request end
post(image_url, caption, config, request)
click to toggle source
# File lib/instagram/post.rb, line 33 def self.post(image_url, caption, config, request) new(image_url, caption, config, request).post end
Public Instance Methods
generate_token()
click to toggle source
# File lib/instagram/post.rb, line 17 def generate_token Instagram::Post::Token.get_access_token(@config, request)[:token] end
post()
click to toggle source
# File lib/instagram/post.rb, line 21 def post token = generate_token ids = Instagram::Post::Account.new(@config, token).generate_id(@image_url, @caption) ids.each do |id| HTTParty.post("https://graph.facebook.com/id/media_publish?access_token=#{token}", :body => { creation_id: id } ) end end