Module: Eve::API::Connectivity
- Included in:
- Eve::API
- Defined in:
- lib/eve/api/connectivity.rb
Constant Summary collapse
- MAX_JOURNAL_ENTRIES =
1000
Instance Method Summary collapse
- #request(namespace, service_name, options = {}) ⇒ Object
- #walk(walk_id, walk_association, options = {}, &block) ⇒ Object
Instance Method Details
#request(namespace, service_name, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/eve/api/connectivity.rb', line 26 def request(namespace, service_name, = {}) walk_id = .delete(:walk_id) # we don't want these being sent to the server; it messes with the cache. walk_association = .delete(:walk_association) if .delete(:walk) walk(walk_id.to_s, walk_association, ) do || Eve::API::Request.new(namespace, service_name, self..merge()).dispatch end else Eve::API::Request.new(namespace, service_name, self..merge()).dispatch end end |
#walk(walk_id, walk_association, options = {}, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/eve/api/connectivity.rb', line 6 def walk(walk_id, walk_association, = {}, &block) raise ArgumentError, "Requires :walk_id" if walk_id.blank? raise ArgumentError, "Requires :walk_association" if walk_association.blank? [walk_id] ||= 0 return_value = yield array = return_value.send(walk_association) if array.size >= MAX_JOURNAL_ENTRIES begin min_id = nil primary_key = array.primary_key array.each { |txn| min_id = txn.send(primary_key) if min_id.nil? || min_id > txn.send(primary_key) } array.concat walk(walk_id, .merge(walk_id => min_id), &block).send(walk_association) rescue Eve::Errors::UserInputErrors::InvalidBeforeTransID, Eve::Errors::UserInputErrors::InvalidBeforeRefID, Eve::Errors::UserInputErrors::InvalidBeforeKillID # walking is internal, so we should catch the error internally too. end end return_value end |