Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

Commit

Permalink
add corporation endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
ealdent committed Sep 13, 2011
1 parent be5a322 commit ecbfa13
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 2 additions & 0 deletions lib/neweden.rb
Expand Up @@ -6,10 +6,12 @@
require File.join(File.dirname(__FILE__), 'neweden', 'errors')
require File.join(File.dirname(__FILE__), 'neweden', 'account')
require File.join(File.dirname(__FILE__), 'neweden', 'character')
require File.join(File.dirname(__FILE__), 'neweden', 'corporation')

class NewEden
include Account
include Character
include Corporation

REQUEST_TIMEOUT = 60000 # 60 seconds
CACHE_TIMEOUT = 300 # 5 minutes
Expand Down
24 changes: 24 additions & 0 deletions lib/neweden/corporation.rb
@@ -0,0 +1,24 @@
module Corporation
CORPORATION_ENDPOINTS = %w{ AccountBalance AssetList ContactList ContainerLog Contracts CorporationSheet FacWarStats
IndustryJobs Killlog MarketOrders Medals MemberMedals MemberSecurity MemberSecurityLog MemberTracking OutpostList
OutpostServiceDetail Shareholders Standings StarbaseDetail StarbaseList Titles WalletJournal WalletTransactions
}

CORPORATION_ENDPOINTS.each do |endpoint|
module_eval <<-RUBY
def corp_#{endpoint.underscore}(character_id)
corportaion_request("/corp/#{endpoint}.xml.aspx", character_id)
end
RUBY
end

alias :corp_account_balances :corp_account_balance
alias :corp_factional_warfare_stats :corp_fac_war_stats
alias :corp_kill_log :corp_killlog

private

def corportaion_request(endpoint, character_id)
request(endpoint, :post, :characterID => character_id)
end
end
11 changes: 0 additions & 11 deletions lib/neweden/string_extensions.rb

This file was deleted.

0 comments on commit ecbfa13

Please sign in to comment.