Class: Rubill::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/rubill/query.rb

Defined Under Namespace

Classes: Filter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, opts = {}) ⇒ Query

Returns a new instance of Query.



6
7
8
9
# File 'lib/rubill/query.rb', line 6

def initialize(url, opts={})
  self.url = url
  self.options = opts
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/rubill/query.rb', line 4

def options
  @options
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/rubill/query.rb', line 3

def url
  @url
end

Class Method Details

.create(entity, object = {}) ⇒ Object



24
25
26
# File 'lib/rubill/query.rb', line 24

def self.create(entity, object={})
  execute("/Crud/Create/#{entity}.json", obj: object)
end

.delete(entity, id) ⇒ Object



32
33
34
# File 'lib/rubill/query.rb', line 32

def self.delete(entity, id)
  execute("/Crud/Delete/#{entity}.json", id: id)
end

.execute(url, options) ⇒ Object



76
77
78
# File 'lib/rubill/query.rb', line 76

def self.execute(url, options)
  new(url, options).execute
end

.get_check_image_data(id) ⇒ Object



68
69
70
# File 'lib/rubill/query.rb', line 68

def self.get_check_image_data(id)
  execute("/GetCheckImageData.json", sentPayId: id)
end

.get_disbursement_data(id) ⇒ Object



64
65
66
# File 'lib/rubill/query.rb', line 64

def self.get_disbursement_data(id)
  execute("/GetDisbursementData.json", sentPayId: id)
end

.list(entity, start = 0, step = 999, filters = []) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/rubill/query.rb', line 11

def self.list(entity, start=0, step=999, filters=[])
  execute(
      "/List/#{entity}.json",
      start: start,
      max: step,
      filters: filters.map(&:to_hash),
   )
end

.pay_bills(opts = {}) ⇒ Object



36
37
38
# File 'lib/rubill/query.rb', line 36

def self.pay_bills(opts={})
  execute("/PayBills.json", opts)
end

.read(entity, id) ⇒ Object



20
21
22
# File 'lib/rubill/query.rb', line 20

def self.read(entity, id)
  execute("/Crud/Read/#{entity}.json", id: id)
end

.receive_payment(opts = {}) ⇒ Object



40
41
42
# File 'lib/rubill/query.rb', line 40

def self.receive_payment(opts={})
  execute("/RecordARPayment.json", opts)
end

.send_payment(opts = {}) ⇒ Object



44
45
46
# File 'lib/rubill/query.rb', line 44

def self.send_payment(opts={})
  execute("/RecordAPPayment.json", opts)
end

.send_vendor_invite(vendorId, email) ⇒ Object



60
61
62
# File 'lib/rubill/query.rb', line 60

def self.send_vendor_invite(vendorId, email)
  execute("/SendVendorInvite.json", vendorId: vendorId, email: email)
end

.update(entity, object = {}) ⇒ Object



28
29
30
# File 'lib/rubill/query.rb', line 28

def self.update(entity, object={})
  execute("/Crud/Update/#{entity}.json", obj: object)
end

.upload_attachment(opts = {}) ⇒ Object



48
49
50
# File 'lib/rubill/query.rb', line 48

def self.upload_attachment(opts={})
  execute("/UploadAttachment.json", opts)
end

.void_received_payment(id) ⇒ Object



56
57
58
# File 'lib/rubill/query.rb', line 56

def self.void_received_payment(id)
  execute("/VoidARPayment.json", id: id)
end

.void_sent_payment(id) ⇒ Object



52
53
54
# File 'lib/rubill/query.rb', line 52

def self.void_sent_payment(id)
  execute("/VoidAPPayment.json", sentPayId: id)
end

Instance Method Details

#executeObject



72
73
74
# File 'lib/rubill/query.rb', line 72

def execute
  Session.instance.execute(self)
end