Skip to content

Commit

Permalink
Adds test coverage / codeclimate to README
Browse files Browse the repository at this point in the history
  • Loading branch information
kushniryb committed Oct 3, 2016
1 parent 3fe2514 commit a38fde0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Simple Ruby Wrapper to the MaxMind minFraud API

[![Code Climate](https://codeclimate.com/github/kushniryb/minfraud-api-v2/badges/gpa.svg)](https://codeclimate.com/github/kushniryb/minfraud-api-v2)
[![Coverage Status](https://coveralls.io/repos/github/kushniryb/minfraud-api-v2/badge.svg?branch=master)](https://coveralls.io/github/kushniryb/minfraud-api-v2?branch=master)
[![Build Status](https://travis-ci.org/kushniryb/minfraud-api-v2.svg?branch=master)](https://travis-ci.org/kushniryb/minfraud-api-v2)

Compatible with version minFraud API v2.0

[minFraud API documentation](http://dev.maxmind.com/minfraud/)
Expand Down
2 changes: 1 addition & 1 deletion lib/minfraud/components/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Account < Base

# Creates Minfraud::Components::Account instance
# @param [Hash] params hash of parameters
# @return [Minfraud::Components::Account] a Account instance
# @return [Minfraud::Components::Account] an Account instance
def initialize(params = {})
@user_id = params[:user_id]
@username_md5 = params[:username_md5]
Expand Down
6 changes: 6 additions & 0 deletions lib/minfraud/enum.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
module Minfraud
module Enum

def self.included(base)
base.extend(ClassMethods)
end

module ClassMethods
# Returns a hash with in the following format: attribute_name => permitted_values
# @return [Hash] mapping
def mapping
@mapping ||= {}
end

# Creates a set of methods for enum-like behaviour of the attribute
# @param [Symbol] attribute attribute name
# @param [Array] assignable_values a set of values which are permitted
def enum_accessor(attribute, assignable_values)
mapping[attribute] = assignable_values.map(&:to_s)

Expand Down

0 comments on commit a38fde0

Please sign in to comment.