Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from matiasmansilla1989/master
Include the Customer endpoint logic
- Loading branch information
Showing
9 changed files
with
64 additions
and
8 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
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,17 @@ | ||
module White | ||
class Customer | ||
|
||
def self.create(params={}) | ||
White.post(White.api_url('customers/'), params) | ||
end | ||
|
||
def self.get(id) | ||
White.get(White.api_url('customers/' + id.to_s)) | ||
end | ||
|
||
def self.all | ||
White.get(White.api_url('customers/')) | ||
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
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,29 @@ | ||
require_relative '../../spec_helper' | ||
# require_relative '../../../lib/white/customer' | ||
|
||
describe White::Customer do | ||
|
||
it "must create a new customer" do | ||
White.api_key = "test_sec_k_25dd497d7e657bb761ad6" | ||
|
||
response = White::Customer.create( | ||
:name => "Abdullah Ahmed", | ||
:email => "abdullah@msn.com", | ||
:card => { | ||
:number => "4242424242424242", | ||
:exp_month => 11, | ||
:exp_year => 2016, | ||
:cvc => 123 | ||
}, | ||
:description => "Signed up at the Trade Show in Dec 2014" | ||
) | ||
|
||
response['name'].must_equal "Abdullah Ahmed" | ||
end | ||
|
||
it "must list created customers" do | ||
response = White::Customer.all() | ||
response.wont_be_empty | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,4 +126,4 @@ | |
e.http_status.must_equal 422 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
|
||
#dependencies | ||
gem 'minitest' | ||
require 'minitest/autorun' | ||
require 'minitest/autorun' |