Class: Send
- Inherits:
-
Object
- Object
- Send
- Defined in:
- lib/instagram/post.rb
Class Method Summary collapse
Instance Method Summary collapse
- #generate_token ⇒ Object
-
#initialize(image_url, caption, config, request) ⇒ Send
constructor
A new instance of Send.
- #post ⇒ Object
Constructor Details
#initialize(image_url, caption, config, request) ⇒ Send
Returns a new instance of Send.
10 11 12 13 14 15 |
# 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 |
Class Method Details
.post(image_url, caption, config, request) ⇒ Object
33 34 35 |
# File 'lib/instagram/post.rb', line 33 def self.post(image_url, caption, config, request) new(image_url, caption, config, request).post end |
Instance Method Details
#generate_token ⇒ Object
17 18 19 |
# File 'lib/instagram/post.rb', line 17 def generate_token Instagram::Post::Token.get_access_token(@config, request)[:token] end |
#post ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# 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 |