Module: Nihaopay::Queryable::ClassMethods

Defined in:
lib/nihaopay/mixins/queryable.rb

Instance Method Summary collapse

Instance Method Details

#after(time) ⇒ Object



30
31
32
# File 'lib/nihaopay/mixins/queryable.rb', line 30

def after(time)
  q.after(time)
end

#before(time) ⇒ Object



26
27
28
# File 'lib/nihaopay/mixins/queryable.rb', line 26

def before(time)
  q.before(time)
end

#fetch(options = {}) ⇒ Object



16
17
18
19
20
# File 'lib/nihaopay/mixins/queryable.rb', line 16

def fetch(options = {})
  options[:starting_after] = options.delete(:after) if options[:after]
  options[:ending_before] = options.delete(:before) if options[:before]
  q.fetch(options)
end

#find(transaction_id) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/nihaopay/mixins/queryable.rb', line 8

def find(transaction_id)
  url = "#{base_url}/transactions/#{transaction_id}"
  response = HTTParty.get(url, headers: request_headers)
  build_from_response!(response)
rescue Nihaopay::TransactionError => e
  raise Nihaopay::TransactionLookUpError, e.message
end

#limit(num) ⇒ Object



22
23
24
# File 'lib/nihaopay/mixins/queryable.rb', line 22

def limit(num)
  q.limit(num)
end