forked from ekomi-ltd/fastbill-automatic
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfastbill-automatic.rb
More file actions
75 lines (64 loc) · 2.6 KB
/
fastbill-automatic.rb
File metadata and controls
75 lines (64 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
require "net/http"
require "net/https"
require "json"
require "fastbill-automatic/version"
module Fastbill
module Automatic
API_BASE = "app.monsum.com"
API_VERSION = "1.0"
ROOT_PATH = File.dirname(__FILE__)
@@api_key = nil
@@email = nil
autoload :Base, "fastbill-automatic/base"
autoload :Customer, "fastbill-automatic/customer"
autoload :Invoice, "fastbill-automatic/invoice"
autoload :Item, "fastbill-automatic/item"
autoload :Subscription, "fastbill-automatic/subscription"
autoload :Template, "fastbill-automatic/template"
autoload :Article, "fastbill-automatic/article"
autoload :Coupon, "fastbill-automatic/coupon"
autoload :Payment, "fastbill-automatic/payment"
autoload :Webhook, "fastbill-automatic/webhook"
module Services
autoload :Get, "fastbill-automatic/services/get"
autoload :Create, "fastbill-automatic/services/create"
autoload :Update, "fastbill-automatic/services/update"
autoload :Delete, "fastbill-automatic/services/delete"
autoload :DeleteItem, "fastbill-automatic/services/delete_item"
autoload :Cancel, "fastbill-automatic/services/cancel"
autoload :Changearticle, "fastbill-automatic/services/changearticle"
autoload :Complete, "fastbill-automatic/services/complete"
autoload :Sign, "fastbill-automatic/services/sign"
autoload :Sendbyemail, "fastbill-automatic/services/sendbyemail"
autoload :Sendbypost, "fastbill-automatic/services/sendbypost"
autoload :Setaddon, "fastbill-automatic/services/setaddon"
autoload :Setpaid, "fastbill-automatic/services/setpaid"
autoload :Setusagedata, "fastbill-automatic/services/setusagedata"
end
module Request
autoload :Base, "fastbill-automatic/request/base"
autoload :Connection, "fastbill-automatic/request/connection"
autoload :Info, "fastbill-automatic/request/info"
autoload :Validator, "fastbill-automatic/request/validator"
end
class FastbillError < StandardError; end
class AuthenticationError < FastbillError; end
class APIError < FastbillError; end
def self.api_key
@@api_key
end
def self.api_key=(api_key)
@@api_key = api_key
end
def self.email
@@email
end
def self.email=(email)
@@email = email
end
def self.request(service, data, limit=nil, offset=nil)
info = Request::Info.new(service, data, limit, offset)
Request::Base.new(info).perform
end
end
end