Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meteor API Helper Class #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api_helper_class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a Helper Class to be used in Meteor.
30 changes: 30 additions & 0 deletions api_helper_class/lemonwayapi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Title: LemonwayAPI
Author: Jonathan Forrider
Author Website: http://jfwebdesigns.altervista.org/
Description: A Class used to build the connection to the Lemonway Payment Processor
Dependencies: Meteor and http meteor module
*/
import { HTTP } from 'meteor/http'

export default class LemonwayAPI {
constructor (params) {
this._url = params.url;
this._httpMethod = params.httpMethod; //The URL provided by Lemonway
this._walletMethod = params.walletMethod; //Specific Controller methods located on Lemonway's servers
this._postData = params.postData;
}

request (callback) {
let options = {
headers: {
"Content-Type": "application/json; charset=utf-8"
},
data: this._postData
}

if (this._url.substring(this._url.length) !== '/') this._url = this._url+'/';

HTTP.call(this._httpMethod, this._url + this._walletMethod, options, callback);
}
}