Module: Nihaopay::Queryable::ClassMethods
- Defined in:
- lib/nihaopay/mixins/queryable.rb
Instance Method Summary collapse
- #after(time) ⇒ Object
- #before(time) ⇒ Object
- #fetch(options = {}) ⇒ Object
- #find(transaction_id) ⇒ Object
- #limit(num) ⇒ Object
Instance Method Details
#after(time) ⇒ Object
32 33 34 |
# File 'lib/nihaopay/mixins/queryable.rb', line 32 def after(time) q.after(time.strftime(TIME_FORMAT)) end |
#before(time) ⇒ Object
28 29 30 |
# File 'lib/nihaopay/mixins/queryable.rb', line 28 def before(time) q.before(time.strftime(TIME_FORMAT)) end |
#fetch(options = {}) ⇒ Object
18 19 20 21 22 |
# File 'lib/nihaopay/mixins/queryable.rb', line 18 def fetch( = {}) [:starting_after] = .delete(:after).strftime(TIME_FORMAT) if [:after] [:ending_before] = .delete(:before).strftime(TIME_FORMAT) if [:before] q.fetch() end |
#find(transaction_id) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/nihaopay/mixins/queryable.rb', line 10 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. end |
#limit(num) ⇒ Object
24 25 26 |
# File 'lib/nihaopay/mixins/queryable.rb', line 24 def limit(num) q.limit(num) end |