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
lineofflight/peddler
https://github.com/lineofflight/peddler
test/support/silence_warnings.rb
Ruby
mit
308
main
525
# frozen_string_literal: true # Silence http-cookie 1.1.6 load-order warnings. # https://github.com/sparklemotion/http-cookie/issues/66 if (spec = Gem.loaded_specs["http-cookie"]) && spec.version.to_s != "1.1.6" raise "http-cookie #{spec.version} loaded; revisit #{__FILE__}" end Warning.singleton_class.prepend(Modu...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/support/feature_helpers.rb
Ruby
mit
308
main
809
# frozen_string_literal: true require_relative "configurable" require_relative "recordable" module FeatureHelpers include Configurable, Recordable def api(grantless: false) access_token = request_access_token(grantless:) api_class.new(aws_region, access_token) end def api_class Object.const_get(...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/support/recordable.rb
Ruby
mit
308
main
1,473
# frozen_string_literal: true require "vcr" require "webmock/minitest" VCR.configure do |c| c.hook_into(:webmock) c.cassette_library_dir = "test/vcr_cassettes" ["client_id", "client_secret", "refresh_token"].each do |param| c.filter_sensitive_data("FILTERED") do |interaction| interaction.request.body...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/notification_test.rb
Ruby
mit
308
main
2,233
# frozen_string_literal: true require "helper" require "generator/notification" module Generator class NotificationTest < Minitest::Test def setup @spec_path = File.join(Generator::Config::BASE_PATH, "selling-partner-api-models/schemas/notifications") @b2b_spec = File.join(@spec_path, "B2bAnyOfferCh...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/report_test.rb
Ruby
mit
308
main
2,019
# frozen_string_literal: true require "helper" require "generator/report" module Generator class ReportTest < Minitest::Test def setup @spec_path = File.join(Generator::Config::BASE_PATH, "selling-partner-api-models/schemas/reports") @account_health_spec = File.join(@spec_path, "accountHealthReport-...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/feed_test.rb
Ruby
mit
308
main
2,484
# frozen_string_literal: true require "helper" require "generator/feed" module Generator class FeedTest < Minitest::Test def setup @spec_path = File.join(Generator::Config::BASE_PATH, "selling-partner-api-models/schemas/feeds") @listings_feed_spec = File.join(@spec_path, "listings-feed-schema-v2.jso...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/api_test.rb
Ruby
mit
308
main
5,785
# frozen_string_literal: true require "helper" require "generator/api" require "tempfile" module Generator class APITest < Minitest::Test def setup @test_spec = { "info" => { "title" => "Test API", "version" => "2024-01-01", "description" => "A test API for testing pu...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/support/schema_helpers_test.rb
Ruby
mit
308
main
7,731
# frozen_string_literal: true require "helper" require "generator/support/schema_helpers" require "generator/resolvers/type_resolver" require "generator/parsers/json_schema_extractor" module Generator class SchemaHelpersTest < Minitest::Test class TestClass include SchemaHelpers attr_reader :schema...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/support/formatter_test.rb
Ruby
mit
308
main
3,669
# frozen_string_literal: true require "helper" require "generator/support/formatter" module Generator class FormatterTest < Minitest::Test include Generator::Formatter def test_split_long_comment_line line = "# This is a very long comment line." expected = "# This is a very\n# long comment line...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/resolvers/api_name_resolver_test.rb
Ruby
mit
308
main
3,428
# frozen_string_literal: true require "helper" require "generator/resolvers/api_name_resolver" module Generator class TestAPINameResolver < Minitest::Test def test_directory_based_naming file = "selling-partner-api-models/models/catalog-items-api-model/catalogItems_2022-04-01.json" resolver = APINam...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/resolvers/type_resolver_test.rb
Ruby
mit
308
main
4,011
# frozen_string_literal: true require "helper" require "generator/resolvers/type_resolver" module Generator class TypeResolverTest < Minitest::Test def test_array_with_ref_to_generated_type specification = { "definitions" => { "Offer" => { "type" => "object", "pro...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/rbs/types_test.rb
Ruby
mit
308
main
2,193
# frozen_string_literal: true require "helper" require "generator/rbs/types" require "generator/builders/type" module Generator module RBS class TypesTest < Minitest::Test API_NAME = "notifications/test_notification" def test_generates_valid_rbs_content type1 = create_mock_type("TypeOne", "...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/parsers/rate_limit_parser_test.rb
Ruby
mit
308
main
2,242
# frozen_string_literal: true require "helper" require "generator/parsers/rate_limit_parser" module Generator class RateLimitParserTest < Minitest::Test def test_parses_standard_rate_limit_table operation = { "operationId" => "getOrder", "description" => "Get order details.\n\n**Usage Plan...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/parsers/path_test.rb
Ruby
mit
308
main
496
# frozen_string_literal: true require "helper" require "generator/parsers/path" module Generator class PathTest < Minitest::Test def test_basic_path_interpolation path = Path.new("/test/{paramName}", {}) assert_equal("/test/\#{percent_encode(param_name)}", path.path) end def test_multiple_...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/builders/type_test.rb
Ruby
mit
308
main
16,183
# frozen_string_literal: true require "helper" require "generator/builders/type" module Generator class TypeTest < Minitest::Test API_NAME = "test_api" def test_simple_type_name definition = { "type" => "object", "properties" => { "name" => { "type" => "string" }, },...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/builders/parameter_builder_test.rb
Ruby
mit
308
main
9,352
# frozen_string_literal: true require "helper" require "generator/builders/parameter_builder" module Generator class ParameterBuilderTest < Minitest::Test def test_basic_parameter_names operation = { "parameters" => [ { "name" => "id", "in" => "path", "required" => true, "type" => "strin...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/builders/operation_test.rb
Ruby
mit
308
main
5,382
# frozen_string_literal: true require "helper" require "generator/builders/operation" module Generator class OperationTest < Minitest::Test def setup @path = Minitest::Mock.new @path.expect(:parameters, []) @path.expect(:has_dynamic_sandbox?, false) @path.expect(:sandbox_only?, false) ...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/builders/response_model_test.rb
Ruby
mit
308
main
2,441
# frozen_string_literal: true require "helper" require "generator/builders/response_model" module Generator class ResponseModelTest < Minitest::Test def test_ref_response_model operation = { "responses" => { "200" => { "schema" => { "$ref" => "#/definitions/GetO...
github
lineofflight/peddler
https://github.com/lineofflight/peddler
test/generator/builders/operation_render_test.rb
Ruby
mit
308
main
4,447
# frozen_string_literal: true require "helper" require "generator/builders/operation" require "generator/parsers/path" module Generator class OperationRenderTest < Minitest::Test def setup @path = Generator::Path.new("/orders/{orderId}", {}) end def test_renders_simple_operation operation_d...
github
pelle/oauth
https://github.com/pelle/oauth
oauth.gemspec
Ruby
mit
308
master
6,405
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{oauth} s.version = "0.4.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rub...
github
pelle/oauth
https://github.com/pelle/oauth
Gemfile
Ruby
mit
308
master
224
source :gemcutter group :development do gem 'jeweler' end group :test do gem 'actionpack', '2.3.8' gem 'mocha', '>=0.9.8' gem 'typhoeus', '>=0.1.13' gem 'em-http-request', "0.2.11" gem 'curb', ">= 0.6.6.0" end
github
pelle/oauth
https://github.com/pelle/oauth
Rakefile
Ruby
mit
308
master
1,255
%w[rubygems rake rake/clean rake/testtask fileutils].each { |f| require f } $LOAD_PATH << File.dirname(__FILE__) + '/lib' require 'oauth' begin require 'jeweler' Jeweler::Tasks.new do |s| s.name = %q{oauth} s.version = OAuth::VERSION s.authors = ["Pelle Braendgaard", "Blaine Cook", "Larry Halff", "Jess...
github
pelle/oauth
https://github.com/pelle/oauth
tasks/website.rake
Ruby
mit
308
master
585
desc 'Generate website files' task :website_generate => :ruby_env do (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt| sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} } end end desc 'Upload website files to rubyforge' task :website_upload do host = "#{rubyforge_usern...
github
pelle/oauth
https://github.com/pelle/oauth
tasks/deployment.rake
Ruby
mit
308
master
1,150
desc 'Release the website and new gem version' task :deploy => [:check_version, :website, :release] do puts "Remember to create SVN tag:" puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " + "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} " put...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth.rb
Ruby
mit
308
master
284
$LOAD_PATH << File.dirname(__FILE__) unless $LOAD_PATH.include?(File.dirname(__FILE__)) module OAuth VERSION = "0.4.3" end require 'oauth/oauth' require 'oauth/core_ext' require 'oauth/client/helper' require 'oauth/signature/hmac/sha1' require 'oauth/request_proxy/mock_request'
github
pelle/oauth
https://github.com/pelle/oauth
lib/digest/hmac.rb
Ruby
mit
308
master
2,142
# = digest/hmac.rb # # An implementation of HMAC keyed-hashing algorithm # # == Overview # # This library adds a method named hmac() to Digest classes, which # creates a Digest class for calculating HMAC digests. # # == Examples # # require 'digest/hmac' # # # one-liner example # puts Digest::HMAC.hexdigest("data...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/cli.rb
Ruby
mit
308
master
12,647
require 'optparse' require 'oauth' module OAuth class CLI SUPPORTED_COMMANDS = { "authorize" => "Obtain an access token and secret for a user", "debug" => "Verbosely generate an OAuth signature", "query" => "Query a protected resource", "sign" => "Generate an OAuth signature"...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/helper.rb
Ruby
mit
308
master
2,864
require 'openssl' require 'base64' module OAuth module Helper extend self # Escape +value+ by URL encoding all non-reserved character. # # See Also: {OAuth core spec version 1.0, section 5.1}[http://oauth.net/core/1.0#rfc.section.5.1] def escape(value) URI::escape(value.to_s, OAuth::RESERV...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/core_ext.rb
Ruby
mit
308
master
408
# these are to backport methods from 1.8.7/1.9.1 to 1.8.6 class Object unless method_defined?(:tap) def tap yield self self end end end class String unless method_defined?(:bytesize) def bytesize self.size end end unless method_defined?(:bytes) def bytes req...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/oauth.rb
Ruby
mit
308
master
513
module OAuth # request tokens are passed between the consumer and the provider out of # band (i.e. callbacks cannot be used), per section 6.1.1 OUT_OF_BAND = "oob" # required parameters, per sections 6.1.1, 6.3.1, and 7 PARAMETERS = %w(oauth_callback oauth_consumer_key oauth_token oauth_signature_method ...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/signature.rb
Ruby
mit
308
master
1,551
module OAuth module Signature # Returns a list of available signature methods def self.available_methods @available_methods ||= {} end # Build a signature from a +request+. # # Raises UnknownSignatureMethod exception if the signature method is unknown. def self.build(request, option...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy.rb
Ruby
mit
308
master
650
module OAuth module RequestProxy def self.available_proxies #:nodoc: @available_proxies ||= {} end def self.proxy(request, options = {}) return request if request.kind_of?(OAuth::RequestProxy::Base) klass = available_proxies[request.class] # Search for possible superclass matche...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/oauth_test_helper.rb
Ruby
mit
308
master
847
require 'action_controller' require 'action_controller/test_process' module OAuth module OAuthTestHelper def mock_incoming_request_with_query(request) incoming = ActionController::TestRequest.new(request.to_hash) incoming.request_uri = request.path incoming.host = request.uri.host incomin...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/server.rb
Ruby
mit
308
master
1,536
require 'oauth/helper' require 'oauth/consumer' module OAuth # This is mainly used to create consumer credentials and can pretty much be ignored if you want to create your own class Server include OAuth::Helper attr_accessor :base_url @@server_paths = { :request_token_path => "/oauth/request_tok...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/consumer.rb
Ruby
mit
308
master
12,443
require 'net/http' require 'net/https' require 'oauth/oauth' require 'oauth/client/net_http' require 'oauth/errors' require 'cgi' module OAuth class Consumer # determine the certificate authority path to verify SSL certs CA_FILES = %w(/etc/ssl/certs/ca-certificates.crt /usr/share/curl/curl-ca-bundle.crt) ...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/token.rb
Ruby
mit
308
master
219
# this exists for backwards-compatibility require 'oauth/tokens/token' require 'oauth/tokens/server_token' require 'oauth/tokens/consumer_token' require 'oauth/tokens/request_token' require 'oauth/tokens/access_token'
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy/em_http_request.rb
Ruby
mit
308
master
1,594
require 'oauth/request_proxy/base' # em-http also uses adddressable so there is no need to require uri. require 'em-http' require 'cgi' module OAuth::RequestProxy::EventMachine class HttpRequest < OAuth::RequestProxy::Base # A Proxy for use when you need to sign EventMachine::HttpClient instances. # It need...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy/rack_request.rb
Ruby
mit
308
master
738
require 'oauth/request_proxy/base' require 'uri' require 'rack' module OAuth::RequestProxy class RackRequest < OAuth::RequestProxy::Base proxies Rack::Request def method request.env["rack.methodoverride.original_method"] || request.request_method end def uri request.url end def...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy/net_http.rb
Ruby
mit
308
master
1,575
require 'oauth/request_proxy/base' require 'net/http' require 'uri' require 'cgi' module OAuth::RequestProxy::Net module HTTP class HTTPRequest < OAuth::RequestProxy::Base proxies ::Net::HTTPRequest def method request.method end def uri options[:uri].to_s end ...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy/action_controller_request.rb
Ruby
mit
308
master
1,650
require 'active_support' require 'action_controller' require 'action_controller/request' require 'uri' module OAuth::RequestProxy class ActionControllerRequest < OAuth::RequestProxy::Base proxies(defined?(ActionController::AbstractRequest) ? ActionController::AbstractRequest : ActionController::Request) def...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy/mock_request.rb
Ruby
mit
308
master
1,115
require 'oauth/request_proxy/base' module OAuth module RequestProxy # RequestProxy for Hashes to facilitate simpler signature creation. # Usage: # request = OAuth::RequestProxy.proxy \ # "method" => "iq", # "uri" => [from, to] * "&", # "parameters" => { # "oauth...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy/base.rb
Ruby
mit
308
master
4,312
require 'oauth/request_proxy' require 'oauth/helper' module OAuth::RequestProxy class Base include OAuth::Helper def self.proxies(klass) OAuth::RequestProxy.available_proxies[klass] = self end attr_accessor :request, :options, :unsigned_parameters def initialize(request, options = {}) ...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy/curb_request.rb
Ruby
mit
308
master
1,380
require 'oauth/request_proxy/base' require 'curb' require 'uri' require 'cgi' module OAuth::RequestProxy::Curl class Easy < OAuth::RequestProxy::Base # Proxy for signing Curl::Easy requests # Usage example: # oauth_params = {:consumer => oauth_consumer, :token => access_token} # req = Curl::Easy.new(...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy/jabber_request.rb
Ruby
mit
308
master
899
require 'xmpp4r' require 'oauth/request_proxy/base' module OAuth module RequestProxy class JabberRequest < OAuth::RequestProxy::Base proxies Jabber::Iq proxies Jabber::Presence proxies Jabber::Message def parameters return @params if @params @params = {} oauth =...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/request_proxy/typhoeus_request.rb
Ruby
mit
308
master
1,415
require 'oauth/request_proxy/base' require 'typhoeus' require 'typhoeus/request' require 'uri' require 'cgi' module OAuth::RequestProxy::Typhoeus class Request < OAuth::RequestProxy::Base # Proxy for signing Typhoeus::Request requests # Usage example: # oauth_params = {:consumer => oauth_consumer, :token...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/signature/sha1.rb
Ruby
mit
308
master
220
require 'oauth/signature/base' require 'digest/sha1' module OAuth::Signature class SHA1 < Base implements 'sha1' digest_class Digest::SHA1 def signature_base_string secret + super end end end
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/signature/plaintext.rb
Ruby
mit
308
master
339
require 'oauth/signature/base' module OAuth::Signature class PLAINTEXT < Base implements 'plaintext' def signature signature_base_string end def ==(cmp_signature) signature.to_s == cmp_signature.to_s end def signature_base_string secret end def secret super...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/signature/base.rb
Ruby
mit
308
master
2,937
require 'oauth/signature' require 'oauth/helper' require 'oauth/request_proxy/base' require 'base64' module OAuth::Signature class Base include OAuth::Helper attr_accessor :options attr_reader :token_secret, :consumer_secret, :request def self.implements(signature_method = nil) return @implem...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/signature/md5.rb
Ruby
mit
308
master
216
require 'oauth/signature/base' require 'digest/md5' module OAuth::Signature class MD5 < Base implements 'md5' digest_class Digest::MD5 def signature_base_string secret + super end end end
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/signature/hmac/base.rb
Ruby
mit
308
master
364
# -*- encoding: utf-8 -*- require 'oauth/signature/base' require 'digest/hmac' module OAuth::Signature::HMAC class Base < OAuth::Signature::Base private def digest self.class.digest_class Object.module_eval("::Digest::#{self.class.digest_klass}") Digest::HMAC.digest(signature_base_string, secret,...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/signature/rsa/sha1.rb
Ruby
mit
308
master
1,147
require 'oauth/signature/base' require 'openssl' module OAuth::Signature::RSA class SHA1 < OAuth::Signature::Base implements 'rsa-sha1' hash_class ::Digest::SHA1 def ==(cmp_signature) public_key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(cmp_signature.is_a?(Array) ? cmp_signature.first : cm...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/client/action_controller_request.rb
Ruby
mit
308
master
1,928
require 'oauth/client/helper' if defined? ActionDispatch require 'oauth/request_proxy/rack_request' require 'action_dispatch/testing/test_process' else require 'oauth/request_proxy/action_controller_request' require 'action_controller/test_process' end module ActionController class Base if defined? Actio...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/client/helper.rb
Ruby
mit
308
master
3,053
require 'oauth/client' require 'oauth/consumer' require 'oauth/helper' require 'oauth/token' require 'oauth/signature/hmac/sha1' module OAuth::Client class Helper include OAuth::Helper def initialize(request, options = {}) @request = request @options = options @options[:signature_method] |...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/client/net_http.rb
Ruby
mit
308
master
4,732
require 'oauth/helper' require 'oauth/client/helper' require 'oauth/request_proxy/net_http' class Net::HTTPRequest include OAuth::Helper attr_reader :oauth_helper # Add the OAuth information to an HTTP request. Depending on the <tt>options[:scheme]</tt> setting # this may add a header, additional query strin...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/client/em_http.rb
Ruby
mit
308
master
4,603
require 'em-http' require 'oauth/helper' require 'oauth/client/helper' require 'oauth/request_proxy/em_http_request' # Extensions for em-http so that we can use consumer.sign! with an EventMachine::HttpClient # instance. This is purely syntactic sugar. class EventMachine::HttpClient attr_reader :oauth_helper # A...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/tokens/request_token.rb
Ruby
mit
308
master
1,090
module OAuth # The RequestToken is used for the initial Request. # This is normally created by the Consumer object. class RequestToken < ConsumerToken # Generate an authorization URL for user authorization def authorize_url(params = nil) params = (params || {}).merge(:oauth_token => self.token) ...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/tokens/token.rb
Ruby
mit
308
master
331
module OAuth # Superclass for the various tokens used by OAuth class Token include OAuth::Helper attr_accessor :token, :secret def initialize(token, secret) @token = token @secret = secret end def to_query "oauth_token=#{escape(token)}&oauth_secret=#{escape(secret)}" end...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/tokens/access_token.rb
Ruby
mit
308
master
2,946
module OAuth # The Access Token is used for the actual "real" web service calls that you perform against the server class AccessToken < ConsumerToken # The less intrusive way. Otherwise, if we are to do it correctly inside consumer, # we need to restructure and touch more methods: request(), sign!(), etc. ...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/tokens/consumer_token.rb
Ruby
mit
308
master
981
module OAuth # Superclass for tokens used by OAuth Clients class ConsumerToken < Token attr_accessor :consumer, :params attr_reader :response def self.from_hash(consumer, hash) token = self.new(consumer, hash[:oauth_token], hash[:oauth_token_secret]) token.params = hash token en...
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/errors/problem.rb
Ruby
mit
308
master
265
module OAuth class Problem < OAuth::Unauthorized attr_reader :problem, :params def initialize(problem, request = nil, params = {}) super(request) @problem = problem @params = params end def to_s problem end end end
github
pelle/oauth
https://github.com/pelle/oauth
lib/oauth/errors/unauthorized.rb
Ruby
mit
308
master
217
module OAuth class Unauthorized < OAuth::Error attr_reader :request def initialize(request = nil) @request = request end def to_s [request.code, request.message] * " " end end end
github
pelle/oauth
https://github.com/pelle/oauth
test/test_em_http_client.rb
Ruby
mit
308
master
3,722
require File.expand_path('../test_helper', __FILE__) begin require 'oauth/client/em_http' rescue LoadError => e warn "! problem loading em-http, skipping these tests: #{e}" return end class EmHttpClientTest < Test::Unit::TestCase def setup @consumer = OAuth::Consumer.new('consumer_key_86cad9', '5888bf0345...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_request_token.rb
Ruby
mit
308
master
1,725
require File.expand_path('../test_helper', __FILE__) class StubbedToken < OAuth::RequestToken define_method :build_authorize_url_promoted do |root_domain, params| build_authorize_url root_domain, params end end class TestRequestToken < Test::Unit::TestCase def setup # setup a fake req. token. mocking Co...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_net_http_client.rb
Ruby
mit
308
master
17,190
require File.expand_path('../test_helper', __FILE__) class NetHTTPClientTest < Test::Unit::TestCase def setup @consumer = OAuth::Consumer.new('consumer_key_86cad9', '5888bf0345e5d237') @token = OAuth::Token.new('token_411a7f', '3196ffd991c8ebdb') @request_uri = URI.parse('http://example.com/test?key=val...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_rack_request_proxy.rb
Ruby
mit
308
master
1,812
require File.expand_path('../test_helper', __FILE__) require 'oauth/request_proxy/rack_request' require 'rack/request' require 'rack/mock' class RackRequestProxyTest < Test::Unit::TestCase def test_that_proxy_simple_get_request_works request = Rack::Request.new(Rack::MockRequest.env_for('http://example.com/test...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_hmac_sha1.rb
Ruby
mit
308
master
1,003
require File.expand_path('../test_helper', __FILE__) class TestSignatureHmacSha1 < Test::Unit::TestCase def test_that_hmac_sha1_implements_hmac_sha1 assert OAuth::Signature.available_methods.include?('hmac-sha1') end def test_that_get_request_from_oauth_test_cases_produces_matching_signature request = N...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_action_controller_request_proxy.rb
Ruby
mit
308
master
4,764
gem 'actionpack', '2.3.8' require File.expand_path('../test_helper', __FILE__) require 'oauth/request_proxy/action_controller_request' require 'action_controller/test_process' class ActionControllerRequestProxyTest < Test::Unit::TestCase def request_proxy(request_method = :get, uri_params = {}, body_params = {}) ...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_signature.rb
Ruby
mit
308
master
676
# -*- encoding: utf-8 -*- require File.expand_path('../test_helper', __FILE__) class TestOauth < Test::Unit::TestCase def test_parameter_escaping_kcode_invariant ruby19 = RUBY_VERSION =~ /^1\.9/ old = $KCODE if !ruby19 begin %w(n N e E s S u U).each do |kcode| $KCODE = kcode if !ruby19 ...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_em_http_request_proxy.rb
Ruby
mit
308
master
5,968
require File.expand_path('../test_helper', __FILE__) begin require 'em-http' require 'oauth/request_proxy/em_http_request' rescue LoadError => e warn "! problem loading em-http, skipping these tests: #{e}" return end class EmHttpRequestProxyTest < Test::Unit::TestCase def test_request_proxy_works_with_sim...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_typhoeus_request_proxy.rb
Ruby
mit
308
master
3,531
require File.expand_path('../test_helper', __FILE__) begin require 'oauth/request_proxy/typhoeus_request' require 'typhoeus' rescue LoadError => e warn "! problem loading typhoeus, skipping these tests: #{e}" return end class TyphoeusRequestProxyTest < Test::Unit::TestCase def test_that_proxy_simple_get_r...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_net_http_request_proxy.rb
Ruby
mit
308
master
3,169
require File.expand_path('../test_helper', __FILE__) class NetHTTPRequestProxyTest < Test::Unit::TestCase def test_that_proxy_simple_get_request_works request = Net::HTTP::Get.new('/test?key=value') request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test?key=value'}) expect...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_helper.rb
Ruby
mit
308
master
570
require 'test/unit' require 'rubygems' $LOAD_PATH << File.dirname(__FILE__) + '/../lib/' require 'oauth' require 'mocha' require 'stringio' class Test::Unit::TestCase def assert_matching_headers(expected, actual) # transform into sorted arrays auth_intro, auth_params = actual.split(' ', 2) assert_equal...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_token.rb
Ruby
mit
308
master
311
require File.expand_path('../test_helper', __FILE__) require 'oauth/token' class TestToken < Test::Unit::TestCase def setup end def test_token_constructor_produces_valid_token token = OAuth::Token.new('xyz', '123') assert_equal 'xyz', token.token assert_equal '123', token.secret end end
github
pelle/oauth
https://github.com/pelle/oauth
test/test_curb_request_proxy.rb
Ruby
mit
308
master
3,114
require File.expand_path('../test_helper', __FILE__) begin require 'oauth/request_proxy/curb_request' require 'curb' rescue LoadError => e warn "! problems loading curb, skipping these tests: #{e}" return end class CurbRequestProxyTest < Test::Unit::TestCase def test_that_proxy_simple_get_request_works ...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_oauth_helper.rb
Ruby
mit
308
master
1,715
require File.expand_path('../test_helper', __FILE__) class TestOAuthHelper < Test::Unit::TestCase def test_parse_valid_header header = 'OAuth ' \ 'realm="http://example.com/method", ' \ 'oauth_consumer_key="vince_clortho", ' \ 'oauth_token="token_value", ' \ '...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_consumer.rb
Ruby
mit
308
master
6,381
require File.expand_path('../test_helper', __FILE__) require 'mocha' require 'stringio' # This performs testing against Andy Smith's test server http://term.ie/oauth/example/ # Thanks Andy. # This also means you have to be online to be able to run these. class ConsumerTest < Test::Unit::TestCase def setup @cons...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_access_token.rb
Ruby
mit
308
master
755
require File.expand_path('../test_helper', __FILE__) class TestAccessToken < Test::Unit::TestCase def setup @fake_response = { :user_id => 5734758743895, :oauth_token => "key", :oauth_token_secret => "secret" } # setup a fake req. token. mocking Consumer would be more appropriate... ...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_signature_base.rb
Ruby
mit
308
master
843
require File.expand_path('../test_helper', __FILE__) require 'oauth/signature/base' require 'net/http' class SignatureBaseTest < Test::Unit::TestCase def test_that_initialize_requires_one_request_argument assert_raises ArgumentError do OAuth::Signature::Base.new() end end def test_that_initialize_...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_server.rb
Ruby
mit
308
master
1,496
require File.expand_path('../test_helper', __FILE__) require 'oauth/server' class ServerTest < Test::Unit::TestCase def setup @server=OAuth::Server.new "http://test.com" end def test_default_paths assert_equal "/oauth/request_token",@server.request_token_path assert_equal "/oauth/authorize",@server.a...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_signature_plain_text.rb
Ruby
mit
308
master
1,764
require File.expand_path('../test_helper', __FILE__) require 'oauth/signature/plaintext' class TestSignaturePlaintext < Test::Unit::TestCase def test_that_plaintext_implements_plaintext assert OAuth::Signature.available_methods.include?('plaintext') end def test_that_get_request_from_oauth_test_cases_produc...
github
pelle/oauth
https://github.com/pelle/oauth
test/test_rsa_sha1.rb
Ruby
mit
308
master
3,830
require File.expand_path('../test_helper', __FILE__) require 'oauth/consumer' require 'oauth/signature/rsa/sha1' class TestSignatureRsaSha1 < Test::Unit::TestCase def setup @request = Net::HTTP::Get.new('/photos?file=vacaction.jpg&size=original&oauth_version=1.0&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_timesta...
github
pelle/oauth
https://github.com/pelle/oauth
test/cases/oauth_case.rb
Ruby
mit
308
master
463
require 'test/unit' require 'oauth/signature' require 'oauth/request_proxy/mock_request' class OAuthCase < Test::Unit::TestCase # avoid whining about a lack of tests def run(*args) return if @method_name.to_s == "default_test" super end protected # Creates a fake request def request(params={},me...
github
pelle/oauth
https://github.com/pelle/oauth
test/cases/spec/1_0-final/test_normalize_request_parameters.rb
Ruby
mit
308
master
2,963
require File.expand_path('../../../oauth_case', __FILE__) # See http://oauth.net/core/1.0/#anchor14 # # 9.1.1. Normalize Request Parameters # # The request parameters are collected, sorted and concatenated into a normalized string: # # Parameters in the OAuth HTTP Authorization header excluding the realm parameter. #...
github
pelle/oauth
https://github.com/pelle/oauth
test/cases/spec/1_0-final/test_parameter_encodings.rb
Ruby
mit
308
master
2,132
require File.expand_path('../../../oauth_case', __FILE__) # See http://oauth.net/core/1.0/#encoding_parameters # # 5.1. Parameter Encoding # # All parameter names and values are escaped using the [RFC3986] percent-encoding (%xx) mechanism. # Characters not in the unreserved character set ([RFC3986] section 2.3) MUST ...
github
pelle/oauth
https://github.com/pelle/oauth
test/cases/spec/1_0-final/test_signature_base_strings.rb
Ruby
mit
308
master
2,906
require File.expand_path('../../../oauth_case', __FILE__) # See http://oauth.net/core/1.0/#anchor14 # # 9.1. Signature Base String # # The Signature Base String is a consistent reproducible concatenation of the request elements # into a single string. The string is used as an input in hashing or signing algorithms. T...
github
pelle/oauth
https://github.com/pelle/oauth
test/cases/spec/1_0-final/test_construct_request_url.rb
Ruby
mit
308
master
2,463
require File.expand_path('../../../oauth_case', __FILE__) # See http://oauth.net/core/1.0/#anchor14 # #9.1.2. Construct Request URL # #The Signature Base String includes the request absolute URL, tying the signature to a specific endpoint. The URL used in the Signature Base String MUST include the scheme, authority, ...
github
pelle/oauth
https://github.com/pelle/oauth
test/integration/consumer_test.rb
Ruby
mit
308
master
14,888
require File.expand_path('../../test_helper', __FILE__) module Integration class ConsumerTest < Test::Unit::TestCase def setup @consumer=OAuth::Consumer.new( 'consumer_key_86cad9', '5888bf0345e5d237', { :site=>"http://blabla.bla", :proxy=>"http://user:password@proxy....
github
pelle/oauth
https://github.com/pelle/oauth
examples/yql.rb
Ruby
mit
308
master
1,168
#!/usr/bin/env ruby -rubygems # Sample queries: # ./yql.rb --consumer-key <key> --consumer-secret <secret> "show tables" # ./yql.rb --consumer-key <key> --consumer-secret <secret> "select * from flickr.photos.search where text='Cat' limit 10" require 'oauth' require 'optparse' require 'json' require 'pp' options =...
github
mmangino/mogli
https://github.com/mmangino/mogli
mogli.gemspec
Ruby
mit
308
master
731
spec = Gem::Specification.new do |s| s.name = 'mogli' s.version = '0.0.46' s.summary = 'Open Graph Library for Ruby' s.description = 'Simple library for accessing the Facebook Open Graph API' s.files = Dir['lib/**/*.rb'] s.test_files = Dir['spec/**/*.rb'] s.require_path = 'lib' s.author = 'Mike Mangino'...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/authenticator_spec.rb
Ruby
mit
308
master
4,176
require "spec_helper" describe Mogli::Authenticator do let :authenticator do Mogli::Authenticator.new("123456","secret","http://example.com/url") end it "has the client id" do authenticator.client_id.should == "123456" end it "has the secret" do authenticator.secret.should == "secret" end i...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/user_spec.rb
Ruby
mit
308
master
4,226
require "spec_helper" describe Mogli::User do let :user_1 do user_1 = Mogli::User.new(:id=>1) user_1.client = mock_client user_1 end let :mock_client do mock("client") end it "won't recognize pages" do Mogli::User.recognize?("id"=>1,"name"=>"bob","category"=>"fdhsjkfsd") end it "w...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/client_spec.rb
Ruby
mit
308
master
17,424
require "spec_helper" describe Mogli::Client do let :client do Mogli::Client.new end describe "default options" do it "set 'accept' and 'content-type' headers" do headers = Mogli::Client.default_options[:headers] headers.should_not be_nil headers.should include("Accept") header...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/app_client_spec.rb
Ruby
mit
308
master
1,996
require "spec_helper" describe Mogli::AppClient do describe "subscribing" do let :client do a=Mogli::AppClient.new('key') a.application_id="123" a end it "should allow you to subscribe with callback url, fields and verify token" do Mogli::Client.should_receive(:post).with("htt...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/profile_spec.rb
Ruby
mit
308
master
590
require "spec_helper" describe Mogli::Profile do it "has an image_url" do profile = Mogli::Profile.new profile.id="1" profile.image_url.should == "https://graph.facebook.com/1/picture" end it "has image_url methods for small/large/square" do profile = Mogli::Profile.new profile.id="1" p...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/model_spec.rb
Ruby
mit
308
master
8,830
require "spec_helper" class TestModel < Mogli::Model set_search_type :test_model define_properties :id, :other_property, :actions creation_properties :other_property, :actions has_association :comments, "Comment" hash_populating_accessor :from, "User" hash_populating_accessor_with_default_field :location,:...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/page_spec.rb
Ruby
mit
308
master
517
require "spec_helper" describe Mogli::Page do it "has an access_token" do Mogli::Page.new.access_token.should be_nil end it "gets raises an error if the accesstoken is nil" do lambda do Mogli::Page.new.client_for_page end.should raise_error(Mogli::Page::MissingAccessToken) end it "gets...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/fetching_array_spec.rb
Ruby
mit
308
master
2,747
require "spec_helper" describe Mogli::FetchingArray do let :fetching_array do array = Mogli::FetchingArray.new array << Mogli::User.new(:id=>4) array << Mogli::User.new(:id=>5) array.next_url = "https://next" array.previous_url = "https://previous" array.client = client array.classes = ...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/test_user_spec.rb
Ruby
mit
308
master
1,115
require "spec_helper" describe Mogli::User do let(:app_id) { '12345' } let(:access_token) { '678910' } describe "#create" do it "POSTs to the test user creation url" do Mogli::Client.should_receive(:post).with("https://graph.facebook.com/#{app_id}/accounts/test-users", :body => {:access_token ...
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/client/client_user_spec.rb
Ruby
mit
308
master
268
require "spec_helper" describe Mogli::Client do let :client do Mogli::Client.new end it "fetches a user by id" do client.should_receive(:get_and_map).with(12451752,Mogli::User).and_return("user") client.user(12451752).should == "user" end end
github
mmangino/mogli
https://github.com/mmangino/mogli
spec/client/client_event_spec.rb
Ruby
mit
308
master
289
require "spec_helper" describe Mogli::Client do let :client do Mogli::Client.new end it "fetches an event by id" do client.should_receive(:get_and_map).with(118515001510745,Mogli::Event).and_return("event") client.event(118515001510745).should == "event" end end