Sha256: c2c111e86edf0ae5787c098975f99b22275b49fab17750c711c4be5af7a6f732

Contents?: true

Size: 1.65 KB

Versions: 57

Compression:

Stored size: 1.65 KB

Contents

class Topic
  include Mongoid::Document
  include Mongoid::Elasticsearch
  elasticsearch!
  field :name, type: String
  field :place, type: String
  field :gar, type: Array, default: []
  field :has, type: Hash, default: {}


  def self.agg

    Topic.collection.aggregate([

      {
        "$match" => {
          "$or" => [
            {
              "gar" => "hello"
            },
            {
              "name" => "eminem"
            }
          ]
        }
      },
      {
        "$project" => {
           "gar" => {
              "$filter" => {
                 "input" => "$gar",
                 "as" => "gar",
                 "cond" => { "$eq" => [ "$$gar", "hello" ] }
              }
           }
        }
      }  

    ])

  end


  def self.mailgun
		
		##########

		# First, instantiate the Mailgun Client with your API key
		mg_client = Mailgun::Client.new 'key-6263360b078081b625182ff17d7a92fd'

		# Define your message parameters
		message_params =  { from: 'bob@sending_domain.com',
		                    to:   'bhargav.r.raut@gmail.com',
		                    subject: 'The Ruby SDK is awesome!',
		                    text:    'It is really easy to send a message!'
		                  }

		# Send your message through the client
		result = mg_client.send_message('sandboxc0248205473845c3a998e44941ee503e.mailgun.org', message_params).to_h!

		puts result.to_s

  end

  def self.delay
  	message = Auth.configuration.mailer_class.constantize.notification(nil,nil)
  	puts message.class.name
  	puts message.message.class.name
  	message.message_id = "here-is-my-test-message-id"
  	r = message.deliver
  	puts r.class.name
  	puts r.message_id
  end

end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
wordjelly-auth-1.6.0 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.9 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.8 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.7 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.6 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.5 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.4 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.3 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.2 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.1 spec/dummy/app/models/topic.rb
wordjelly-auth-1.5.0 spec/dummy/app/models/topic.rb
wordjelly-auth-1.4.9 spec/dummy/app/models/topic.rb
wordjelly-auth-1.4.8 spec/dummy/app/models/topic.rb
wordjelly-auth-1.4.7 spec/dummy/app/models/topic.rb
wordjelly-auth-1.4.6 spec/dummy/app/models/topic.rb
wordjelly-auth-1.4.5 spec/dummy/app/models/topic.rb
wordjelly-auth-1.4.4 spec/dummy/app/models/topic.rb
wordjelly-auth-1.4.3 spec/dummy/app/models/topic.rb
wordjelly-auth-1.4.2 spec/dummy/app/models/topic.rb
wordjelly-auth-1.4.0 spec/dummy/app/models/topic.rb