code
stringlengths
1
1.73M
language
stringclasses
1 value
require 'test/unit' require 'lib/smppclient/pdu/enquire_link_resp' require 'lib/smppclient/util/byte_buffer' class TestEnquireLinkResp < MiniTest::Unit::TestCase include SmppClient::Pdu include SmppClient::Util def test_bytes_to_object bb = ByteBuffer.new bb.append_int(16) bb.append_int(0x80000015)...
Ruby
require 'test/unit' require 'lib/smppclient/pdu/command_id' require 'lib/smppclient/pdu/pdu' class TestCommadId < MiniTest::Unit::TestCase include SmppClient::Pdu def test_values assert_equal(0x80000000, CommandId::GENERIC_NACK) assert_equal(0x00000001, CommandId::BIND_RECEIVER) assert_equal(0x800000...
Ruby
require 'test/unit' require_relative 'sample_tlv' require 'lib/smppclient/util/byte_buffer' class TestTlv < MiniTest::Unit::TestCase include SmppClient::Pdu::Tlv include SmppClient::Util def test_bytes_to_object bb = ByteBuffer.new bb.append_short(0x5555) bb.append_short(0x0001) bb.append_byte(...
Ruby
require 'test/unit' require 'lib/smppclient/pdu/tlv/ms_availability_status' require 'lib/smppclient/util/byte_buffer' class TestMsAvailabilityStatus < MiniTest::Unit::TestCase include SmppClient::Pdu::Tlv include SmppClient::Util def test_bytes_to_object bb = ByteBuffer.new bb.append_short(0x0422) ...
Ruby
require 'lib/smppclient/pdu/tlv/tlv' #require_relative 'tag' module SmppClient module Pdu module Tlv # Sample Tlv which value 1 octet int. class SampleTlv < Tlv TAG = 0x5555 attr_reader :value def initialize(arg) if arg.kind_of? ByteBuffer super(ar...
Ruby
require_relative 'sample_tlv' require 'test/unit' require 'lib/smppclient/pdu/tlv/tlv_factory' require 'lib/smppclient/util/byte_buffer' class TestTlvFactory < MiniTest::Unit::TestCase include SmppClient::Util include SmppClient::Pdu::Tlv def test_parse bb = ByteBuffer.new bb.append_short(0x0422) b...
Ruby
require 'test/unit' require 'lib/smppclient/pdu/command_status' class TestCommandStatus < MiniTest::Unit::TestCase include SmppClient::Pdu def test_values assert_equal(0x00000000, CommandStatus::ESME_ROK) assert_equal(0x00000001, CommandStatus::ESME_RINVMSGLEN) assert_equal(0x00000002, CommandStatus:...
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'rake/gempackagetask' task :default => :test # Run tests: rake test ------------------------------------------------------- Rake::TestTask.new do |t| t.libs << "test" t.test_files = FileList['test/**/test*.rb'] end # Generate documen...
Ruby
module SmppClient # Superclass for all SmppClient errors. class SmppClientError < StandardError end end
Ruby
require 'iconv' require_relative '../smpp_client_error' module SmppClient module Util # Converts Ruby types forth and back to protocol types and returns them as hexadecimal byte array. # Before all read_* and remove_* operations check buffer length enough for that operation. All append_* # methods retu...
Ruby
require 'socket' require 'thread' require_relative 'connection' require_relative 'connection_error' require_relative 'connection_closed_error' require_relative '../pdu/pdu_factory' require_relative '../pdu/pdu' require_relative '../util/byte_buffer' module SmppClient module Net # SMPP connection over TCP. ...
Ruby
require_relative 'connection_error' module SmppClient module Net # Operation error cause connection closed.. class ConnectionClosedError < SmppClient::Net::ConnectionError end end end
Ruby
module SmppClient module Net # Abstract SMPP connection. All implementations should be thread safe. class Connection # Default incoming PDUs byte buffer size. DEFAULT_MAX_BUFFER_SIZE = 1000 attr_reader :host, :port attr_accessor :max_buffer_size # SMSC host and port. ...
Ruby
require_relative '../smpp_client_error' module SmppClient module Net # Connection error. class ConnectionError < SmppClient::SmppClientError end end end
Ruby
require_relative 'command_id' require_relative 'command_status' require_relative 'pdu_error' require_relative 'tlv/tlv_factory' require_relative '../util/byte_buffer' module SmppClient module Pdu # Super class for all PDU types. Subclass should override Pdu#body method. # # Note: _command_length_ attri...
Ruby
require_relative 'pdu' module SmppClient module Pdu # BindTransceiver response PDU. class BindTransceiverResp < Pdu attr_accessor :system_id def initialize(byte_buffer = nil) if byte_buffer == nil super(CommandId::BIND_TRANSCEIVER_RESP) @system_id = '' els...
Ruby
require_relative 'pdu' module SmppClient module Pdu # BindReceiver response PDU. class BindReceiverResp < Pdu attr_accessor :system_id def initialize(byte_buffer = nil) if byte_buffer == nil super(CommandId::BIND_RECEIVER_RESP) @system_id = '' else ...
Ruby
require_relative 'pdu' module SmppClient module Pdu # This message can be sent by either the ESME or SMSC and is used to provide a confidence- # check of the communication path between an ESME and an SMSC. On receipt of this request # the receiving party should respond with an enquire_link_resp, thus v...
Ruby
require_relative '../smpp_client_error' module SmppClient module Pdu # PDU error: creation or parsing. class PduError < SmppClient::SmppClientError end end end
Ruby
require_relative 'npi' require_relative 'pdu' require_relative 'ton' module SmppClient module Pdu # An ESME bound as a Receiver is authorised to receive short messages from the SMSC and to # return the corresponding SMPP message responses to the SMSC. class BindReceiver < Pdu attr_accessor :sys...
Ruby
require_relative 'pdu' module SmppClient module Pdu # BindTransmitter response PDU. class BindTransmitterResp < Pdu attr_accessor :system_id def initialize(byte_buffer = nil) if byte_buffer == nil super(CommandId::BIND_TRANSMITTER_RESP) @system_id = '' els...
Ruby
module SmppClient module Pdu module Udh class Udh # todo Implement end end end end
Ruby
require_relative 'npi' require_relative 'pdu' require_relative 'ton' module SmppClient module Pdu # An ESME bound as a Transmitter is authorised to send short messages to the SMSC and to # receive the corresponding SMPP responses from the SMSC. # An ESME indicates its desire not to receive (mobile) ori...
Ruby
module SmppClient module Pdu # PDU command type identificator. module CommandId # This is a generic negative acknowledgement to an SMPP PDU submitted with an invalid # message header. A generic_nack response is returned in the following cases: # * Invalid command_length # If the ...
Ruby
require_relative 'pdu' module SmppClient module Pdu # Unbind response PDU. class UnbindResp < Pdu def initialize(byte_buffer = nil) if byte_buffer == nil super(CommandId::UNBIND_RESP) else super(byte_buffer) end end end end end
Ruby
module SmppClient module Pdu # Type of Number (TON). module Ton UNKNOWN = 0b00000000 INTERNATIONAL = 0b00000001 NATIONAL = 0b00000010 NETWORK_SPECIFIC = 0b00000011 SUBSCRIBER_NUMBER = 0b00000100 ALPHANUMERIC = 0b00000101 ABBREVIATED = 0b00000110 end ...
Ruby
require_relative '../util/byte_buffer' require_relative 'command_id' require_relative 'pdu_error' require_relative 'alert_notification' require_relative 'bind_receiver' require_relative 'bind_receiver_resp' require_relative 'bind_transceiver' require_relative 'bind_transceiver_resp' require_relative 'bind_transmitter' ...
Ruby
require_relative 'pdu' module SmppClient module Pdu # The purpose of the SMPP unbind operation is to deregister an instance of an ESME from the # SMSC and inform the SMSC that the ESME no longer wishes to use this network connection # for the submission or delivery of messages. # Thus, the unbind o...
Ruby
require_relative 'pdu' module SmppClient module Pdu # This message can be sent by either the ESME or SMSC and is used to provide a confidence- # check of the communication path between an ESME and an SMSC. On receipt of this request # the receiving party should respond with an enquire_link_resp, thus v...
Ruby
module SmppClient module Pdu # The CommandStatus field indicates the success or failure of an SMPP request. # It is relevant only in the SMPP response PDU and it must contain a NULL value # in an SMPP request PDU. module CommandStatus # No Error. ESME_ROK = 0x00000000 # Mess...
Ruby
require_relative 'npi' require_relative 'pdu' require_relative 'ton' module SmppClient module Pdu # This message is sent by the SMSC to the ESME, when the SMSC has detected that a particular # mobile subscriber has become available and a delivery pending flag had been set for that # subscriber from a p...
Ruby
require_relative 'tlv_error' require_relative '../../util/byte_buffer' module SmppClient module Pdu module Tlv # Optional Parameters are fields, which may be present in a message. Optional Parameters # provide a mechanism for the future introduction of new parameters, as and when defined in ...
Ruby
module SmppClient module Pdu module Tlv # TLV id. module Tag # The dest_addr_subunit parameter is used to route messages when received # by a mobile station, for example to a smart card in the mobile station or # to an external device connected to the mobile station. ...
Ruby
require_relative '../pdu_error' module SmppClient module Pdu module Tlv # TLV error: creation or parsing. class TlvError < SmppClient::Pdu::PduError end end end end
Ruby
require_relative 'ms_availability_status' require_relative 'tag' require_relative 'tlv_error' module SmppClient module Pdu module Tlv # Parse TLV and control tag to Tlv mapping. module TlvFactory @tags = { Tag::MS_AVAILABILITY_STATUS => MsAvailabilityStatus } ...
Ruby
require_relative 'tlv' require_relative 'tag' module SmppClient module Pdu module Tlv # The message_payload parameter contains the user data. # Value stored as ByteBuffer and accessed directly, cause it very complex.. class MessagePayload < Tlv attr_accessor :value def ini...
Ruby
require_relative 'tlv' require_relative 'tag' module SmppClient module Pdu module Tlv # The ms_availability_status parameter is used in the alert_notification # operation to indicate the availability state of the MS to the ESME. # # If the SMSC does not include the parameter in the ale...
Ruby
require_relative 'npi' require_relative 'pdu' require_relative 'ton' module SmppClient module Pdu # An ESME bound as a Transceiver is allowed to send messages to the SMSC and receive # messages from the SMSC over a single SMPP session. class BindTransceiver < Pdu attr_accessor :system_id, :pass...
Ruby
module SmppClient module Pdu # Numbric Plan Indicator (NPI). module Npi UNKNOWN = 0b00000000 ISDN = 0b00000001 DATA = 0b00000011 TELEX = 0b00000100 LAND_MOBILE = 0b00000110 NATIONAL = 0b00001000 PRIVATE = 0b00001001 ERMES = 0b00001010 INTERNET ...
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person',...
Ruby
# Be sure to restart your server when you modify this file. # These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveReco...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. Act...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying do debug a probl...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.action_controller.consider_all_reque...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # ...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryPr...
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Major.create(:name...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class ActiveSupport::TestCase # Transactional fixtures accelerate your tests by wrapping each test method # in a transaction that's rolled back on completion. This ensures that the # test da...
Ruby
# Simple Jobs # =========== require 'java' java_import Java::MyscheduleQuartzExtraJob::LoggerJob java_import Java::MyscheduleQuartzExtraJob::ScriptingJob java_import Java::MyscheduleQuartzExtra::SchedulerTemplate java_import Java::JavaUtil::Date java_import Java::JavaLang::System # Schedule hourly job scheduler.schedu...
Ruby
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Mayor.create(:name =>...
Ruby
class CreateAppPermissions < ActiveRecord::Migration def self.up create_table :app_permissions do |t| t.references :app t.references :permission t.timestamps end add_index :app_permissions, :app_id add_index :app_permissions, :permission_id end def self.down drop_table :ap...
Ruby
class CreateTargets < ActiveRecord::Migration def self.up create_table :targets do |t| t.string :name t.timestamps end add_index :targets, :name, :unique => true end def self.down drop_table :targets end end
Ruby
class CreateVisuals < ActiveRecord::Migration def self.up create_table :visuals do |t| t.references :app t.timestamps end add_index :visuals, :app_id end def self.down drop_table :visuals end end
Ruby
class CreatePermissions < ActiveRecord::Migration def self.up create_table :permissions do |t| t.string :name t.timestamps end add_index :permissions, :name, :unique => true end def self.down drop_table :permissions end end
Ruby
class CreateComments < ActiveRecord::Migration def self.up create_table :comments do |t| t.integer :rating t.string :creationTime t.string :authorName t.string :text t.string :authorId t.references :app t.timestamps end add_index :comments, :app_id add_index ...
Ruby
class CreateRatings < ActiveRecord::Migration def self.up create_table :ratings do |t| t.string :rating t.integer :ratingCount t.integer :downloadCount t.string :downloadCountText t.references :app t.timestamps end add_index :ratings, :app_id, :unique => true end ...
Ruby
class AddAttachmentImageToVisual < ActiveRecord::Migration def self.up add_column :visuals, :image_file_name, :string add_column :visuals, :image_content_type, :string add_column :visuals, :image_file_size, :integer add_column :visuals, :image_updated_at, :datetime end def self.down remove_co...
Ruby
class CreateVestalVersions < ActiveRecord::Migration def self.up create_table :versions do |t| t.belongs_to :versioned, :polymorphic => true t.belongs_to :user, :polymorphic => true t.string :user_name t.text :modifications t.integer :number t.integer :reverted_from t...
Ruby
class CreateAppTargets < ActiveRecord::Migration def self.up create_table :app_targets do |t| t.references :app t.references :target t.timestamps end add_index :app_targets, :app_id add_index :app_targets, :target_id end def self.down drop_table :app_targets end end
Ruby
class CreateApps < ActiveRecord::Migration def self.up create_table :apps do |t| t.string :creator t.string :packageName t.string :title t.text :description t.string :appId t.string :category t.text :recentChanges t.string :email t.string :phone t.string...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
source 'http://rubygems.org' gem 'rails', '3.0.3' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql2' gem 'paperclip' gem 'will_paginate' gem 'vestal_versions', :git => 'git://github.com/adamcooper/vestal_versions' # Use unicorn as the web server # gem 'unicorn' # D...
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
module ApplicationHelper end
Ruby
module VisualsHelper end
Ruby
module AppPermissionHelper end
Ruby
module AppTargetHelper end
Ruby
module PermissionsHelper end
Ruby