merchant_e_solutions 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7add1626363d840b4974f3adedf34cff88fd66d4
4
- data.tar.gz: 9a4dec58b2beb871d15c0a799c561aa47c36401d
3
+ metadata.gz: e767aa0bd99777d38ddc626e68de1bf4e6ba6081
4
+ data.tar.gz: 438be6695dfc51170b25d9488152cd9042dea91b
5
5
  SHA512:
6
- metadata.gz: de22fdf53c9258167f64a4cad21b7b130674bf1947f756c3661962c2c8e847d126299e65357918a350ccb7c73906b33ef7c49d3fb6d4f8a3a8eb627655ed72b0
7
- data.tar.gz: ff662ca1789f99d575d4156bf5bacc7bade3bd124ff4f661d2e67de4f9df9922fe5cd128e1713cabeeb466b92a1d64e90a26302295ffc19374e0f729954a8199
6
+ metadata.gz: 66057cc796b9f806c0de9e9eeeccbe92b327d69bd8c60e8a52438d747d8797f1e367e3aa7fdb0e46ecf21657d8515be0efad4d2d063d36cefa596ba60c5f80d1
7
+ data.tar.gz: c69957292063d26c1f8bfd0f46e8bf50a5dbbe2abc6ab769bd9381e1f54dc6f43e0ba4c76745645f880ff6f13e3ab3775259d00206802de0bfe559154fdc91ff
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MerchantESolutions
2
2
 
3
- TODO: Write a gem description
3
+ A gem to more easily interact with the Merchant e-Solutions API[(v2.3)](http://resources.merchante-solutions.com/download/attachments/1411006/MeS+Reporting+API+ver2.3+March+2013.pdf).
4
4
 
5
5
  ## Installation
6
6
 
@@ -17,8 +17,34 @@ Or install it yourself as:
17
17
  $ gem install merchant_e_solutions
18
18
 
19
19
  ## Usage
20
+ Request a report:
21
+ ```ruby
22
+ report = MerchantESolutions.settlement_detail_report
23
+ ```
24
+ Each report has records which hold all the data passed back and some convience methods:
25
+ ```
26
+ record = report.records.first
27
+
28
+ record.card_code # => "MD"
29
+ record.credit_company # => "MasterCard"
30
+ record.credit_type # => "Debit"
31
+ ```
32
+
33
+ ## Configuration
34
+
35
+ Add your user id and password in an initializer:
36
+ ```ruby
37
+ MerchantESolutions.configure do |config|
38
+ config.user_id = "yourUserID"
39
+ config.password = "yourPassword"
40
+ end
41
+ ```
42
+ or as environment variables:
43
+ ```bash
44
+ echo $MERCHANT_E_SOLUTIONS_USER_ID # yourUserID
45
+ echo $MERCHANT_E_SOLUTIONS_PASSWORD # yourPassword
46
+ ```
20
47
 
21
- TODO: Write usage instructions here
22
48
 
23
49
  ## Contributing
24
50
 
@@ -1,5 +1,25 @@
1
- require "merchant_e_solutions/version"
1
+ require 'merchant_e_solutions/configuration'
2
+ require 'merchant_e_solutions/report'
3
+ require 'merchant_e_solutions/request'
4
+ require 'merchant_e_solutions/settlement_detail_report'
5
+ require 'merchant_e_solutions/settlement_detail_record'
6
+ require 'merchant_e_solutions/settlement_summary_record'
7
+ require 'merchant_e_solutions/settlement_summary_report'
2
8
 
3
9
  module MerchantESolutions
4
- # Your code goes here...
10
+
11
+ class << self
12
+ def configure
13
+ yield(Configuration)
14
+ end
15
+
16
+ def settlement_summary_report(options = {})
17
+ SettlementSummaryReport.new(options)
18
+ end
19
+
20
+ def settlement_detail_report(options = {})
21
+ SettlementDetailReport.new(options)
22
+ end
23
+ end
24
+
5
25
  end
@@ -0,0 +1,15 @@
1
+ module MerchantESolutions
2
+ class Configuration
3
+ class << self
4
+ attr_writer :user_id, :password
5
+
6
+ def user_id
7
+ @user_id ||= ENV['MERCHANT_E_SOLUTIONS_USER_ID']
8
+ end
9
+
10
+ def password
11
+ @password ||= ENV['MERCHANT_E_SOLUTIONS_PASSWORD']
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,46 @@
1
+ module MerchantESolutions
2
+ class Report
3
+ attr_reader :request, :records
4
+
5
+ def initialize(params = {})
6
+ self.options = params
7
+ @request = Request.new(request_params).body
8
+ parse_records(request)
9
+ end
10
+
11
+ def request_params
12
+ {
13
+ dsReportId: report_id,
14
+ reportType: report_type
15
+ }.merge(report_specific_params)
16
+ end
17
+
18
+ def report_specific_params
19
+ options
20
+ end
21
+
22
+
23
+ private
24
+
25
+ attr_accessor :options
26
+
27
+ def report_id
28
+ raise "Implement in instances of sub-class"
29
+ end
30
+
31
+ def report_type
32
+ raise "Implement in instances of sub-class"
33
+ end
34
+
35
+ def record_class
36
+ raise "Implement in instances of sub-class"
37
+ end
38
+
39
+ def parse_records(request)
40
+ @records = []
41
+ CSV.parse(request, headers: true) do |csv|
42
+ records << record_class.new(csv)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,45 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+
4
+ module MerchantESolutions
5
+ class Request
6
+ BASE_URL = "https://www.merchante-solutions.com/jsp/reports/report_api.jsp"
7
+
8
+ attr_reader :body
9
+
10
+ def initialize(options = {})
11
+ @options = options
12
+ get_request
13
+ end
14
+
15
+ def uri
16
+ URI.parse(BASE_URL + '?' + param_string)
17
+ end
18
+
19
+
20
+ private
21
+
22
+ attr_reader :options
23
+
24
+ def get_request
25
+ @body = http.request(Net::HTTP::Get.new(uri.request_uri)).body
26
+ end
27
+
28
+ def param_string
29
+ URI.encode_www_form(base_params.merge(options))
30
+ end
31
+
32
+ def base_params
33
+ {
34
+ userId: Configuration.user_id,
35
+ userPass: Configuration.password,
36
+ }
37
+ end
38
+
39
+ def http
40
+ @http ||= Net::HTTP.new(uri.host, uri.port).tap do |http|
41
+ http.use_ssl = true
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,56 @@
1
+ module MerchantESolutions
2
+ class SettlementDetailRecord
3
+
4
+ attr_accessor :organization_id, :organization_name, :term_number, :batch_number, :batch_date,
5
+ :transaction_date, :card_code, :card_number, :reference_number, :purchase_id, :auth_code,
6
+ :entry_mode, :transaction_amount, :trident_transaction_id, :client_reference_number
7
+
8
+ def initialize(row)
9
+ @organization_id = row[0]
10
+ @organization_name = row[1]
11
+ @term_number = row[2]
12
+ @batch_number = row[3]
13
+ @batch_date = parse_date(row[4])
14
+ @transaction_date = parse_date(row[5])
15
+ @card_code = row[6]
16
+ @card_number = row[7]
17
+ @reference_number = row[8]
18
+ @purchase_id = row[9]
19
+ @auth_code = row[10]
20
+ @entry_mode = row[11]
21
+ @transaction_amount = row[12]
22
+ @trident_transaction_id = row[13]
23
+ @client_reference_number = row[14]
24
+ end
25
+
26
+ def credit_company
27
+ {
28
+ "AM" => "American Express",
29
+ "DS" => "Discover",
30
+ "MB" => "MasterCard",
31
+ "MC" => "MasterCard",
32
+ "MD" => "MasterCard",
33
+ "VB" => "Visa",
34
+ "VD" => "Visa",
35
+ "VS" => "Visa",
36
+ }.fetch(card_code, card_code)
37
+ end
38
+
39
+ def credit_type
40
+ if ["MC", "VS", "AM", "DS"].include? card_code
41
+ "Credit"
42
+ elsif ["MD", "VD"].include? card_code
43
+ "Debit"
44
+ elsif ["MB", "VB"].include? card_code
45
+ "Business"
46
+ end
47
+ end
48
+
49
+
50
+ private
51
+
52
+ def parse_date(date)
53
+ Date.strptime(date, "%m/%d/%Y") if date
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,21 @@
1
+ require 'csv'
2
+
3
+ module MerchantESolutions
4
+ class SettlementDetailReport < Report
5
+
6
+
7
+ private
8
+
9
+ def report_id
10
+ 2
11
+ end
12
+
13
+ def report_type
14
+ 1
15
+ end
16
+
17
+ def record_class
18
+ SettlementDetailRecord
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module MerchantESolutions
2
+ class SettlementSummaryRecord
3
+
4
+ attr_reader :organization_id, :organization_name, :credit_company,
5
+ :sales_count, :sales_amount, :credits_count, :credits_amount, :net_amount
6
+
7
+ def initialize(row)
8
+ @organization_id = row[0]
9
+ @organization_name = row[1]
10
+ @credit_company = row[2]
11
+ @sales_count = row[3]
12
+ @sales_amount = row[4]
13
+ @credits_count = row[5]
14
+ @credits_amount = row[6]
15
+ @net_amount = row[7]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ require 'csv'
2
+
3
+ module MerchantESolutions
4
+ class SettlementSummaryReport < Report
5
+
6
+
7
+ private
8
+
9
+ def report_id
10
+ 2
11
+ end
12
+
13
+ def report_type
14
+ 0
15
+ end
16
+
17
+ def record_class
18
+ SettlementSummaryRecord
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module MerchantESolutions
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "pry"
22
23
  spec.add_development_dependency "rake"
23
24
  spec.add_development_dependency "rspec"
24
25
  end
@@ -0,0 +1,8 @@
1
+ "Merchant Id","DBA Name","Term Num","Batch Num","Batch Date","Tran Date","Card Type","Card Number","Reference","Purchase Id","Auth Code","Entry Mode","Tran Amount","Trident Tran Id","Client Ref Num"
2
+ 42,"Hamazon","1",220,10/07/2013,10/06/2013,"AM","000000xxxxxx0000","'0000000","AAAAAAAAAAA0","100000","KEYED",7.09,null,
3
+ 42,"Hamazon","1",220,10/07/2013,10/06/2013,"VS","000000xxxxxx0001","'0000001","AAAAAAAAAAA1","100001","KEYED",10.0,null,
4
+ 42,"Hamazon","1",220,10/07/2013,10/06/2013,"VD","000000xxxxxx0002","'0000002","AAAAAAAAAAA2","100002","KEYED",50.0,null,
5
+ 42,"Hamazon","1",220,10/07/2013,10/06/2013,"DS","000000xxxxxx0003","'0000003","AAAAAAAAAAA3","100003","KEYED",5.0,null,
6
+ 42,"Hamazon","1",220,10/07/2013,10/06/2013,"MC","000000xxxxxx0004","'0000004","AAAAAAAAAAA4","100004","KEYED",2.0,null,
7
+ 42,"Hamazon","1",220,10/07/2013,10/06/2013,"MB","000000xxxxxx0005","'0000005","AAAAAAAAAAA5","100005","KEYED",15.0,null,
8
+ 42,"Hamazon","1",220,10/07/2013,10/06/2013,"MD","000000xxxxxx0006","'0000006","AAAAAAAAAAA6","100006","KEYED",22.33,null,
@@ -0,0 +1,9 @@
1
+ "Org Id","Org Name","Card Type","Sales Cnt","Sales Amt","Credits Cnt","Credits Amt","Net Amt"
2
+ 42,"Hamazon",Visa,258,654.45,0,0.0,654.45
3
+ 42,"Hamazon",Mastercard,85,256.77,1,-25.0,231.77
4
+ 42,"Hamazon",Debit/EBT,0,0.0,0,0.0,0.0
5
+ 42,"Hamazon",Bill Me Later,0,0.0,0,0.0,0.0
6
+ 42,"Hamazon",American Express,97,12345.98,0,0.0,12345.98
7
+ 42,"Hamazon",Discover,18,4875.25,0,0.0,4875.25
8
+ 42,"Hamazon",Diners Club,0,0.0,0,0.0,0.0
9
+ 42,"Hamazon",JCB,0,0.0,0,0.0,0.0
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe MerchantESolutions::Report do
4
+ #Abstract class, tested in each subclass
5
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe MerchantESolutions::Request do
4
+ before { stub_net_http_requests }
5
+
6
+ describe "#initialize" do
7
+ let(:http_request) { double(:request, body: "Nice Body") }
8
+ let(:http) { double(:http, "use_ssl=" => true, request: double.as_null_object) }
9
+
10
+ before { Net::HTTP.stub(:new).and_return(http) }
11
+
12
+ it "calls out to the Merchant e-Solutions API" do
13
+ http.should_receive(:request).and_return(http_request)
14
+
15
+ MerchantESolutions::Request.new.body.should == http_request.body
16
+ end
17
+
18
+ it "securely calls out to the MeS API" do
19
+ http.should_receive(:use_ssl=).with(true)
20
+
21
+ MerchantESolutions::Request.new
22
+ end
23
+ end
24
+
25
+ describe "#uri" do
26
+ subject { MerchantESolutions::Request.new(options).uri.to_s }
27
+ let(:options) { {} }
28
+
29
+ it { should include "https://www.merchante-solutions.com/jsp/reports/report_api.jsp?" }
30
+ it { should include "userId=#{MerchantESolutions::Configuration.user_id}" }
31
+ it { should include "userPass=#{MerchantESolutions::Configuration.password}" }
32
+
33
+ context "when options are passed into" do
34
+ let(:options) { {dsReportId: 17} }
35
+ it { should include "dsReportId=17" }
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,84 @@
1
+ require 'spec_helper'
2
+
3
+ describe MerchantESolutions::SettlementDetailRecord do
4
+ describe "#initialize" do
5
+ subject { MerchantESolutions::SettlementDetailRecord.new(csv_row) }
6
+
7
+ # "Merchant Id","DBA Name","Term Num","Batch Num","Batch Date","Tran Date","Card Type","Card Number","Reference","Purchase Id","Auth Code","Entry Mode","Tran Amount","Trident Tran Id","Client Ref Num"
8
+ let(:csv_row) { [42, "Hamazon", 1, 220, "10/07/2013", "10/06/2013", "AM", "000000xxxxxx1234", "'0000213", "AAAAAAAAAAA0", "100000", "KEYED", 7.09, "T.T.ID", "clientRefNumber"] }
9
+
10
+ its(:organization_id) { should == 42 }
11
+ its(:organization_name) { should == "Hamazon" }
12
+ its(:term_number) { should == 1 }
13
+ its(:batch_number) { should == 220 }
14
+ it "parses out the transaction date" do
15
+ subject.batch_date.day.should == 7
16
+ subject.batch_date.month.should == 10
17
+ subject.batch_date.year.should == 2013
18
+ end
19
+ it "parses out the transaction date" do
20
+ subject.transaction_date.day.should == 6
21
+ subject.transaction_date.month.should == 10
22
+ subject.transaction_date.year.should == 2013
23
+ end
24
+ its("transaction_date.month") { should == 10 }
25
+ its(:card_code) { should == "AM" }
26
+ its(:card_number) { should == "000000xxxxxx1234" }
27
+ its(:reference_number) { "'0000213"}
28
+ its(:purchase_id) { "AAAAAAAAAAA0" }
29
+ its(:auth_code) { "AAAAAAAAAAA0" }
30
+ its(:entry_mode) { "AAAAAAAAAAA0" }
31
+ its(:transaction_amount) { should == 7.09 }
32
+ its(:trident_transaction_id) { should == "T.T.ID" }
33
+ its(:client_reference_number) { should == "clientRefNumber" }
34
+ end
35
+
36
+ describe "credit cards" do
37
+ subject { MerchantESolutions::SettlementDetailRecord.new([nil, nil, nil, nil, nil, nil, card_code]) }
38
+
39
+ context "when the code is AM" do
40
+ let(:card_code) { "AM" }
41
+ its(:credit_company) { should == "American Express" }
42
+ end
43
+ context "when the code is DS" do
44
+ let(:card_code) { "DS" }
45
+ its(:credit_company) { should == "Discover" }
46
+ its(:credit_type) { should == "Credit" }
47
+ end
48
+ context "when the code is MB" do
49
+ let(:card_code) { "MB" }
50
+ its(:credit_company) { should == "MasterCard" }
51
+ its(:credit_type) { should == "Business" }
52
+ end
53
+ context "when the code is MC" do
54
+ let(:card_code) { "MC" }
55
+ its(:credit_company) { should == "MasterCard" }
56
+ its(:credit_type) { should == "Credit" }
57
+ end
58
+ context "when the code is MD" do
59
+ let(:card_code) { "MD" }
60
+ its(:credit_company) { should == "MasterCard" }
61
+ its(:credit_type) { should == "Debit" }
62
+ end
63
+ context "when the code is VB" do
64
+ let(:card_code) { "VB" }
65
+ its(:credit_company) { should == "Visa" }
66
+ its(:credit_type) { should == "Business" }
67
+ end
68
+ context "when the code is VD" do
69
+ let(:card_code) { "VD" }
70
+ its(:credit_company) { should == "Visa" }
71
+ its(:credit_type) { should == "Debit" }
72
+ end
73
+ context "when the code is VS" do
74
+ let(:card_code) { "VS" }
75
+ its(:credit_company) { should == "Visa" }
76
+ its(:credit_type) { should == "Credit" }
77
+ end
78
+ context "when the code is unknown" do
79
+ let(:card_code) { "something you've never seen" }
80
+ its(:credit_company) { should == card_code }
81
+ its(:credit_type) { should be_nil }
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe MerchantESolutions::SettlementDetailReport do
4
+ before { stub_net_http_requests }
5
+
6
+ describe "#initialize" do
7
+ let(:request) { double(:request, body: request_fixture('settlement_detail')) }
8
+
9
+ before { MerchantESolutions::Request.stub(:new).and_return(request) }
10
+
11
+ it "gets a new report from the MerchantESolutions API" do
12
+ MerchantESolutions::Request.should_receive(:new).and_return(request)
13
+
14
+ MerchantESolutions::SettlementDetailReport.new
15
+ end
16
+
17
+ it "parses the body of the request as a CSV" do
18
+ report = MerchantESolutions::SettlementDetailReport.new
19
+
20
+ report.records.size.should be > 0
21
+
22
+ report.records.each do |record|
23
+ record.should be_a MerchantESolutions::SettlementDetailRecord
24
+ end
25
+ end
26
+ end
27
+
28
+ describe "#request_params" do
29
+ let(:request_params) { MerchantESolutions::SettlementDetailReport.new(options).request_params }
30
+ let(:options) { Hash.new }
31
+
32
+ it "knows its dsReportId" do
33
+ request_params[:dsReportId].should == 2
34
+ end
35
+
36
+ it "knows its reportType" do
37
+ request_params[:reportType].should == 1
38
+ end
39
+
40
+ context "when options are passed in" do
41
+ let(:options) { {test: 'params'} }
42
+
43
+ it "merges in the options" do
44
+ request_params[:test].should == 'params'
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe MerchantESolutions::SettlementSummaryRecord do
4
+ describe "#initialize" do
5
+ subject { MerchantESolutions::SettlementSummaryRecord.new(csv_row) }
6
+ # "Org Id","Org Name","Card Type","Sales Cnt","Sales Amt","Credits Cnt","Credits Amt","Net Amt"
7
+ let(:csv_row) { ['42', "Hamazon", "Visa", 1337, 1000000000.0, 1, 0.01, 999999999.99] }
8
+
9
+ its(:organization_id) { should == '42' }
10
+ its(:organization_name) { should == "Hamazon" }
11
+ its(:credit_company) { should == "Visa" }
12
+ its(:sales_count) { should == 1337 }
13
+ its(:sales_amount) { should == 1000000000.0 }
14
+ its(:credits_count) { should == 1 }
15
+ its(:credits_amount) { should == 0.01 }
16
+ its(:net_amount) { should == 999999999.99 }
17
+ end
18
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe MerchantESolutions::SettlementSummaryReport do
4
+ before { stub_net_http_requests }
5
+
6
+ describe "#initialize" do
7
+ let(:request) { double(:request, body: request_fixture('settlement_summary')) }
8
+
9
+ before { MerchantESolutions::Request.stub(:new).and_return(request) }
10
+
11
+ it "gets a new report from the MerchantESolutions API" do
12
+ MerchantESolutions::Request.should_receive(:new).and_return(request)
13
+
14
+ MerchantESolutions::SettlementSummaryReport.new
15
+ end
16
+
17
+ it "parses the body of the request as a CSV" do
18
+ report = MerchantESolutions::SettlementSummaryReport.new
19
+
20
+ report.records.size.should be > 0
21
+
22
+ report.records.each do |record|
23
+ record.should be_a MerchantESolutions::SettlementSummaryRecord
24
+ end
25
+ end
26
+ end
27
+
28
+ describe "#request_params" do
29
+ let(:request_params) { MerchantESolutions::SettlementSummaryReport.new(options).request_params }
30
+ let(:options) { Hash.new }
31
+
32
+ it "knows its dsReportId" do
33
+ request_params[:dsReportId].should == 2
34
+ end
35
+
36
+ it "knows its reportType" do
37
+ request_params[:reportType].should == 0
38
+ end
39
+
40
+ context "when options are passed in" do
41
+ let(:options) { {test: 'params'} }
42
+
43
+ it "merges in the options" do
44
+ request_params[:test].should == 'params'
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe MerchantESolutions do
4
+ before { stub_net_http_requests }
5
+
6
+ describe ".settlement_report" do
7
+ it "returns an Instance of MerchantESolution::SettlementReport" do
8
+ MerchantESolutions.settlement_summary_report.should be_a MerchantESolutions::SettlementSummaryReport
9
+ end
10
+
11
+ it "passes all options directly through to the new SettlementReport" do
12
+ options = {hash: "with", any: "keys", and: "values"}
13
+
14
+ MerchantESolutions::SettlementSummaryReport.should_receive(:new).with(options)
15
+
16
+ MerchantESolutions.settlement_summary_report(options)
17
+ end
18
+ end
19
+
20
+ describe ".settlement_detail_report" do
21
+ it "returns an Instance of MerchantESolution::SettlementReport" do
22
+ MerchantESolutions.settlement_detail_report.should be_a MerchantESolutions::SettlementDetailReport
23
+ end
24
+
25
+ it "passes all options directly through to the new SettlementReport" do
26
+ options = {hash: "with", any: "keys", and: "values"}
27
+
28
+ MerchantESolutions::SettlementDetailReport.should_receive(:new).with(options)
29
+
30
+ MerchantESolutions.settlement_detail_report(options)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,30 @@
1
+ require 'merchant_e_solutions'
2
+ require 'pry'
3
+
4
+ MerchantESolutions.configure do |config|
5
+ config.user_id = "testUserID"
6
+ config.password = "testPassword"
7
+ end
8
+
9
+ RSpec.configure do |config|
10
+ config.treat_symbols_as_metadata_keys_with_true_values = true
11
+ config.run_all_when_everything_filtered = true
12
+ config.filter_run :focus
13
+ config.order = 'random'
14
+ end
15
+
16
+ module Net
17
+ class HTTP
18
+ def request(*args)
19
+ raise "Requests should be stubbed out during tests."
20
+ end
21
+ end
22
+ end
23
+
24
+ def stub_net_http_requests
25
+ Net::HTTP.any_instance.stub(request: double(:request, body: "Nice body!"))
26
+ end
27
+
28
+ def request_fixture(file_name)
29
+ File.read("spec/fixtures/#{file_name}.csv")
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merchant_e_solutions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Ellis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-07 00:00:00.000000000 Z
12
+ date: 2013-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.3'
28
+ - !ruby/object:Gem::Dependency
29
+ name: pry
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: rake
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -62,13 +76,31 @@ extensions: []
62
76
  extra_rdoc_files: []
63
77
  files:
64
78
  - .gitignore
79
+ - .rspec
65
80
  - Gemfile
66
81
  - LICENSE.txt
67
82
  - README.md
68
83
  - Rakefile
69
84
  - lib/merchant_e_solutions.rb
85
+ - lib/merchant_e_solutions/configuration.rb
86
+ - lib/merchant_e_solutions/report.rb
87
+ - lib/merchant_e_solutions/request.rb
88
+ - lib/merchant_e_solutions/settlement_detail_record.rb
89
+ - lib/merchant_e_solutions/settlement_detail_report.rb
90
+ - lib/merchant_e_solutions/settlement_summary_record.rb
91
+ - lib/merchant_e_solutions/settlement_summary_report.rb
70
92
  - lib/merchant_e_solutions/version.rb
71
93
  - merchant_e_solutions.gemspec
94
+ - spec/fixtures/settlement_detail.csv
95
+ - spec/fixtures/settlement_summary.csv
96
+ - spec/lib/merchant_e_solutions/report_spec.rb
97
+ - spec/lib/merchant_e_solutions/request_spec.rb
98
+ - spec/lib/merchant_e_solutions/settlement_detail_record_spec.rb
99
+ - spec/lib/merchant_e_solutions/settlement_detail_report_spec.rb
100
+ - spec/lib/merchant_e_solutions/settlement_summary_record_spec.rb
101
+ - spec/lib/merchant_e_solutions/settlement_summary_report_spec.rb
102
+ - spec/lib/merchant_e_solutions_spec.rb
103
+ - spec/spec_helper.rb
72
104
  homepage: http://github.com/harrystech/merchant_e_solutions
73
105
  licenses:
74
106
  - MIT
@@ -93,4 +125,14 @@ rubygems_version: 2.0.3
93
125
  signing_key:
94
126
  specification_version: 4
95
127
  summary: Wrapper for the Settlement Report API
96
- test_files: []
128
+ test_files:
129
+ - spec/fixtures/settlement_detail.csv
130
+ - spec/fixtures/settlement_summary.csv
131
+ - spec/lib/merchant_e_solutions/report_spec.rb
132
+ - spec/lib/merchant_e_solutions/request_spec.rb
133
+ - spec/lib/merchant_e_solutions/settlement_detail_record_spec.rb
134
+ - spec/lib/merchant_e_solutions/settlement_detail_report_spec.rb
135
+ - spec/lib/merchant_e_solutions/settlement_summary_record_spec.rb
136
+ - spec/lib/merchant_e_solutions/settlement_summary_report_spec.rb
137
+ - spec/lib/merchant_e_solutions_spec.rb
138
+ - spec/spec_helper.rb