Keep your data pukka with these custom ActiveModel validators.
Implements in-app purchase data parsing, signature validation,
A Ruby library to describe the types of your data and ways to validate them.
Provides data class validation for active-model objects
A simple Gem to enable any `ActiveRecord::Base` object to store a set of attributes in a set like structure represented through a bitfield on the database level. You only have to specify the name of the set to hold the attributes in question an the rest is done for you through some fine selected Ruby magic. Here is a simple example of how you could use the gem: class Person < ActiveRecord::Base has_set :interests end To get this to work you need some additional work done first: 1. You need an unsigned 8-Byte integer column in your database to store the bitfield. It is expected that the column is named after the name of the set with the suffix `_bitfield` appended (e.g. `interests_bitfield`). You can change that default behavior by providing the option `:column_name` (e.g. `has_set :interests, :column_name => :my_custom_column`). 2. You need a class that provides the valid values to be stored within the set and map the single bits back to something meaningful. The class should be named after the name of the set (you can change this through the `:enum_class` option). This class could be seen as an enumeration and must implement the following simple interface: * There must be a class method `values` to return all valid enumerators in the defined enumeration. * Each enumerator must implement a `name` method to return a literal representation for identification. The literal must be of the type `String`. * Each enumerator must implement a `bitfield_index` method to return the exponent of the number 2 for calculation the position of this enumerator in the bitfield. **Attention** Changing this index afterwards will destroy your data integrity. Here is a simple example of how to implement such a enumeration type while using the the `renum` gem for simplicity. You are free to use anything else that matches the described interface. enum :Interests do attr_reader :bitfield_index Art(0) Golf(1) Sleeping(2) Drinking(3) Dating(4) Shopping(5) def init(bitfield_index) @bitfield_index = bitfield_index end end
Kwalify is a parser, schema validator, and data binding tool for YAML and JSON.
ActiveModel-compliant form objects for rails app. Forms have data and behavior. Let them be the objects they want to be. Plus, get presentation- specific validation logic out of your models.
The renavam validator is a simple and small data validator for Brazilian vehicle documents.
Validates a StepLib datastore (usually stored in JSON) data. This GEM's major and minor version number matches the related StepLib format specification's major and minor version number.
ErrorProne lets you choose where, when, and how to validate data without tying you to ORMs or application frameworks.
Simple DSL for datatype validation for basic data types.Inspired from GRPC DSL. Since ruby is dynamic language, datatype validator helps to reduce runtime errors by validating structure before processing
This gem provides a way to easily specify methods that an object must implement, as well as a way to validate that required methods exist. In addition, you can specify additional information about the interface of your object that can be used to produce documentation. Specifically you can specify the return type of your methods, as well as the method's arguments and argument return types. The data types are not enforced, but can be viewed by running `MyClass.interface.print`.
VAT Identification Number data object and validator
Find unsafe ActiveRecord validations and the invalid data left behind
Define a DSL in Ruby to validate and access any data
A JSON parser/generator that conforms (I believe) to RFC8259 "The JavaScript Object Notation (JSON) Data Interchange Format". This gem honors the syntax as possible. The generator guarantees that a parsed valid properly rounds-trip to identical valid JSON representation.
A ruby interface over the DataValidation service.
Allows you to interact with the verifi.io API. Validate your data.
Small and extensible data validation toolkit
The Tripletex API is a **RESTful API**, which does not implement PATCH, but uses a PUT with optional fields. **Actions** or commands are represented in our RESTful path with a prefixed `:`. Example: `/v2/hours/123/:approve`. **Summaries** or aggregated results are represented in our RESTful path with a prefixed <code>></code>. Example: <code>/v2/hours/>thisWeeksBillables</code>. **"requestID"** is a key found in all validation and error responses. If additional log information is absolutely necessary, our support division can locate the key value. **Download** the [swagger.json](/v2/swagger.json) file [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification) to [generate code](https://github.com/sveredyuk/tripletex_ruby). This document was generated from the Swagger JSON file. **version:** This is a versioning number found on all DB records. If included, it will prevent your PUT/POST from overriding any updates to the record since your GET. **Date & DateTime** follows the **ISO 8601** standard. Date: `YYYY-MM-DD`. DateTime: `YYYY-MM-DDThh:mm:ssZ` **Sorting** is done by specifying a comma separated list, where a `-` prefix denotes descending. You can sort by sub object with the following format: `project.name, -date`. **Searching:** is done by entering values in the optional fields for each API call. The values fall into the following categories: range, in, exact and like. **Missing fields or even no response data** can occur because result objects and fields are filtered on authorization. **See [FAQ](https://tripletex.no/execute/docViewer?articleId=906&language=0) for more additional information.** ## Authentication: - **Tokens:** The Tripletex API uses 3 different tokens - **consumerToken**, **employeeToken** and **sessionToken**. - **consumerToken** is a token provided to the consumer by Tripletex after the API 2.0 registration is completed. - **employeeToken** is a token created by an administrator in your Tripletex account via the user settings and the tab "API access". Each employee token must be given a set of entitlements. [Read more here.](https://tripletex.no/execute/docViewer?articleId=853&language=0) - **sessionToken** is the token from `/token/session/:create` which requires a consumerToken and an employeeToken created with the same consumer token, but not an authentication header. See how to create a sessionToken [here](https://tripletex.no/execute/docViewer?articleId=855&language=0). - The session token is used as the password in "Basic Authentication Header" for API calls. - Use blank or `0` as username for accessing the account with regular employee token, or if a company owned employee token accesses <code>/company/>withLoginAccess</code> or <code>/token/session/>whoAmI</code>. - For company owned employee tokens (accounting offices) the ID from <code>/company/>withLoginAccess</code> can be used as username for accessing client accounts. - If you need to create the header yourself use <code>Authorization: Basic <base64encode('0:sessionToken')></code>. ## Tags: - <div class="tag-icon-beta"></div> **[BETA]** This is a beta endpoint and can be subject to change. - <div class="tag-icon-deprecated"></div> **[DEPRECATED]** Deprecated means that we intend to remove/change this feature or capability in a future "major" API release. We therefore discourage all use of this feature/capability. ## Fields: Use the `fields` parameter to specify which fields should be returned. This also supports fields from sub elements. Example values: - `project,activity,hours` returns `{project:..., activity:...., hours:...}`. - just `project` returns `"project" : { "id": 12345, "url": "tripletex.no/v2/projects/12345" }`. - `project(*)` returns `"project" : { "id": 12345 "name":"ProjectName" "number.....startDate": "2013-01-07" }`. - `project(name)` returns `"project" : { "name":"ProjectName" }`. - All elements and some subElements : `*,activity(name),employee(*)`. ## Changes: To get the changes for a resource, `changes` have to be explicitly specified as part of the `fields` parameter, e.g. `*,changes`. There are currently two types of change available: - `CREATE` for when the resource was created - `UPDATE` for when the resource was updated NOTE: For objects created prior to October 24th 2018 the list may be incomplete, but will always contain the CREATE and the last change (if the object has been changed after creation). ## Rate limiting in each response header: Rate limiting is performed on the API calls for an employee for each API consumer. Status regarding the rate limit is returned as headers: - `X-Rate-Limit-Limit` - The number of allowed requests in the current period. - `X-Rate-Limit-Remaining` - The number of remaining requests. - `X-Rate-Limit-Reset` - The number of seconds left in the current period. Once the rate limit is hit, all requests will return HTTP status code `429` for the remainder of the current period. ## Response envelope: ``` { "fullResultSize": ###, "from": ###, // Paging starting from "count": ###, // Paging count "versionDigest": "Hash of full result", "values": [...list of objects...] } { "value": {...single object...} } ``` ## WebHook envelope: ``` { "subscriptionId": ###, "event": "object.verb", // As listed from /v2/event/ "id": ###, // Object id "value": {... single object, null if object.deleted ...} } ``` ## Error/warning envelope: ``` { "status": ###, // HTTP status code "code": #####, // internal status code of event "message": "Basic feedback message in your language", "link": "Link to doc", "developerMessage": "More technical message", "validationMessages": [ // Will be null if Error { "field": "Name of field", "message": "Validation failure information" } ], "requestId": "UUID used in any logs" } ``` ## Status codes / Error codes: - **200 OK** - **201 Created** - From POSTs that create something new. - **204 No Content** - When there is no answer, ex: "/:anAction" or DELETE. - **400 Bad request** - - **4000** Bad Request Exception - **11000** Illegal Filter Exception - **12000** Path Param Exception - **24000** Cryptography Exception - **401 Unauthorized** - When authentication is required and has failed or has not yet been provided - **3000** Authentication Exception - **9000** Security Exception - **403 Forbidden** - When AuthorisationManager says no. - **404 Not Found** - For content/IDs that does not exist. - **6000** Not Found Exception - **409 Conflict** - Such as an edit conflict between multiple simultaneous updates - **7000** Object Exists Exception - **8000** Revision Exception - **10000** Locked Exception - **14000** Duplicate entry - **422 Bad Request** - For Required fields or things like malformed payload. - **15000** Value Validation Exception - **16000** Mapping Exception - **17000** Sorting Exception - **18000** Validation Exception - **21000** Param Exception - **22000** Invalid JSON Exception - **23000** Result Set Too Large Exception - **429 Too Many Requests** - Request rate limit hit - **500 Internal Error** - Unexpected condition was encountered and no more specific message is suitable - **1000** Exception
Provides a concise DSL to map, validate and import data from an excel sheet into your ruby app
Multistep form concept for Rails projects. Allows to create complex forms for a few models simultaneously. Supports selectable per step validations without data persistence into db.
A project that is an attempt to rehabilitate and generalize a data ingestion/importation service originally built for a retail, e-commerce platform. It aims to provide a robust solution for mapping intermediate representations of database records (CSV at the moment) to persisted data. The process allows simulation, validation, and control of the arrangement of the final data form. The ultimate goal is a project that is flexible enough to use in a pure-Ruby, Rails, or standalone application backed by data storage of your choice (as long as model representations can be accessed via Ruby).
Simple solution for validate all data in database
Gem for validating and serializing data
Rails' default update_attributes behavior is that when any validation fails, none of the data gets saved. However, in some instances this is not the most ideal behavior. If you import partial data which users then have the task of completing, not saving partially completed forms can create a really negative user experience and decrease overall completion (or conversion) rates. This gem encapsulates the logic I've used to ensure that partially completed forms still persist.
The `password_auth` gem provides a simple and secure way to handle password authentication in Ruby applications. It offers a set of reusable components and utilities to handle user passwords, including password hashing, salting, and validation. Key Features: - Secure password storage: The gem uses industry-standard techniques, such as bcrypt hashing and salt generation, to securely store user passwords. - Password validation: It provides convenient methods to validate the strength and complexity of user passwords, ensuring they meet specific criteria. - Password encryption: Easily encrypt passwords for storage or comparison purposes, protecting sensitive user data. - Password reset functionality: Includes utilities for generating and handling password reset tokens, enabling users to securely reset their passwords. - Integration with popular frameworks: Seamlessly integrates with Ruby on Rails, Sinatra, and other Ruby frameworks, making it easy to incorporate password authentication into your application. By using the `password_auth` gem, developers can implement robust password authentication functionality in their Ruby applications with minimal effort, ensuring the security and integrity of user passwords.
# Foxtrot Ruby Client Library This is the Ruby client library for interacting with the Foxtrot API. The only endpoint currently exposed is the route optimization endpoint (`Foxtrot::Client.optimize!`). In order to make requests, you need a valid API key. Your API key can be found at the bottom of any page in the [Foxtrot web app](http://app.foxtrot.io/). ## Installation `gem install foxtrot-client` ## Usage ```ruby data = { file_url: "https://www.domain.io/your_file.xlsx", file_name: "your_file.xlsx", geocode: "false", stop_name: "Customer", lat: "Lat", lng: "Long", load: "Load", service_time: "Service Time", time_window: "Time Window", extra_info: "Contact Info", date_starting: "1407712069593", warehouse: "77 Massachusetts Ave, Cambridge MA", num_drivers: 1, num_avg_service_time: 10, float_fuel_cost: 3.56, float_driver_wage: 6.01, float_mpg: 8.32 } api_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' require 'foxtrot' fox = Foxtrot::Client.new api_key resp = fox.optimize!(data).poll_and_block! result = resp.get_result ```
DataMapper plugin for performing validations on data models
This filter helps to verify if the given JSON data is valid with JSON schema
FX rates are read from an XML file and stored locally into a hash map. Then FX rate between two selected currencies is calculated for a given date. There are checks about data validity, such as date and currency format.
GuideRail transforms various data sources into safe, immutable `Data` objects. By leveraging the robust validation capabilities of `dry-schema`, it provides a clear and declarative way to define, validate, and instantiate your data structures.
A comprehensive Ruby client for interacting with the Rospatent patent search API. Features include automatic caching, request validation, structured logging, error handling, and batch operations for efficient patent data retrieval.
This gem supplies a `fa` executable which can create, read, update and delete data using the Freeagent API. You need to specify valid Freeagent app credentials. Generate a Freeagent app at https://dev.freeagent.com/apps. Ensure you set 'http://localhost:*/' as a valid OAuth redirect URI. Then export your ID and secret as environment variables FREEAGENT_APP_ID and FREEAGENT_APP_SECRET. On first run, `fa` will authenticate you via OAuth so watch out for an authentication URI printed to the console.
Castkit is a lightweight, type-safe Ruby DSL for defining, validating, and serializing structured data objects. Inspired by DTO patterns, it supports nested types, access control, custom serializers, and more.
Automatically infer and create Ruby Struct-like classes from arbitrary data sources with runtime type validation
A data validation library providing a rule-based schema definition language. For checking (incoming) data against a specified schema definition. GDS stands for General Data Structure.
Defines the skills cards data model and methods to validate whether given data matches this model.
DbValidator helps identify invalid records in your Rails application that don't meet model validation requirements. It finds records that became invalid after validation rule changes, and validates imported or manually edited data. You can use it to audit records before deploying new validations and catch any data that bypassed validation checks.
This is a simple machine learning library written in Ruby. It provides implementations of linear regression and multiclass perceptron and visualization and validation methods to verify results. Also included are helper methods to work with training and testing data.
This is an improved input function for Ruby. Using this gem, you can easily get user input with real-time type validation, ensuring that the data provided is as expected, among other things. If you have any questions, check the documentation: https://github.com/barrosflavio/ruby_better_input Features: - Ask, receive and check input in a single line - Support for types such as integer, float and boolean. - Input validation with clear error messages. - Intuitive and easy-to-use function.
The DynamicSchema gem provides a elegant and expressive way to define a domain-specific language (DSL) schemas, making it effortless to build and validate complex Ruby hashes. This is particularly useful when dealing with intricate configurations or interfacing with external APIs, where data structures need to adhere to specific formats and validations. By allowing default values, type constraints, nested schemas, and transformations, DynamicSchema ensures that your data structures are both robust and flexible.
AdaptiveConfiguration is an elegant, lightweight and simple, yet powerful Ruby gem that allows you to define a DSL (Domain-Specific Language) for structured and hierarchical configurations. It is ideal for defining complex configurations for various use cases, such as API clients, application settings, or any scenario where structured configuration is needed. In addition AdaptiveConfiguration can be more generally used to transform and validate JSON data from any source such as from a network request or API reponse.
The auto_seeder gem generates random, valid data for Rails models using Faker. It can seed data for multiple models, handle associations and respect validations.
Bed is a simple, modern schema library built on top of Data. It provides a simple, declarative way to define schemas for your data, and a way to validate that data against those schemas.
Data validation and transformation library.
# Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query="end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00" curl -i "https://api-eu.getaround.com/owner/v1/invoices?${query}" \ -H "Authorization: Bearer TOKEN" \ -H "Accept:application/json" \ -H "Content-Type:application/json" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i "https://api-eu.getaround.com/owner/v1/invoices/12345" \ -H "Authorization: Bearer TOKEN" \ -H "Accept: application/json" \ -H "Content-Type: application/json"" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel="next" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href="mailto:owner-api@getaround.com">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action="/docs/api/owner/fire_ping_webhook" method="post"><input type="submit" value="Send Ping Event"></form> You should receive the following JSON payload: ```json { "data": { "ping": "pong" }, "type": "ping", "occurred_at": "2019-04-18T08:30:05Z" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) "I got some JSON: #{push.inspect}" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) "I got some JSON: #{push.inspect}" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, "Signatures didn't match!" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a "constant time" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
Sukima is a lightweight data schema validation library for Ruby written in only ~100 lines of code. It provides a simple and flexible way to define constraints for data and validate it.
UsStatesData is a versatile Ruby gem designed to simplify working with US state data. Whether you're building a geographic application, conducting data analysis, or enhancing your project with location-based features, UsStatesData provides a comprehensive set of methods to streamline your workflow. With UsStatesData, you can effortlessly retrieve detailed information about US states, including lists of counties and zip codes. Need to validate zip codes? UsStatesData has you covered with built-in functionality for zip code validation, ensuring data accuracy and reliability. Whether you're a developer looking to integrate US state data into your application or a data enthusiast exploring geographic trends, UsStatesData empowers you with the tools you need to unlock insights and build impactful solutions.
Data structure to hold validation and process errors