-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* release/3.1.1: 3.1.1 Removed unecessary require Updated travis url Moved inspect with email to verification resource since others won't have it. Also updated test. Fixed error handling to be more standard. Fixed bin/console that didn't work properly. Improved tests to not load active_record except where needed. Added requires for json and net/http that are needed in plain ruby environments. Add #to_json on APIResources
- Loading branch information
Showing
12 changed files
with
104 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
emailable (3.0.2) | ||
emailable (3.1.1) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "bundler/setup" | ||
require "emailable/ruby" | ||
require 'bundler/setup' | ||
require 'emailable' | ||
|
||
# You can add fixtures and/or initialization code here to make experimenting | ||
# with your gem easier. You can also use a different console, if you like. | ||
|
||
# (If you use this, don't forget to add pry to your Gemfile!) | ||
# require "pry" | ||
# require 'pry' | ||
# Pry.start | ||
|
||
require "irb" | ||
require 'irb' | ||
IRB.start(__FILE__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Emailable | ||
class Error < StandardError; end | ||
class BadRequestError < Error; end | ||
class UnauthorizedError < Error; end | ||
class PaymentRequiredError < Error; end | ||
class ForbiddenError < Error; end | ||
class NotFoundError < Error; end | ||
class TooManyRequestsError < Error; end | ||
class InternalServerError < Error; end | ||
class ServiceUnavailableError < Error; end | ||
class TimeoutError < Error; end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Emailable | ||
VERSION = '3.1.0' | ||
VERSION = '3.1.1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require 'active_model' | ||
require 'test_helper' | ||
|
||
class EmailValidatorTest < Minitest::Test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require 'test_helper' | ||
|
||
module Emailable | ||
module Resources | ||
class APIResourceTest < Minitest::Test | ||
class Example < APIResource | ||
attr_accessor :foo, :bar, :baz | ||
end | ||
|
||
def setup | ||
@e = Example.new(foo: 'abc', bar: 123, baz: true) | ||
end | ||
|
||
def test_init | ||
assert_equal 'abc', @e.foo | ||
assert_equal 123, @e.bar | ||
assert_equal true, @e.baz | ||
end | ||
|
||
def test_to_h | ||
correct = { | ||
foo: 'abc', | ||
bar: 123, | ||
baz: true, | ||
} | ||
assert_equal correct, @e.to_h | ||
assert_equal correct, @e.to_hash | ||
end | ||
|
||
def test_to_json | ||
correct = %q|{"foo":"abc","bar":123,"baz":true}| | ||
assert_equal correct, @e.to_json | ||
end | ||
|
||
def test_inspect | ||
correct = <<~STR.chomp | ||
#<> JSON: { | ||
"foo": "abc", | ||
"bar": 123, | ||
"baz": true | ||
} | ||
STR | ||
output = @e.inspect.gsub(/<.*>/, '<>') | ||
assert_equal correct, output | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters