Skip to content

Commit

Permalink
change status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
andela-fugwu committed Sep 26, 2015
1 parent 793f32b commit a15de4b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ result = NgBankParser::Router.parse(bank_key, file_path, password)

```ruby
result = {
status: 1,
status: 200,
data: {
bank_name: the_bank_name,
account_number: the_account_number,
Expand All @@ -55,7 +55,7 @@ result = {

```ruby
result = {
status: 0,
status: 400,
message: "RELEVANT ERROR MESSAGE"
}
```
Expand Down
4 changes: 2 additions & 2 deletions lib/ng-bank-parser/parsers/accessbank-pdf-parser/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ def get_transactions(pdf_array)


def error(msg)
{ status: 0, message: msg }
{ status: 400, message: msg }
end

def success(data)
{ status: 1, data: data }
{ status: 200, data: data }
end


Expand Down
4 changes: 2 additions & 2 deletions lib/ng-bank-parser/parsers/firstbank-pdf-parser/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ def is_row_invalid? row

def error_message msg
return {
status: 0,
status: 400,
message: msg
}
end


def send_response data
return {
status: 1,
status: 200,
data: data
}
end
Expand Down
4 changes: 2 additions & 2 deletions lib/ng-bank-parser/parsers/gtb-excel-parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ def xls_parse(file)

def error_message(text)
return {
status: 0,
status: 400,
message: text
}
end

def send_response(data)
return {
status: 1,
status: 200,
data: data
}
end
Expand Down
4 changes: 2 additions & 2 deletions lib/ng-bank-parser/parsers/hb-pdf-parser/hb_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module NgBankParser
module HbConstants
ACCEPTED_FORMATS = ['.pdf']

INVALID_ACCOUNT_STATUS = 0
VALID_ACCOUNT_STATUS = 1
INVALID_ACCOUNT_STATUS = 400
VALID_ACCOUNT_STATUS = 200

SECOND_PAGE_INDEX = 1
DURATION_DATE_LINE_INDEX = 3
Expand Down
4 changes: 2 additions & 2 deletions lib/ng-bank-parser/parsers/uba-pdf-parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def set_dates

def return_payload
return {
status: 1,
status: 200,
data: {
bank_name: @bank_name,
account_number: @account_number,
Expand All @@ -101,7 +101,7 @@ def return_payload

def invalid_file
return {
status: 0, message: INVALID_FILE_STRING
status: 400, message: INVALID_FILE_STRING
}
end

Expand Down
4 changes: 2 additions & 2 deletions spec/banks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
response = class_object.parse(invalid_file_path)

it "returns proper response" do
expect(response[:status]).to eq(0);
expect(response[:status]).to eq(400);
end
end

Expand All @@ -74,7 +74,7 @@
response = class_object.parse(valid_file_path, password)

it "parses statement correctly" do
expect(response[:status]).to eq(1)
expect(response[:status]).to eq(200)
expect(response[:data]).to match({
:bank_name => an_instance_of(String),
:account_number => an_instance_of(String),
Expand Down

0 comments on commit a15de4b

Please sign in to comment.