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 | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/types/vector.rb | Ruby | mit | 46 | main | 726 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Charlie Savage.
# Copyright, 2025, by Samuel Williams.
module FFI
module Clang
module Types
# Represents a vector type (SIMD vector).
# Vector types are used for SIMD operations and have a fixed number of elements of the sa... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/types/type_def.rb | Ruby | mit | 46 | main | 748 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Charlie Savage.
# Copyright, 2025, by Samuel Williams.
module FFI
module Clang
module Types
# Represents a typedef type.
# A typedef provides an alias for another type.
class TypeDef < Type
# Get the canonical (under... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/types/elaborated.rb | Ruby | mit | 46 | main | 1,171 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Charlie Savage.
# Copyright, 2025, by Samuel Williams.
module FFI
module Clang
module Types
# Represents an elaborated type (e.g., struct, union, enum with an elaborated type specifier).
# Elaborated types may include ... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/index.rb | Ruby | mit | 46 | main | 4,927 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2010, by Jari Bakken.
# Copyright, 2012, by Hal Brodigan.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2024-2026, by Charlie Savage.
module FFI
module Clang
module Lib
typedef :pointer, :CXIndex
GlobalOptFlags = enum... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/printing_policy.rb | Ruby | mit | 46 | main | 2,360 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2026, by Charlie Savage.
# Copyright, 2024-2025, by Samuel Williams.
module FFI
module Clang
module Lib
typedef :pointer, :CXPrintingPolicy
PrintingPolicyProperty = enum [
:printing_policy_indentation,
:printing_pol... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/token.rb | Ruby | mit | 46 | main | 2,229 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2014-2025, by Samuel Williams.
# Copyright, 2026, by Charlie Savage.
module FFI
module Clang
module Lib
# FFI struct representing a token in libclang.
# @private
class CXToken < FFI::Struct
... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/evaluation.rb | Ruby | mit | 46 | main | 1,272 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Charlie Savage.
module FFI
module Clang
module Lib
typedef :pointer, :CXEvalResult
enum :eval_result_kind, [
:int, 1,
:float, 2,
:obj_c_str_literal, 3,
:str_literal, 4,
:c_f_str, 5,
:other, 6,
... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/diagnostic.rb | Ruby | mit | 46 | main | 3,266 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2013, by Garry Marshall.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2020, by Zete Lui.
require_relative "translation_unit"
require_relative "source_location"
require_relative "string"
requir... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/cursor_set.rb | Ruby | mit | 46 | main | 611 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Charlie Savage.
require_relative "cursor"
module FFI
module Clang
module Lib
typedef :pointer, :CXCursorSet
attach_function :create_cursor_set, :clang_createCXCursorSet, [], :CXCursorSet
attach_function :dispose_cur... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/indexing.rb | Ruby | mit | 46 | main | 8,637 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Charlie Savage.
require_relative "cursor"
require_relative "diagnostic"
require_relative "file"
require_relative "source_location"
require_relative "translation_unit"
module FFI
module Clang
module Lib
typedef :pointer, :CXId... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/comment.rb | Ruby | mit | 46 | main | 5,762 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2013, by Carlos Martín Nieto.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2014, by George Pimm.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2026, by Charlie Savage.
module FFI
module Clang
module Lib
# FFI struct rep... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/translation_unit.rb | Ruby | mit | 46 | main | 5,054 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2019, by Hayden Purdy.
# Copyright, 2022, by Motonori Iwamuro.
# Copyright, 2023-2026, by Charlie Savage.
require_relative "index"
module FFI
module Clang
m... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/file.rb | Ruby | mit | 46 | main | 1,654 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2010, by Jari Bakken.
# Copyright, 2012, by Hal Brodigan.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2013, by Carlos Martín Nieto.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2026, by Charlie Savage.
require_relative "str... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/code_completion.rb | Ruby | mit | 46 | main | 5,278 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2014-2025, by Samuel Williams.
# Copyright, 2024-2026, by Charlie Savage.
require_relative "cursor"
require_relative "diagnostic"
module FFI
module Clang
module Lib
typedef :pointer, :CXCompletionS... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/source_location.rb | Ruby | mit | 46 | main | 2,000 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2013, by Garry Marshall.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2026, by Charlie Savage.
require_relative "file"
module FFI
module Clang
module Lib
# FFI struct representing a sou... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/compilation_database.rb | Ruby | mit | 46 | main | 2,424 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2014-2025, by Samuel Williams.
# Copyright, 2026, by Charlie Savage.
module FFI
module Clang
module Lib
typedef :pointer, :CXCompilationDatabase
typedef :pointer, :CXCompileCommands
typedef :p... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/source_range.rb | Ruby | mit | 46 | main | 1,693 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2013, by Garry Marshall.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2026, by Charlie Savage.
require_relative "source_location"
module FFI
module Clang
module Lib
# FFI struct represe... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/string.rb | Ruby | mit | 46 | main | 1,145 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2026, by Charlie Savage.
module FFI
module Clang
module Lib
# FFI struct representing a string returned by libclang.
# @private
class CXString < FFI::Struct
layout(
:data, :poi... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/clang_version.rb | Ruby | mit | 46 | main | 312 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2014, by Masahiro Sano.
# Copyright, 2014-2025, by Samuel Williams.
require_relative "string"
module FFI
module Clang
module Lib
attach_function :get_clang_version, :clang_getClangVersion, [], CXString.by_value
end
end
end |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/cursor.rb | Ruby | mit | 46 | main | 31,768 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2013, by Garry Marshall.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2013, by Carlos Martín Nieto.
# Copyright, 2013, by Dave Wilkinson.
# Copyright, 2013, by Takeshi Watanabe.
# Copyright, 2013-2014, by Masahiro Sano.
# Copyrigh... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/type.rb | Ruby | mit | 46 | main | 10,238 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2013, by Carlos Martín Nieto.
# Copyright, 2013-2025, by Samuel Williams.
# Copyright, 2013, by Takeshi Watanabe.
# Copyright, 2013-2014, by Masahiro Sano.
# Copyright, 2014, by Niklas Therning.
# Copyright, 2024-2026, by Charlie Savage.
mod... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/lib/inclusions.rb | Ruby | mit | 46 | main | 699 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2014, by Greg Hazel.
# Copyright, 2014-2025, by Samuel Williams.
# Copyright, 2026, by Charlie Savage.
require_relative "file"
require_relative "source_location"
require_relative "cursor"
module FFI
module Clang
module Lib
# Source co... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/args/darwin.rb | Ruby | mit | 46 | main | 1,203 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Charlie Savage.
module FFI
module Clang
# macOS-specific clang configuration using Xcode toolchain paths.
class DarwinArgs < Args
private
def find_libclang_paths
if llvm_library_dir
return [::File.join(llvm_l... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/args/linux.rb | Ruby | mit | 46 | main | 705 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Charlie Savage.
module FFI
module Clang
# Linux-specific clang configuration.
class LinuxArgs < Args
private
def find_libclang_paths
prefix = llvm_library_dir
paths = versions.flat_map do |version|
5... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/args/mingw.rb | Ruby | mit | 46 | main | 374 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Charlie Savage.
module FFI
module Clang
# MinGW/MSYS2-specific clang configuration.
class MingwArgs < Args
private
def find_libclang_paths
if llvm_bin_dir
return [::File.join(llvm_bin_dir, "libclang.dll")]
... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/args/args.rb | Ruby | mit | 46 | main | 6,282 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Charlie Savage.
require "open3"
module FFI
module Clang
# Platform-specific clang configuration: finding libclang, locating the
# resource directory, and injecting extra command-line arguments into
# parse_translation_unit.
... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | lib/ffi/clang/args/mswin.rb | Ruby | mit | 46 | main | 6,091 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Charlie Savage.
module FFI
module Clang
# MSVC-specific clang configuration. Discovers libclang and system
# include paths from the Visual Studio installation:
#
# 1. Find the VS installation path via vswhere.exe
# 2. Cal... |
github | socketry/ffi-clang | https://github.com/socketry/ffi-clang | examples/docs.rb | Ruby | mit | 46 | main | 856 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require "rainbow"
require "ffi/clang"
index = FFI::Clang::Index.new
# clang -Xclang -ast-dump -fsyntax-only ./examples/docs.cpp
def title(declaration)
puts ["Symbol:", Rainbow(declaratio... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | firebase_cloud_messenger.gemspec | Ruby | mit | 46 | master | 1,046 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'firebase_cloud_messenger/version'
Gem::Specification.new do |spec|
spec.name = "firebase_cloud_messenger"
spec.version = FirebaseCloudMessenger::VERSION
spec.license = ... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/firebase_cloud_messenger_test.rb | Ruby | mit | 46 | master | 1,667 | require 'test_helper'
class FirebaseCloudMessengerTest < MiniTest::Spec
describe "::send" do
after do
FirebaseCloudMessenger.project_id = nil
end
it "requires either a project_id or credentials_path" do
assert_raises FirebaseCloudMessenger::SetupError do
FirebaseCloudMessenger.send(m... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/client_test.rb | Ruby | mit | 46 | master | 4,820 | require 'test_helper'
class FirebaseCloudMessenger::ClientTest < MiniTest::Spec
describe "::new" do
it "throws an argument error if project_id, credentials_path, env var are not supplied" do
ENV.stubs(:[]).with('GOOGLE_APPLICATION_CREDENTIALS').returns(nil)
assert_raises ArgumentError do
Fir... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/error_test.rb | Ruby | mit | 46 | master | 2,433 | require 'test_helper'
class FirebaseCloudMessenger::ErrorTest < MiniTest::Spec
describe "::from_respnose" do
it "returns a BadRequest based on the response status" do
assert_equal FirebaseCloudMessenger::BadRequest, FirebaseCloudMessenger::Error.from_response(mock_response("400")).class
end
it "re... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/firebase_object_test.rb | Ruby | mit | 46 | master | 826 | require 'test_helper'
class FirebaseCloudMessenger::FirebaseObjectTest < MiniTest::Spec
FIELDS = %i(field1 field2)
class FireBaseObjectSubclass < FirebaseCloudMessenger::FirebaseObject
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
describe '#new' do
it 'throws... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/fcm_options_test.rb | Ruby | mit | 46 | master | 876 | require 'test_helper'
class FirebaseCloudMessenger::FcmOptionsTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::FcmOptions.new(analytics_label: "analytics_label")
%i(analytics_label).each do |field|
assert_equal field.to_s, m... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/auth_client_test.rb | Ruby | mit | 46 | master | 3,738 | require 'test_helper'
class FirebaseCloudMessenger::AuthClientTest < Minitest::Spec
describe "::new" do
it "throws an ArgumentError if credentials_path, client_email and private-key vars aren't set" do
ENV.stubs(:[]).with('GOOGLE_CLIENT_EMAIL').returns(nil)
assert_raises ArgumentError do
Fir... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/notification_test.rb | Ruby | mit | 46 | master | 1,105 | require 'test_helper'
class FirebaseCloudMessenger::NotificationTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Notification.new(title: "title",
body: "body",
... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/message_test.rb | Ruby | mit | 46 | master | 5,600 | require 'test_helper'
class FirebaseCloudMessenger::MessageTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Message.new(name: "name",
data: "data",
... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/apns/alert_test.rb | Ruby | mit | 46 | master | 2,098 | require 'test_helper'
class FirebaseCloudMessenger::Apns::AlertTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Apns::Alert.new(title: "title",
body: "body",
... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/apns/config_test.rb | Ruby | mit | 46 | master | 992 | require 'test_helper'
class FirebaseCloudMessenger::Apns::ConfigTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Apns::Config.new(headers: "headers", payload: "payload", fcm_options: "fcm_options")
%i(headers payload fcm_options).ea... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/apns/aps_dictionary_test.rb | Ruby | mit | 46 | master | 2,030 | require 'test_helper'
class FirebaseCloudMessenger::Apns::ApsDictionaryTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Apns::ApsDictionary.new(alert: "alert",
badge: "badge",
... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/apns/fcm_options_test.rb | Ruby | mit | 46 | master | 964 | require 'test_helper'
class FirebaseCloudMessenger::Apns::FcmOptionsTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Apns::FcmOptions.new(analytics_label: "analytics_label", image: "image")
%i(analytics_label image).each do |field|
... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/android/config_test.rb | Ruby | mit | 46 | master | 1,993 | require 'test_helper'
class FirebaseCloudMessenger::Android::ConfigTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Android::Config.new(collapse_key: "collapse_key",
priority: "priori... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/android/notification_test.rb | Ruby | mit | 46 | master | 2,911 | require 'test_helper'
class FirebaseCloudMessenger::Android::NotificationTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Android::Notification.new(title: "title",
body: "body",... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/webpush/config_test.rb | Ruby | mit | 46 | master | 1,381 | require 'test_helper'
class FirebaseCloudMessenger::Webpush::ConfigTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Webpush::Config.new(headers: "headers",
data: "data",
... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | test/lib/firebase_cloud_messenger/webpush/notification_test.rb | Ruby | mit | 46 | master | 1,177 | require 'test_helper'
class FirebaseCloudMessenger::Webpush::NotificationTest < MiniTest::Spec
describe "#new" do
it "sets properties based on the hash arg" do
msg = FirebaseCloudMessenger::Webpush::Notification.new(title: "title",
body: "body",... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger.rb | Ruby | mit | 46 | master | 1,327 | require 'net/http'
require 'googleauth'
require 'json'
require 'firebase_cloud_messenger/auth_client'
require 'firebase_cloud_messenger/error'
require 'firebase_cloud_messenger/client'
require 'firebase_cloud_messenger/firebase_object'
require 'firebase_cloud_messenger/message'
require 'firebase_cloud_messenger/notifi... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/fcm_options.rb | Ruby | mit | 46 | master | 204 | module FirebaseCloudMessenger
class FcmOptions < FirebaseObject
FIELDS = %i(analytics_label).freeze
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
end |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/firebase_object.rb | Ruby | mit | 46 | master | 600 | module FirebaseCloudMessenger
class FirebaseObject
def initialize(data, fields)
data = data.dup
@fields = fields
fields.each do |field|
send(:"#{field}=", data.delete(field))
end
if data.any?
raise ArgumentError, "Keys must be one of #{fields.inspect}"
end
... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/schema.rb | Ruby | mit | 46 | master | 5,933 | module FirebaseCloudMessenger
SCHEMA = {
"definitions" => {
"data" => {
"type" => "object",
"additionalProperties" => { "type" => "string" }
},
"notification" => {
"type" => "object",
"properties" => {
"title" => { "type" => "string" },
"body" ... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/error.rb | Ruby | mit | 46 | master | 1,422 | module FirebaseCloudMessenger
class BaseError < StandardError; end
class SetupError < BaseError; end
class Error < BaseError
attr_reader :response
def self.from_response(response)
status = response.code
klass = case status.to_i
when 400 then FirebaseCloudMessenger::BadRequest
... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/message.rb | Ruby | mit | 46 | master | 1,117 | require 'firebase_cloud_messenger/schema'
require 'firebase_cloud_messenger/fcm_options'
require 'json-schema'
module FirebaseCloudMessenger
class Message < FirebaseObject
FIELDS = %i(name data notification android webpush apns token topic condition fcm_options).freeze
attr_accessor(*FIELDS)
attr_writer... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/client.rb | Ruby | mit | 46 | master | 2,623 | require 'firebase_cloud_messenger/error'
module FirebaseCloudMessenger
class Client
attr_writer :max_retry_count, :project_id, :access_token
attr_accessor :credentials_path
def initialize(credentials_path = nil, project_id = nil)
@credentials_path = credentials_path || ENV['GOOGLE_APPLICATION_CRED... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/apns.rb | Ruby | mit | 46 | master | 300 | require 'firebase_cloud_messenger/apns/apns_object'
require 'firebase_cloud_messenger/apns/payload'
require 'firebase_cloud_messenger/apns/aps_dictionary'
require 'firebase_cloud_messenger/apns/alert'
require 'firebase_cloud_messenger/apns/config'
require 'firebase_cloud_messenger/apns/fcm_options' |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/auth_client.rb | Ruby | mit | 46 | master | 1,238 | require 'pathname'
module FirebaseCloudMessenger
class AuthClient
attr_reader :credentials_path
AUTH_SCOPE = "https://www.googleapis.com/auth/firebase.messaging".freeze
def initialize(credentials_path = nil)
@credentials_path = credentials_path
raise_credentials_not_supplied if !credential... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/apns/config.rb | Ruby | mit | 46 | master | 241 | module FirebaseCloudMessenger
module Apns
class Config < ApnsObject
FIELDS = %i(headers payload fcm_options).freeze
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
end
end |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/apns/fcm_options.rb | Ruby | mit | 46 | master | 240 | module FirebaseCloudMessenger
module Apns
class FcmOptions < ApnsObject
FIELDS = %i(analytics_label image).freeze
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
end
end |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/apns/payload.rb | Ruby | mit | 46 | master | 212 | module FirebaseCloudMessenger
module Apns
class Payload < ApnsObject
FIELDS = %i(aps)
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
end
end |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/apns/alert.rb | Ruby | mit | 46 | master | 297 | module FirebaseCloudMessenger
module Apns
class Alert < ApnsObject
FIELDS = %i(title body title_loc_key title_loc_args action_loc_key loc_key loc_args launch_image).freeze
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
end
end |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/apns/apns_object.rb | Ruby | mit | 46 | master | 369 | module FirebaseCloudMessenger
module Apns
class ApnsObject < FirebaseObject
def to_h
fields.each_with_object({}) do |field, object_hash|
val = send(field)
next if val.nil?
val = val.to_h if val.is_a?(FirebaseObject)
object_hash[field.to_s.gsub("_", "-").to_sy... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/apns/aps_dictionary.rb | Ruby | mit | 46 | master | 292 | module FirebaseCloudMessenger
module Apns
class ApsDictionary < ApnsObject
FIELDS = %i(alert badge sound content_available mutable_content category thread_id).freeze
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
end
end |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/webpush/config.rb | Ruby | mit | 46 | master | 258 | module FirebaseCloudMessenger
module Webpush
class Config < FirebaseObject
FIELDS = %i(headers data notification fcm_options).freeze
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
end
end |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/webpush/notification.rb | Ruby | mit | 46 | master | 242 | module FirebaseCloudMessenger
module Webpush
class Notification < FirebaseObject
FIELDS = %i(title body icon).freeze
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
end
end |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/android/notification.rb | Ruby | mit | 46 | master | 333 | module FirebaseCloudMessenger
module Android
class Notification < FirebaseObject
FIELDS = %i(title body icon color sound tag click_action body_loc_key body_loc_args title_loc_key title_loc_args image).freeze
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
e... |
github | vincedevendra/firebase_cloud_messenger | https://github.com/vincedevendra/firebase_cloud_messenger | lib/firebase_cloud_messenger/android/config.rb | Ruby | mit | 46 | master | 300 | module FirebaseCloudMessenger
module Android
class Config < FirebaseObject
FIELDS = %i(collapse_key priority ttl restricted_package_name data notification fcm_options).freeze
attr_accessor(*FIELDS)
def initialize(data)
super(data, FIELDS)
end
end
end
end |
github | wookayin/alfred-latex-symbols-workflow | https://github.com/wookayin/alfred-latex-symbols-workflow | generate_icons.rb | Ruby | mit | 46 | master | 3,407 | #!/usr/bin/env ruby
# generate_icons.rb
#
# Generates 64x64 icon for each LaTeX symbol command
# Lots of code originates from kirel/detexify (lib/rake/symbol_task.rb)
#
# @author Jongwook Choi <wookayin@gmail.com>
# @author Daniel Kirsch <danishkirel@gmail.com>
require 'fileutils'
require 'tmpdir'
require 'shellwords... |
github | kacperszurek/pentest_teamcity | https://github.com/kacperszurek/pentest_teamcity | exploits/teamcity.rb | Ruby | mit | 46 | master | 31,222 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'open3'
require 'json'
require 'base64'
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpServer
include Msf::Ex... |
github | kacperszurek/pentest_teamcity | https://github.com/kacperszurek/pentest_teamcity | post/jetbrains.rb | Ruby | mit | 46 | master | 5,056 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'openssl'
require 'tempfile'
require 'base64'
require 'kdbx'
class MetasploitModule < Msf::Post
include Msf::Post::File
include Msf::Post::Windows::Priv
def initializ... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | jsonapi-serializable.gemspec | Ruby | mit | 46 | master | 916 | version = File.read(File.expand_path('../VERSION', __FILE__)).strip
Gem::Specification.new do |spec|
spec.name = 'jsonapi-serializable'
spec.version = version
spec.author = 'Lucas Hosseini'
spec.email = 'lucas.hosseini@gmail.com'
spec.summary = 'Conveniently serialize JSON... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | benchmarks/caching.rb | Ruby | mit | 46 | master | 1,418 | require 'rubygems'
require 'bundler/setup'
require 'benchmark/ips'
require 'json'
require 'jsonapi/serializable'
class Model
def initialize(params = {})
params.each do |k, v|
instance_variable_set("@#{k}", v)
end
end
end
ATTR_NAMES = (1..100).map { |i| "attr_#{i}" }
class User < Model
attr_acces... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable.rb | Ruby | mit | 46 | master | 987 | module JSONAPI
module Serializable
require 'jsonapi/serializable/error'
require 'jsonapi/serializable/resource'
require 'jsonapi/serializable/renderer'
# Error raised when there's no serializable class defined for resource.
class UndefinedSerializableClass < StandardError; end
# @api private... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/error.rb | Ruby | mit | 46 | master | 2,371 | require 'jsonapi/serializable/link'
require 'jsonapi/serializable/error_dsl'
module JSONAPI
module Serializable
class ErrorSource
def self.as_jsonapi(params = {}, &block)
new(params, &block).as_jsonapi
end
def initialize(params = {}, &block)
params.each { |k, v| instance_variab... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/resource.rb | Ruby | mit | 46 | master | 3,153 | require 'jsonapi/serializable/resource/dsl'
require 'jsonapi/serializable/link'
require 'jsonapi/serializable/relationship'
require 'jsonapi/serializable/resource/conditional_fields'
require 'jsonapi/serializable/resource/key_format'
module JSONAPI
module Serializable
class Resource
extend DSL
# D... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/link.rb | Ruby | mit | 46 | master | 1,686 | module JSONAPI
module Serializable
class Link
def self.as_jsonapi(exposures = {}, &block)
new(exposures, &block).as_jsonapi
end
def initialize(exposures = {}, &block)
exposures.each { |k, v| instance_variable_set("@#{k}", v) }
static_value = instance_eval(&block)
... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/relationship.rb | Ruby | mit | 46 | master | 1,570 | require 'jsonapi/serializable/link'
require 'jsonapi/serializable/relationship/dsl'
module JSONAPI
module Serializable
class Relationship
include DSL
def initialize(exposures = {}, options = {}, &block)
exposures.each { |k, v| instance_variable_set("@#{k}", v) }
@_exposures = exposur... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/renderer.rb | Ruby | mit | 46 | master | 2,550 | require 'jsonapi/renderer'
module JSONAPI
module Serializable
class Renderer
def initialize(renderer = JSONAPI::Renderer.new)
@renderer = renderer
end
# Serialize resources into a JSON API document.
#
# @param resources [nil,Object,Array]
# @param options [Hash] @see ... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/error_dsl.rb | Ruby | mit | 46 | master | 1,004 | module JSONAPI
module Serializable
module ErrorDSL
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def id(value = nil, &block)
@id_val = value
@id_block = block
end
def status(value = nil, &block)
@status_v... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/relationship/dsl.rb | Ruby | mit | 46 | master | 2,797 | module JSONAPI
module Serializable
class Relationship
module DSL
# Declare the related resources for this relationship.
# @yieldreturn The related resources for this relationship.
#
# @example
# data do
# @object.posts
# end
# end
... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/resource/conditional_fields.rb | Ruby | mit | 46 | master | 3,762 | module JSONAPI
module Serializable
class Resource
# Extension for handling conditional fields in serializable resources.
#
# @usage
# class SerializableUser < JSONAPI::Serializable::Resource
# extend JSONAPI::Serializable::Resource::ConditionalFields
#
# attribu... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/resource/dsl.rb | Ruby | mit | 46 | master | 5,519 | module JSONAPI
module Serializable
class Resource
module DSL
def self.extended(klass)
class << klass
attr_accessor :id_block, :type_val, :type_block, :attribute_blocks,
:relationship_blocks, :relationship_options,
:link_blocks... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | lib/jsonapi/serializable/resource/key_format.rb | Ruby | mit | 46 | master | 2,331 | module JSONAPI
module Serializable
class Resource
# Extension for handling automatic key formatting of
# attributes/relationships.
#
# @example
# class SerializableUser < JSONAPI::Serializable::Resource
# extend JSONAPI::Serializable::Resource::KeyFormat
# key... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource_builder_spec.rb | Ruby | mit | 46 | master | 895 | require 'spec_helper'
describe JSONAPI::Serializable, '.resources_for' do
let(:inferrer) { Hash[Post: API::SerializablePost] }
it 'returns nil if the object is nil' do
expect(described_class.resources_for(nil, {}, inferrer)).to be(nil)
end
it 'returns an array if the object is an array of resources' do
... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/spec_helper.rb | Ruby | mit | 46 | master | 877 | require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
require 'jsonapi/serializable'
class Model
def initialize(params = {})
params.each do |k, v|
instance_variable_set("@#{k}", v)
end
end
end
class User < Model
attr_accessor :id, :name, :address, :posts
end
class Post < Model
attr_... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/error/DSL_spec.rb | Ruby | mit | 46 | master | 4,234 | require 'spec_helper'
describe JSONAPI::Serializable::Error, '.id' do
it 'accepts a string' do
klass = Class.new(JSONAPI::Serializable::Error) do
id 'foo'
end
error = klass.new
actual = error.as_jsonapi[:id]
expected = 'foo'
expect(actual).to eq(expected)
end
end
describe JSONAPI::S... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/meta_spec.rb | Ruby | mit | 46 | master | 697 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '.meta' do
it 'accepts a hash' do
klass = Class.new(JSONAPI::Serializable::Resource) do
type 'foo'
meta foo: 'bar'
end
resource = klass.new(object: User.new)
actual = resource.as_jsonapi[:meta]
expected = {
foo: 'ba... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/as_jsonapi_spec.rb | Ruby | mit | 46 | master | 5,448 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '#as_jsonapi' do
let(:posts) { [Post.new(id: 1), Post.new(id: 2)] }
let(:user) do
User.new(id: 'foo', name: 'Lucas', address: '22 Ruby drive', posts: posts)
end
let(:inferrer) do
Hash.new { |h, k| h[k] = Object.const_get("Serializable#{k}"... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/conditional_fields_spec.rb | Ruby | mit | 46 | master | 3,511 | require 'spec_helper'
describe JSONAPI::Serializable::Resource do
let(:klass) do
Class.new(JSONAPI::Serializable::Resource) do
type 'foo'
id { 'bar' }
end
end
let(:object) { User.new }
let(:resource) do
klass.new(object: object, conditional: conditional)
end
context 'when the attr... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/id_spec.rb | Ruby | mit | 46 | master | 548 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '.id' do
it 'accepts a block' do
klass = Class.new(JSONAPI::Serializable::Resource) do
type 'foo'
id { 'foo' }
end
resource = klass.new(object: User.new)
expect(resource.jsonapi_id).to eq('foo')
end
it 'forwards to @obj... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/exposures_spec.rb | Ruby | mit | 46 | master | 2,964 | require 'spec_helper'
describe JSONAPI::Serializable::Resource do
let(:posts) { [Post.new(id: 1), Post.new(id: 2)] }
let(:user) { User.new(id: 'foo', posts: posts) }
it 'exposes exposures in .id' do
klass = Class.new(JSONAPI::Serializable::Resource) do
type 'users'
id { @foo }
end
resour... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/jsonapi_related_spec.rb | Ruby | mit | 46 | master | 1,453 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '#jsonapi_related' do
let(:posts) { [Post.new(id: 1), Post.new(id: 2)] }
let(:user) do
User.new(id: 'foo', name: 'Lucas', address: '22 Ruby drive', posts: posts)
end
let(:inferrer) do
Hash.new { |h, k| h[k] = Object.const_get("Serializable... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/link_spec.rb | Ruby | mit | 46 | master | 723 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '.link' do
it 'defines links' do
klass = Class.new(JSONAPI::Serializable::Resource) do
type 'users'
link :self do
"http://api.example.com/users/#{@object.id}"
end
link :v2 do
href "http://api.example.com/v2/us... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/relationship_spec.rb | Ruby | mit | 46 | master | 3,243 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '.relationship' do
let(:posts) { [Post.new(id: 1), Post.new(id: 2)] }
let(:user) { User.new(id: 'foo', posts: posts) }
it 'forwards to @object by default' do
klass = Class.new(JSONAPI::Serializable::Resource) do
type 'users'
relatio... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/type_spec.rb | Ruby | mit | 46 | master | 907 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '.type' do
it 'accepts a symbol' do
klass = Class.new(JSONAPI::Serializable::Resource) do
type :foo
end
resource = klass.new(object: User.new)
expect(resource.jsonapi_type).to eq(:foo)
end
it 'accepts a string and symbolizes ... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/attribute_spec.rb | Ruby | mit | 46 | master | 1,767 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '.attribute' do
let(:object) { User.new(name: 'foo') }
let(:resource) { klass.new(object: object) }
subject { resource.as_jsonapi[:attributes] }
context 'when supplied a block value' do
let(:klass) do
Class.new(JSONAPI::Serializable:... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/linkage_spec.rb | Ruby | mit | 46 | master | 1,744 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '.linkage' do
let(:posts) { [Post.new(id: 1), Post.new(id: 2)] }
let(:user) { User.new(id: 'foo', posts: posts) }
let(:inferrer) do
Hash.new { |h, k| h[k] = Object.const_get("Serializable#{k}") }
end
it 'defaults to forcing standard linkage... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/key_format_spec.rb | Ruby | mit | 46 | master | 1,574 | require 'spec_helper'
describe JSONAPI::Serializable::Resource do
let(:klass) do
Class.new(JSONAPI::Serializable::Resource) do
type 'foo'
id { 'bar' }
end
end
let(:object) { User.new }
let(:resource) { klass.new(object: object) }
subject { resource.as_jsonapi }
context 'when keys a... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/resource/attributes_spec.rb | Ruby | mit | 46 | master | 479 | require 'spec_helper'
describe JSONAPI::Serializable::Resource, '.attributes' do
it 'defines multiple attributes' do
klass = Class.new(JSONAPI::Serializable::Resource) do
type 'foo'
attributes :name, :address
end
user = User.new(name: 'foo', address: 'bar')
resource = klass.new(object: us... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/renderer/errors_spec.rb | Ruby | mit | 46 | master | 524 | require 'spec_helper'
describe JSONAPI::Serializable::Renderer, '#render_errors' do
let(:errors) do
[
{ id: 'foo', title: 'bar' },
{ id: 'baz', title: 'foobar' }
]
end
it 'renders an error document' do
klass = Class.new(JSONAPI::Serializable::Error) do
id { @object[:id] }
tit... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/renderer/relationship_spec.rb | Ruby | mit | 46 | master | 3,951 | require 'spec_helper'
describe JSONAPI::Serializable::Renderer, '#render_relationship' do
let(:posts) { [Post.new(id: 1), Post.new(id: 2)] }
let(:user) do
User.new(id: 'foo', name: 'Lucas', address: '22 Ruby drive', posts: posts)
end
it 'renders a relationship document' do
klass = Class.new(JSONAPI::S... |
github | jsonapi-rb/jsonapi-serializable | https://github.com/jsonapi-rb/jsonapi-serializable | spec/renderer/success_spec.rb | Ruby | mit | 46 | master | 1,496 | require 'spec_helper'
describe JSONAPI::Serializable::Renderer, '#render' do
let(:posts) { [Post.new(id: 1), Post.new(id: 2)] }
let(:user) do
User.new(id: 'foo', name: 'Lucas', address: '22 Ruby drive', posts: posts)
end
it 'renders a success document' do
hash = subject.render(user, class: { User: Ser... |
github | togglepro/pundit-resources | https://github.com/togglepro/pundit-resources | pundit-resources.gemspec | Ruby | mit | 46 | master | 1,157 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'pundit/resources/version'
Gem::Specification.new do |spec|
spec.name = "pundit-resources"
spec.version = Pundit::Resources::VERSION
spec.authors = ["Ross Penman", "Sean... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.