Getting tweets and adding them to array.uniq

Hey, i want to write a program that pulls tweets and saves them in a variable, i guess an array would make sense. I only need the urls of the tweets cause i want to send them to a discourse platform which then embed them automatically.

I have an method which pulls the tweets from twitter:

require 'bundler/setup'
require 'net/http'
require 'uri'
require 'twitter'
module GetTweet
 class Error < StandardError;

 def self.catch_tweets
   client = do |config|
     config.consumer_key = "LULULULULULU"
     config.consumer_secret = "LULULULULU"
     config.access_token = "LULULULUL"
     config.access_token_secret = "LULULULUULU"
   # getting all tweets in a hashmap with "mention" without retweet in option timeframe
   @tweets ="#mysearchrequest -rt", since: "2018-8-27", until: "2018-11-7")
   # put the hashmap into an sorted array
   @sorted_tweets = @tweets.sort_by {|tweet| tweet.created_at}
   # give me every uniq tweet
   @sorted_tweets.uniq.each do |tweet|
     @tweet = tweet
     puts @tweet.full_text

and a method to send tweets to my discourse server

require 'net/http'
require 'uri'
require_relative 'get_tweet'


def self.send_request

  url = URI.parse(INSTANCE_URL)
  request =
  request.set_form_data({'api_username' => API_USERNAME, 'api_key' => API_KEY, 'title' => "Neuer Post", 'topic_id' => 8, 'raw' => "#{tweets}"})
  http =, url.port)
  http.use_ssl = true
  response = http.request(request)

  puts response.code



I want to make it possible that i have one main file which uses both methods to pull the tweets and then send them without pulling everytime the tweets which are already displayed but only the new ones.
I should probably go with an array which only adds the new tweets but i dont know how to achieve that.

I think about something like tweets = and then tweets.push(catch_tweets) which isn´t possible probably … so if anyone has a good idea and can help out

If you need a array with sorted element, Hashes a more logical choice.