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
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( = {}) [:starting_after] = .delete(:after) if [:after] [:ending_before] = .delete(:before) if [:before] q.fetch() 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. end |
#limit(num) ⇒ Object
22 23 24 |
# File 'lib/nihaopay/mixins/queryable.rb', line 22 def limit(num) q.limit(num) end |