source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry_spec.rb | Ruby | bsd-2-clause | 19 | master | 2,580 | require 'spec_helper'
describe SentryApi do
after { SentryApi.reset }
describe ".client" do
it "should be a SentryApi::Client" do
expect(SentryApi.client).to be_a SentryApi::Client
end
it "should not override each other" do
client1 = SentryApi.client(endpoint: 'https://api1.example.com', ... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/spec_helper.rb | Ruby | bsd-2-clause | 19 | master | 2,396 | require 'rspec'
require 'webmock/rspec'
require File.expand_path('../../lib/sentry-api', __FILE__)
def capture_output
out = StringIO.new
$stdout = out
$stderr = out
yield
$stdout = STDOUT
$stderr = STDERR
out.string
end
def load_fixture(name)
File.new(File.dirname(__FILE__) + "/fixtures/#{name}.json"... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/request_spec.rb | Ruby | bsd-2-clause | 19 | master | 2,108 | require 'spec_helper'
describe SentryApi::Request do
it { should respond_to :get }
it { should respond_to :post }
it { should respond_to :put }
it { should respond_to :delete }
before do
@request = SentryApi::Request.new
end
describe ".default_options" do
it "should have default values" do
... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/paginated_response_spec.rb | Ruby | bsd-2-clause | 19 | master | 2,077 | require 'spec_helper'
describe SentryApi::PaginatedResponse do
before do
array = [1, 2, 3, 4]
@paginated_response = SentryApi::PaginatedResponse.new array
end
it "should respond to *_page and has_*_page methods" do
expect(@paginated_response).to respond_to :next_page
expect(@paginated_response).... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/objectified_hash_spec.rb | Ruby | bsd-2-clause | 19 | master | 1,366 | require 'spec_helper'
describe SentryApi::ObjectifiedHash do
before do
@hash = {a: 1, b: 2, 'string' => 'string', symbol: :symbol}
@oh = SentryApi::ObjectifiedHash.new @hash
end
it "should objectify hash" do
expect(@oh.a).to eq(@hash[:a])
expect(@oh.b).to eq(@hash[:b])
end
describe "#to_has... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/error_spec.rb | Ruby | bsd-2-clause | 19 | master | 1,685 | require "spec_helper"
describe SentryApi::Error do
describe "#handle_message" do
require "stringio"
before do
request_object = HTTParty::Request.new(Net::HTTP::Get, '/')
response_object = Net::HTTPOK.new('1.1', 200, 'OK')
body = StringIO.new("{foo:'bar'}")
def body.message;
... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/page_links_spec.rb | Ruby | bsd-2-clause | 19 | master | 601 | require 'spec_helper'
describe SentryApi::PageLinks do
before do
@page_links = SentryApi::PageLinks.new('Link' => "<http://example.com/api/0/organizations/?&cursor=100:-1:1>; rel=\"previous\"; results=\"false\"; cursor=\"100:-1:1\", <http://example.com/api/0/organizations/?&cursor=100:1:0>; rel=\"next\"; results... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/client/teams_spec.rb | Ruby | bsd-2-clause | 19 | master | 438 | require 'spec_helper'
describe SentryApi::Client do
describe ".team" do
before do
stub_get("/teams/sentry-sc/team-slug/", "team")
@team = SentryApi.team("team-slug")
end
it "should get the correct resource" do
expect(a_get("/teams/sentry-sc/team-slug/")).to have_been_made
end
... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/client/releases_spec.rb | Ruby | bsd-2-clause | 19 | master | 525 | require 'spec_helper'
describe SentryApi::Client do
describe ".release" do
before do
stub_get("/projects/sentry-sc/project-slug/releases/1.0/", "release")
@release = SentryApi.release("project-slug", "1.0")
end
it "should get the correct resource" do
expect(a_get("/projects/sentry-sc/... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/client/projects_spec.rb | Ruby | bsd-2-clause | 19 | master | 6,044 | require 'spec_helper'
describe SentryApi::Client do
describe ".projects" do
before do
stub_get("/projects/", "projects")
@projects = SentryApi.projects
end
it "should get the correct resource" do
expect(a_get("/projects/")).to have_been_made
end
it "should return an array res... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/client/issues_spec.rb | Ruby | bsd-2-clause | 19 | master | 505 | require 'spec_helper'
describe SentryApi::Client do
describe ".issues" do
before do
stub_get("/projects/sentry-sc/project-slug/issues/", "project_issues")
@issues = SentryApi.issues("project-slug")
end
it "should get the correct resource" do
expect(a_get("/projects/sentry-sc/project-s... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/client/organizations_spec.rb | Ruby | bsd-2-clause | 19 | master | 3,328 | require 'spec_helper'
describe SentryApi::Client do
describe ".organizations" do
before do
stub_get("/organizations/?member=false", "organizations")
@organizations = SentryApi.organizations
end
it "should get the correct resource" do
expect(a_get("/organizations/?member=false")).to ha... |
github | thierryxing/sentry-ruby-api | https://github.com/thierryxing/sentry-ruby-api | spec/sentry-api/client/events_spec.rb | Ruby | bsd-2-clause | 19 | master | 3,080 | require 'spec_helper'
describe SentryApi::Client do
describe ".issue" do
before do
stub_get("/issues/1/", "issue")
@issue = SentryApi.issue("1")
end
it "should get the correct resource" do
expect(a_get("/issues/1/")).to have_been_made
end
it "should return a response of issue... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/bond.rb | Ruby | apache-2.0 | 19 | master | 762 | $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
require "rubygems"
require 'json'
require 'utils'
def bond_pattern_filter(content)
result = []
needle = 'Slave Interface'
content.split("\n").each do |line|
if line.start_with?(needle)
result.push(line.split('... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/cpu_core_count.rb | Ruby | apache-2.0 | 19 | master | 910 | $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
require "rubygems"
require 'utils'
Facter.add(:cpu_core_count) do
confine :kernel => 'Linux'
setcode do
Facter.value(:processorcount)
end
end
Facter.add(:cpu_core_count) do
confine :kernel => 'windows'
setcode... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/raid_adaptor_count.rb | Ruby | apache-2.0 | 19 | master | 1,839 | $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
require "rubygems"
require 'json'
#require_relative 'utils'
require 'utils'
def hpcli_get_raid_adaptor_count(cmd)
response = 0
output = Utils.facter_exec(cmd)
if not output.empty?
output.split("\n").each do ... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/nic_info.rb | Ruby | apache-2.0 | 19 | master | 7,165 | # encoding: utf-8
require "rubygems"
require 'json'
def more_ip_plan_for_win(nic_name,nic)
nic_name_count = 0
new_nic_name = nic_name
while nic.has_key?(new_nic_name)
new_nic_name = new_nic_name.split(":")[0] + ":" + nic_name_count.to_s
nic_name_count += 1
end
nic[new_nic_name] = {}
nic[new_nic_nam... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/sn.rb | Ruby | apache-2.0 | 19 | master | 652 | # -*- encoding : utf-8 -*-
require 'rbconfig'
require 'rubygems'
def win_sn
output = `wmic bios get serialnumber /VALUE`
sn = ''
output.split("\n").each do |line|
if line.start_with?("SerialNumber")
sn = line.split("=")[1]
break
end
end
return sn
end
def linux_sn
sn = ''
output = `d... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/setup_time.rb | Ruby | apache-2.0 | 19 | master | 606 | require "rubygems"
Facter.add(:setuptime) do
confine :kernel => 'Linux'
setcode do
setuptime_file = '/root/anaconda-ks.cfg'
file = File.open(setuptime_file)
if not File.exist?(setuptime_file)
setuptime = ""
else
setuptime = file.stat.ctime.to_i
end
end
end
Facte... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/raid_type.rb | Ruby | apache-2.0 | 19 | master | 2,090 | $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
require "rubygems"
require 'json'
require 'utils'
#require_relative 'utils'
def mega_raid_type_pattern_match(needle)
grep_pattern = ['RAID Level']
grep_pattern.each do |pattern|
return true if needle.start_with?(patte... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/ram.rb | Ruby | apache-2.0 | 19 | master | 2,468 | $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
require "rubygems"
require 'pp'
require 'json'
require 'utils'
def dmi_get_ram(cmd)
ram_slot = []
key_map = {
'Size' => 'capacity',
'Serial Number' => 'sn',
'Type' => 'model',
'Manufa... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/disk.rb | Ruby | apache-2.0 | 19 | master | 7,905 | $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
require "rubygems"
require 'pp'
require 'json'
#require_relative 'utils'
require 'utils'
def mega_patter_match(needle)
grep_pattern = ['Adapter', 'Slot', 'Raw Size', 'Inquiry', 'PD Type', 'Enclosure Device ID']
grep_patte... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/utils.rb | Ruby | apache-2.0 | 19 | master | 1,021 | require "rubygems"
module Utils
def self.get_facter_version
version = Facter.value('facterversion')
major = version.split('.')[0]
return major.to_i
end
def self.facter_exec(cmd)
result = ''
if Utils.get_facter_version < 2
result = Facter::Util::Resolution.exec(cmd)
else
resu... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/facter/raid_adaptor.rb | Ruby | apache-2.0 | 19 | master | 3,302 | $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
require "rubygems"
require 'json'
#require_relative 'utils'
require 'utils'
def merge_response(left, right)
response = {}
left.each do |k, v|
response[k] = left[k].merge(right[k]) if right.has_key?(k)
end
return r... |
github | AutohomeCorp/Assets_Report | https://github.com/AutohomeCorp/Assets_Report | assets_report/lib/puppet/reports/assets_report.rb | Ruby | apache-2.0 | 19 | master | 8,518 | $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
require "rubygems"
require 'puppet'
require 'puppet/network/http_pool'
require 'uri'
require 'yaml'
require 'pathname'
require 'json'
require 'net/http'
require 'pp'
require 'auth'
Puppet::Reports.register_report(:assets_repo... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | Rakefile | Ruby | mit | 19 | master | 241 | require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rake/testtask"
task :default => [:test]
task :test do
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = "spec/**/*_spec.rb"
end
Rake::Task["spec"].execute
end |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | responsys-api.gemspec | Ruby | mit | 19 | master | 1,885 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = "responsys-api"
spec.version = "0.3.2"
spec.authors = ["Dan DeMeyere", "Florian Lorrain", "Morgan Griggs", "Mike Rocco"]
spec.emai... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/member_spec.rb | Ruby | mit | 19 | master | 4,706 | require "spec_helper.rb"
describe Responsys::Member do
before(:all) do
@email = DATA[:users][:user1][:EMAIL_ADDRESS]
@riid = DATA[:users][:user1][:RIID]
@list = Responsys::Api::Object::InteractObject.new(DATA[:folder],DATA[:lists][:list1][:name])
end
context "New member" do
before(:each) do
... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/helper_spec.rb | Ruby | mit | 19 | master | 2,538 | # encoding: UTF-8
require "spec_helper.rb"
describe Responsys::Helper do
context "Get i18n messages" do
let(:message_key) { "member.record_not_found" }
let(:message_key_thredup) { "thredup" }
it "should get a message present in the en yml file" do
I18n.locale = :en
expect(Responsys::Helpe... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/configuration_spec.rb | Ruby | mit | 19 | master | 3,934 | # encoding: UTF-8
require "spec_helper.rb"
describe Responsys::Configuration do
def valid_configuration
Responsys.configure do |config|
config.settings = {
wsdl: "http://file.wsdl",
username: "username",
password: "password",
debug: false
}
end
end
def valid_... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/spec_helper.rb | Ruby | mit | 19 | master | 1,787 | require "coveralls"
Coveralls.wear!
require "bundler/setup"
Bundler.setup
require "responsys_api.rb"
require "vcr"
require "yaml"
require "pathname"
if File.exist?("#{File.dirname(__FILE__)}/api_credentials.yml")
CREDENTIALS = YAML.load_file("#{File.dirname(__FILE__)}/api_credentials.yml")
else
CREDENTIALS = YAM... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/api/session_spec.rb | Ruby | mit | 19 | master | 1,750 | require "spec_helper.rb"
describe Responsys::Api::Session do
context "Authentication" do
let(:savon_client) { double("savon client") }
let(:credentials) { { username: CREDENTIALS["username"], password: CREDENTIALS["password"] } }
it "should set the credentials" do
expect(subject.credentials).to eq... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/api/campaign_spec.rb | Ruby | mit | 19 | master | 3,635 | require "spec_helper.rb"
require "responsys/api/client"
describe Responsys::Api::Campaign do
let(:list) { Responsys::Api::Object::InteractObject.new(DATA[:folder], DATA[:lists][:list1][:name]) }
let(:campaign) { Responsys::Api::Object::InteractObject.new(DATA[:folder], DATA[:campaigns][:campaign1][:name]) }
let(... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/api/client_spec.rb | Ruby | mit | 19 | master | 1,165 | require "spec_helper.rb"
describe Responsys::Api::Client do
describe "Authentication methods" do
it "should refuse the access to api_method for logout" do
expect{ subject.api_method(:logout) }.to raise_error("Please use the dedicated logout method")
end
it "should refuse the access to api_metho... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/api/table_spec.rb | Ruby | mit | 19 | master | 5,379 | require "spec_helper.rb"
describe Responsys::Api::Table do
before(:example) do
@profile_extension = Responsys::Api::Object::InteractObject.new(DATA[:folder], DATA[:pets][:pet1][:name])
@query_column_riid = Responsys::Api::Object::QueryColumn.new("RIID")
@fields = %w(RIID_ MONTHLY_PURCH)
@user_riid =... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/api/list_spec.rb | Ruby | mit | 19 | master | 2,798 | require "spec_helper.rb"
describe Responsys::Api::List do
before(:context) do
@list = Responsys::Api::Object::InteractObject.new(DATA[:folder], DATA[:lists][:list1][:name])
@query_column_email = Responsys::Api::Object::QueryColumn.new("EMAIL_ADDRESS")
@multiple_users_email = [DATA[:users][:user1][:EMAIL... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/api/object/recipient_data_spec.rb | Ruby | mit | 19 | master | 1,223 | require "spec_helper.rb"
require "responsys/api/client"
describe Responsys::Api::Object::RecipientData do
context "new RecipientData" do
before(:each) do
@recipient = Responsys::Api::Object::Recipient.new
@recipient_data = Responsys::Api::Object::RecipientData.new(@recipient)
end
it "sho... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/api/object/custom_event_spec.rb | Ruby | mit | 19 | master | 706 | require "spec_helper.rb"
describe Responsys::Api::Object::CustomEvent do
context "#intialize" do
it "should raise an exception if there is no event identifier present" do
expect{ Responsys::Api::Object::CustomEvent.new("") }.to raise_exception(Responsys::Exceptions::ParameterException, "The event_name or e... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/api/object/recipient_spec.rb | Ruby | mit | 19 | master | 1,846 | require "spec_helper.rb"
require "responsys/api/client"
describe Responsys::Api::Object::Recipient do
context "new recipient" do
before(:each) do
@recipient = Responsys::Api::Object::Recipient.new
end
it "should have list_name attribute of type InteractObject" do
expect(@recipient.list_na... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | spec/api/object/record_data_spec.rb | Ruby | mit | 19 | master | 1,045 | require "spec_helper.rb"
describe Responsys::Api::Object::RecordData do
context "Constructor params handling" do
before(:each) do
@data = [{ field1: "value11", field2: "value12" }, { field2: "value22", field3: "value23" }]
@field_names = [:field1, :field2, :field3]
@record1 = ["value11", "val... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys_api.rb | Ruby | mit | 19 | master | 458 | require "i18n"
require "connection_pool"
require "savon"
I18n.load_path.concat Dir.glob( File.dirname(__FILE__) + "/responsys/i18n/*.yml" )
require "responsys/monkey_patches"
require "responsys/exceptions"
require "responsys/helper"
require "responsys/configuration"
require "responsys/api/all"
require "responsys/api/... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/member.rb | Ruby | mit | 19 | master | 4,254 | require "responsys/api/all"
require "responsys/api/object/all"
module Responsys
class Member
include Responsys::Api
include Responsys::Api::Object
attr_accessor :email, :user_riid, :client
def initialize(email, riid = nil)
@email = email
@user_riid = riid
end
def add_to_list(lis... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/exceptions.rb | Ruby | mit | 19 | master | 561 | module Responsys
module Exceptions
class BaseException < Exception
def initialize(message_key = nil)
if message_key.nil?
super
else
super(Responsys::Helper.get_message(message_key))
end
end
end
class ParameterException < Responsys::Exceptions::BaseE... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/monkey_patches.rb | Ruby | mit | 19 | master | 318 | module Responsys
module MonkeyPatches
module Object
def blank?
respond_to?(:empty?) ? empty? : !self
end unless method_defined?(:blank?)
def present?
!blank?
end unless method_defined?(:present?)
end
end
end
Object.send :include, Responsys::MonkeyPatches::Object |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/configuration.rb | Ruby | mit | 19 | master | 2,742 | module Responsys
class Configuration
attr_accessor :settings
def initialize
@settings = {}
end
def savon_settings
settings_hash = if @settings[:wsdl].present?
{ wsdl: @settings[:wsdl] }
else
{
endpoint: @settings[:endpoint],
namespace: @settings[... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/helper.rb | Ruby | mit | 19 | master | 3,865 | module Responsys
module Helper
def self.format_response_result(response, action)
response.body[("#{action}_response").to_sym][:result]
end
def self.format_response_hash(response, action)
formatted_response = { status: "ok" }
return formatted_response unless response.body.has_key? "#{ac... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/all.rb | Ruby | mit | 19 | master | 417 | require "responsys/api/authentication"
require "responsys/api/folder"
require "responsys/api/list"
require "responsys/api/table"
require "responsys/api/campaign"
module Responsys
module Api
module All
include Responsys::Api::Authentication
include Responsys::Api::Folder
include Responsys::Api::... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/campaign.rb | Ruby | mit | 19 | master | 1,305 | require "responsys/api/object/all"
module Responsys
module Api
module Campaign
include Responsys::Exceptions
def trigger_custom_event(custom_event, recipients)
raise ParameterException.new("api.campaign.incorrect_recipients_type") unless recipients.is_a? Array
raise ParameterExceptio... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/session_pool.rb | Ruby | mit | 19 | master | 658 | require "singleton"
module Responsys
module Api
class SessionPool
include Singleton
attr_accessor :pool
ACCEPTED_SETTINGS = [:timeout, :size]
class << self
alias :init :instance
end
def initialize
settings = Responsys.configuration.settings[:sessions]
... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/table.rb | Ruby | mit | 19 | master | 1,996 | module Responsys
module Api
module Table
def create_table(interact_object, fields)
api_method(:create_table, { table: interact_object.to_api, fields: fields.map(&:to_api) })
end
def create_table_with_pk(interact_object, fields, primary_keys)
api_method(:create_table_with_pk, { t... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/folder.rb | Ruby | mit | 19 | master | 490 | module Responsys
module Api
module Folder
def list_folders
api_method(:list_folders)
end
def create_folder(name)
api_method(:create_folder, { :folderName => name })
end
def delete_folder(name)
api_method(:delete_folder, { :folderName => name })
end
... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/client.rb | Ruby | mit | 19 | master | 1,901 | module Responsys
module Api
class Client
include Responsys::Api::All
include Responsys::Exceptions
attr_accessor :client
#TODO allows to keep the use of .instance. The client is no longer a singleton so it needs to be removed in a newer release.
class << self
alias :instance... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/authentication.rb | Ruby | mit | 19 | master | 1,056 | module Responsys
module Api
module Authentication
def login
logout if logged_in?
response = run(:login, credentials)
establish_session_id(response)
establish_jsession_id(response)
set_session_credentials
end
def logout
return unless logged_in?
... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/session.rb | Ruby | mit | 19 | master | 665 | module Responsys
module Api
class Session
attr_accessor :credentials, :session_id, :jsession_id, :header
include Responsys::Api::Authentication
def initialize
global_configuration = Responsys.configuration
@credentials = global_configuration.api_credentials
@savon_clien... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/list.rb | Ruby | mit | 19 | master | 1,056 | require "responsys/api/object/all"
module Responsys
module Api
module List
include Responsys::Api::Object
def retrieve_list_members(interact_object, query_column, field_list, ids_to_retrieve)
message = {
list: interact_object.to_api,
queryColumn: query_column.to_api,
... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/record_data.rb | Ruby | mit | 19 | master | 895 | module Responsys
module Api
module Object
class RecordData
include Responsys::Exceptions
include Responsys::Api::Object
attr_accessor :field_names, :records
def initialize(data)
raise ParameterException.new("api.object.record_data.incorrect_record_data_type") unles... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/list_merge_rule.rb | Ruby | mit | 19 | master | 1,863 | module Responsys
module Api
module Object
class ListMergeRule
attr_accessor :insert_on_no_match, :update_on_match, :match_column_name1, :match_column_name2, :match_column_name3, :match_operator, :optin_value, :optout_value, :html_value, :text_value, :reject_record_if_channel_empty, :default_permissi... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/recipient_data.rb | Ruby | mit | 19 | master | 485 | module Responsys
module Api
module Object
class RecipientData
attr_accessor :recipient, :optional_data
def initialize(recipient, optional_data = [Responsys::Api::Object::OptionalData.new])
@recipient = recipient
@optional_data = optional_data
end
def to_... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/record.rb | Ruby | mit | 19 | master | 477 | module Responsys
module Api
module Object
class Record
include Responsys::Exceptions
attr_accessor :field_values
def initialize(field_values)
raise ParameterException, Responsys::Helper.get_message("api.object.record.incorrect_field_values_type") unless field_values.is_a? ... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/optional_data.rb | Ruby | mit | 19 | master | 563 | module Responsys
module Api
module Object
class OptionalData
include Responsys::Exceptions
attr_accessor :name, :value
def initialize(name = "", value = "")
raise ParameterException, Responsys::Helper.get_message("api.object.optional_data.incorrect_optional_data_type") unl... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/field.rb | Ruby | mit | 19 | master | 585 | module Responsys
module Api
module Object
class Field
attr_accessor :field_name, :field_type, :custom, :data_extraction_key
def initialize(field_name, field_type, custom = false, data_extraction_key = false)
@field_name = field_name
@field_type = field_type
@c... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/custom_event.rb | Ruby | mit | 19 | master | 1,082 | module Responsys
module Api
module Object
class CustomEvent
include Responsys::Exceptions
attr_accessor :event_name, :event_id, :event_string_data_mapping, :event_number_data_mapping, :event_date_data_mapping
def initialize(event_name="", event_id="", options={})
raise Par... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/recipient.rb | Ruby | mit | 19 | master | 978 | module Responsys
module Api
module Object
class Recipient
include Responsys::Api::Object
attr_accessor :list_name, :recipient_id, :customer_id, :email_address, :mobile_number, :email_format
def initialize(options = {})
@list_name = options[:listName] || InteractObject.new(... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/interact_object.rb | Ruby | mit | 19 | master | 384 | module Responsys
module Api
module Object
class InteractObject
attr_accessor :folder_name, :object_name
def initialize(folder_name, object_name)
@folder_name = folder_name
@object_name = object_name
end
def to_api
{ folderName: @folder_name, ob... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/all.rb | Ruby | mit | 19 | master | 517 | require "responsys/api/object/interact_object"
require "responsys/api/object/list_merge_rule"
require "responsys/api/object/record"
require "responsys/api/object/record_data"
require "responsys/api/object/field"
require "responsys/api/object/field_type"
require "responsys/api/object/query_column"
require "responsys/api... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/field_type.rb | Ruby | mit | 19 | master | 583 | module Responsys
module Api
module Object
class FieldType
include Responsys::Exceptions
attr_accessor :field_type_string
FIELD_TYPES = %w(STR500 STR4000 NUMBER TIMESTAMP INTEGER)
def initialize(field_type)
if FIELD_TYPES.include? field_type
@field_type_... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/query_column.rb | Ruby | mit | 19 | master | 628 | module Responsys
module Api
module Object
class QueryColumn
include Responsys::Exceptions
attr_accessor :query_column_string
AVAILABLE_QUERY_COLUMN = %w(RIID CUSTOMER_ID EMAIL_ADDRESS MOBILE_NUMBER)
def initialize(query_column)
if AVAILABLE_QUERY_COLUMN.include? qu... |
github | dandemeyere/responsys-api | https://github.com/dandemeyere/responsys-api | lib/responsys/api/object/email_format.rb | Ruby | mit | 19 | master | 650 | module Responsys
module Api
module Object
class EmailFormat
include Responsys::Api::Object
attr_accessor :email_format_string
AVAILABLE_EMAIL_FORMAT = %w(TEXT_FORMAT HTML_FORMAT NO_FORMAT MULTIPART_FORMAT)
def initialize(email_format = "NO_FORMAT")
if AVAILABLE_EMA... |
github | unkn0wnh4ckr/venom | https://github.com/unkn0wnh4ckr/venom | venom.rb | Ruby | apache-2.0 | 19 | master | 17,318 | system("service postgresql start")
system("service tor start")
system("printf '\033]2;VEN0M FRAMEWORK | @tuf_unkn0wn\a'")
system("clear")
require 'socket'
def mainbanner()
print """\e[31m
██╗ ██╗███████╗███╗ ██╗ ██████╗ ███╗ ███╗
██║ ██║██╔════╝████╗ ██║██╔═══██╗████╗ ████║
██║ ██║█████╗ ██╔██╗ ██║██║ ██... |
github | unkn0wnh4ckr/venom | https://github.com/unkn0wnh4ckr/venom | venomsecure.rb | Ruby | apache-2.0 | 19 | master | 1,480 | print "--------------------------------------------------------------------------------------------------\n"
print """\e[33m!WELCOME TO THE SECURE VERSION OF VENOM WHAT THIS MEANS IS THAT
THE VENOM FRAMEWORK WILL BE RUN WITH PROXYCHAINS AND OTHER TOOLS MAKING YOU NEAR ANONYMOUS EXITING
THE TERMINAL SHOULD STOP THE PRO... |
github | jqr/typed_serialize | https://github.com/jqr/typed_serialize | typed_serialize.gemspec | Ruby | mit | 19 | master | 781 | $:.push File.expand_path("../lib", __FILE__)
require "typed_serialize/version"
Gem::Specification.new do |s|
s.name = "typed_serialize"
s.version = TypedSerialize::VERSION
s.authors = ["Elijah Miller"]
s.email = %q{elijah.miller@gmail.com}
s.summary = %q{Typed serialize mak... |
github | jqr/typed_serialize | https://github.com/jqr/typed_serialize | spec/schema.rb | Ruby | mit | 19 | master | 347 | ActiveRecord::Schema.define(:version => 0) do
create_table :mice, :force => true do |t|
t.text :info
end
end
class Mouse < ActiveRecord::Base
typed_serialize :info, Hash, :price, :color
serialized_accessor :info, :manufacture, :material
serialized_reader :info, :used, :port_type
serialized_writer... |
github | jqr/typed_serialize | https://github.com/jqr/typed_serialize | spec/typed_serialize/typed_serialize_spec.rb | Ruby | mit | 19 | master | 868 | require 'spec_helper'
describe ActiveRecord::Base do
it 'should generate default value' do
mouse = Mouse.new
mouse.info.should == {}
mouse = Mouse.new
mouse.info[:foo] = "master"
mouse.info.should == {:foo=>'master'}
test_hash = {:price=>23, :color=>'Gray', :material=>'Plastic'}
mouse = ... |
github | jqr/typed_serialize | https://github.com/jqr/typed_serialize | lib/typed_serialize.rb | Ruby | mit | 19 | master | 875 | ActiveRecord::Base.instance_eval do
def typed_serialize(attr_name, class_name, *attributes)
serialize(attr_name, class_name)
define_method(attr_name) do
if (value = super()).is_a?(class_name)
value
else
send("#{attr_name}=", class_name.new)
end
end
serialized_access... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | sous_chef.gemspec | Ruby | mit | 19 | master | 867 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/sous_chef/version', __FILE__)
Gem::Specification.new do |gem|
gem.name = "sous_chef"
gem.version = SousChef::VERSION
gem.authors = ["Martin Emde", "Brian Donovan"]
gem.email = ["memde@engineyard.com", "bdonovan... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | spec/spec_helper.rb | Ruby | mit | 19 | master | 305 | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'sous_chef'
require 'spec'
require 'spec/autorun'
Spec::Runner.configure do |config|
def resource(*args, &block)
described_class.new(SousChef::Recipe.new, *args, &block)
end
end |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | spec/recipe_spec.rb | Ruby | mit | 19 | master | 1,494 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe SousChef::Recipe do
context "flags" do
describe "verbose" do
before do
@recipe = SousChef::Recipe.new(:verbose) do
execute "run ls" do
command "ls"
end
end
end
it "is verb... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | spec/sous_spec.rb | Ruby | mit | 19 | master | 6,125 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe SousChef do
describe "execute" do
it "returns a simple command" do
script = SousChef.prep do
execute "run a command" do
command "ls"
end
end
script.should == "ls\n"
end
it "concatenates... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | spec/resource/gemfile_spec.rb | Ruby | mit | 19 | master | 697 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe SousChef::Resource::Gemfile do
it "uses the name as the path without an explicit path" do
gemfile = resource('/path/to/project/Gemfile')
gemfile.path.should == '/path/to/project/Gemfile'
end
it "uses an explicit path if one is... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | spec/resource/directory_spec.rb | Ruby | mit | 19 | master | 1,397 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe SousChef::Resource::Directory do
before do
@directory = resource("bin") do
end
@directory.to_script # evaluate the block
end
it "has a name" do
@directory.name.should == "bin"
end
it "has a path equal to the name ... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | spec/resource/file_spec.rb | Ruby | mit | 19 | master | 3,717 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe SousChef::Resource::File do
before do
@file = resource("note.txt") do
content "this is a note"
end
@file.setup # evaluate the block
end
it "has a name" do
@file.name.should == "note.txt"
end
it "has a path e... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | spec/resource/execute_spec.rb | Ruby | mit | 19 | master | 532 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe SousChef::Resource::Execute do
it "formats multiline commands that are wrapped in not_if" do
execute = resource("clone sous_chef") do
command <<-EOS
git clone git://github.com/engineyard/sous_chef.git
cd sous_chef
gem bundle
EOS
... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | spec/resource/base_spec.rb | Ruby | mit | 19 | master | 937 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe SousChef::Resource::Base do
before do
@execute = SousChef::Resource::Base.new(nil, "install bundler")
end
it "has a name" do
@execute.name.should == "install bundler"
end
it "responds to a method its context responds to" ... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | lib/sous_chef/resource.rb | Ruby | mit | 19 | master | 259 | module SousChef
module Resource
end
end
require 'sous_chef/resource/base'
require 'sous_chef/resource/directory'
require 'sous_chef/resource/execute'
require 'sous_chef/resource/file'
require 'sous_chef/resource/gemfile'
require 'sous_chef/resource/log' |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | lib/sous_chef/recipe.rb | Ruby | mit | 19 | master | 2,632 | module SousChef
class Recipe
attr_accessor :node, :verbose, :shebang
alias_method :verbose?, :verbose
alias_method :shebang?, :shebang
def initialize(*flags, &block)
flags.each {|flag| __send__("#{flag}=", true)}
@resources = []
@block = block
end
def self.load(file)
... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | lib/sous_chef/resource/file.rb | Ruby | mit | 19 | master | 1,129 | module SousChef
module Resource
class File < Directory
def content(content=nil)
set_or_return(:content, content && content.to_s)
end
protected
def escaped_content
content
end
def create
not_if file_exist_command unless forced?
comma... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | lib/sous_chef/resource/base.rb | Ruby | mit | 19 | master | 1,554 | module SousChef
module Resource
class Base
attr_reader :name
def initialize(context, name, &block)
@context = context
@name = name
@block = block
@only_if = nil
@commands = []
end
def setup
if @block
instance_eval &@block
... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | lib/sous_chef/resource/log.rb | Ruby | mit | 19 | master | 850 | module SousChef
module Resource
class Log < Base
def initialize(context, name=nil, &block)
super
@stdout = nil
@stderr = nil
end
def stdout(stdout=nil)
set_or_return(:stdout, stdout)
end
def stderr(stderr=nil)
set_or_return(:stderr, stderr)
... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | lib/sous_chef/resource/gemfile.rb | Ruby | mit | 19 | master | 1,277 | require 'stringio'
module SousChef
module Resource
class Gemfile < File
def initialize(context, name, &block)
super
@gems = []
@sources = []
end
def gem(name, version=nil)
@gems << [name, version]
end
def source(url)
@sources << url
en... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | lib/sous_chef/resource/directory.rb | Ruby | mit | 19 | master | 1,290 | module SousChef
module Resource
class Directory < Base
ACTIONS = %w[create delete]
def initialize(*args)
action :create
force false
super
end
def path(path=nil)
set_or_return(:path, path) || name
end
def mode(mode=nil)
set_or_return(:m... |
github | engineyard/sous_chef | https://github.com/engineyard/sous_chef | lib/sous_chef/resource/execute.rb | Ruby | mit | 19 | master | 644 | module SousChef
module Resource
class Execute < Base
def initialize(context, name=nil, &block)
super
@cwd = nil
end
def to_script
@script ||= begin
setup
prepend %{cd #{escape_path(@cwd)}} if @cwd
@commands = @commands.inject([]) do |result... |
github | vesan/omnifocus-pivotaltracker | https://github.com/vesan/omnifocus-pivotaltracker | omnifocus-pivotaltracker.gemspec | Ruby | mit | 19 | master | 870 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/omnifocus/pivotaltracker/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Vesa Vänskä"]
gem.email = ["vesa@vesavanska.com"]
gem.description = %q{Plugin for omnifocus gem to provide Pivotal Tracker BTS synchronization.}
... |
github | vesan/omnifocus-pivotaltracker | https://github.com/vesan/omnifocus-pivotaltracker | lib/omnifocus/pivotaltracker.rb | Ruby | mit | 19 | master | 2,141 | require "open-uri"
require "json"
require "yaml"
require "cgi"
module OmniFocus::Pivotaltracker
PREFIX = "PT"
def load_or_create_config
path = File.expand_path "~/.omnifocus-pivotaltracker.yml"
config = YAML.load(File.read(path)) rescue nil
unless config then
config = { :token => "TOKEN, get... |
github | 58bits/partial-date | https://github.com/58bits/partial-date | partial-date.gemspec | Ruby | mit | 19 | master | 1,117 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/partial-date/version', __FILE__)
Gem::Specification.new do |gem|
gem.name = "partial-date"
gem.version = PartialDate::VERSION
gem.summary = %q{A simple date class that can be used to store partial date values in a single column/attr... |
github | 58bits/partial-date | https://github.com/58bits/partial-date | Rakefile | Ruby | mit | 19 | master | 963 | # encoding: utf-8
require 'rubygems'
require 'rake'
# Benchmark setup inspired by https://github.com/stonean/slim
# Call 'rake benchmark iterations=10000' to set iterations
desc 'Run PartialDate benchmarks (default iterations=1000)'
task :benchmark, :iterations do
ruby('benchmarks/run-benchmarks.rb')
end
begin
g... |
github | 58bits/partial-date | https://github.com/58bits/partial-date | benchmarks/run-perftools.rb | Ruby | mit | 19 | master | 1,124 | #!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'), File.dirname(__FILE__))
require 'perftools'
require 'partial-date'
require 'date'
class PartialDateCPUProfile
def initialize(iterations)
@tmp_dir = File.expand_path('../tmp', __FILE__)
Dir.mkdir @tmp_dir unless Dir.exists? @tmp_... |
github | 58bits/partial-date | https://github.com/58bits/partial-date | benchmarks/run-benchmarks.rb | Ruby | mit | 19 | master | 1,850 | #!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'), File.dirname(__FILE__))
require 'partial-date'
require 'benchmark'
require 'date'
class PartialDateBenchmarks
def initialize(iterations)
@iterations = (iterations || 10000).to_i
@benches = []
stdlib_date = Date.new(2012,... |
github | 58bits/partial-date | https://github.com/58bits/partial-date | benchmarks/run-gcprof.rb | Ruby | mit | 19 | master | 1,278 | #!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'), File.dirname(__FILE__))
require 'partial-date'
require 'date'
class PartialDateMemoryProfile
def initialize(iterations)
@tmp_dir = File.expand_path('../tmp', __FILE__)
Dir.mkdir @tmp_dir unless Dir.exists? @tmp_dir
@iterat... |
github | 58bits/partial-date | https://github.com/58bits/partial-date | lib/partial-date/date.rb | Ruby | mit | 19 | master | 12,991 | # Public module containing Date, Error and Version types.
module PartialDate
# Key:
# The first 5 bits are the day (max 31)
# The next 4 bits are the month (max 12)
# The next 20 bits are the year (max 1048576)
# The most significant bit (MSB) is a 1 bit sign bit (for negative years).
DAY_MASK ... |
github | 58bits/partial-date | https://github.com/58bits/partial-date | lib/partial-date/error.rb | Ruby | mit | 19 | master | 205 | module PartialDate
class PartialDateError < StandardError
end
class YearError < PartialDateError
end
class MonthError < PartialDateError
end
class DayError < PartialDateError
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.