Class: Sigiss::Invoice

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, Integration
Defined in:
lib/sigiss/invoice.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Integration

#cancel!, #data_cancel, #data_fetch, #data_issue, #fetch!, #issue!

Constructor Details

#initialize(attributes = {}) ⇒ Invoice

Returns a new instance of Invoice.



12
13
14
15
16
17
18
# File 'lib/sigiss/invoice.rb', line 12

def initialize(attributes = {})
  @gateway = attributes[:gateway]
  @provider = attributes[:provider]
  @taker = attributes[:taker]
  @success = false
  @response = {}
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



8
9
10
# File 'lib/sigiss/invoice.rb', line 8

def data
  @data
end

#gatewayObject

Returns the value of attribute gateway.



8
9
10
# File 'lib/sigiss/invoice.rb', line 8

def gateway
  @gateway
end

#providerObject

Returns the value of attribute provider.



8
9
10
# File 'lib/sigiss/invoice.rb', line 8

def provider
  @provider
end

#responseObject

Returns the value of attribute response.



8
9
10
# File 'lib/sigiss/invoice.rb', line 8

def response
  @response
end

#successObject

Returns the value of attribute success.



8
9
10
# File 'lib/sigiss/invoice.rb', line 8

def success
  @success
end

#takerObject

Returns the value of attribute taker.



8
9
10
# File 'lib/sigiss/invoice.rb', line 8

def taker
  @taker
end

Instance Method Details

#build(method, params = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sigiss/invoice.rb', line 20

def build(method, params = {})
  case method
  when :issue
    @data = Sigiss::IssueData.new(params)
  when :fetch
    @data = Sigiss::FetchData.new(params)
  when :cancel
    @data = Sigiss::CancelData.new(params)
  else
    @data = {}
  end
end

#success?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/sigiss/invoice.rb', line 33

def success?
  @success
end