Class: AwsAccountUtils::ConsolidatedBilling
- Defined in:
- lib/aws_account_utils/consolidated_billing.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #confirm(account_email, account_password, confirmation_link) ⇒ Object
- #existing?(account_email, account_password) ⇒ Boolean
-
#initialize(logger, browser) ⇒ ConsolidatedBilling
constructor
A new instance of ConsolidatedBilling.
- #request(master_account_email, master_account_password, account_email) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(logger, browser) ⇒ ConsolidatedBilling
Returns a new instance of ConsolidatedBilling.
7 8 9 10 |
# File 'lib/aws_account_utils/consolidated_billing.rb', line 7 def initialize(logger, browser) @logger = logger @browser = browser end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
5 6 7 |
# File 'lib/aws_account_utils/consolidated_billing.rb', line 5 def browser @browser end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/aws_account_utils/consolidated_billing.rb', line 5 def logger @logger end |
Instance Method Details
#confirm(account_email, account_password, confirmation_link) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/aws_account_utils/consolidated_billing.rb', line 27 def confirm(account_email, account_password, confirmation_link) logger.debug "Confirming consolidated billing" Login.new(logger, browser).execute confirmation_link, account_email, account_password browser.(:class => "btn btn-primary").when_present.click screenshot(browser, "1") browser.span(:text => /Accepting Request/).wait_while_present(timeout = 120) screenshot(browser, "2") true rescue Watir::Wait::TimeoutError, Net::ReadTimeout, StandardError => e screenshot(browser, "error") page_error? raise StandardError, "#{self.class.name} - #{e}" end |
#existing?(account_email, account_password) ⇒ Boolean
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/aws_account_utils/consolidated_billing.rb', line 45 def existing?(account_email, account_password) logger.debug "Checking to see if Consolidated Billing is already setup" Login.new(logger, browser).execute billing_established_url, account_email, account_password browser.h2(:text => /Consolidated Billing/).wait_until_present screenshot(browser, "1") billing_setup? rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e screenshot(browser, "error") raise StandardError, "#{self.class.name} - #{e}" end |
#request(master_account_email, master_account_password, account_email) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/aws_account_utils/consolidated_billing.rb', line 12 def request(master_account_email, master_account_password, account_email) logger.debug "Submitting consolidated billing request from master account #{master_account_email} to #{account_email}" Login.new(logger, browser).execute billing_request_url, master_account_email, master_account_password browser.text_field(:name => "emailaddresses").when_present.set account_email screenshot(browser, "1") browser.(:class => "btn btn-primary margin-left-10").when_present.click browser.h2(:text => /Manage Requests and Accounts/).wait_until_present rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e screenshot(browser, "error") raise StandardError, "#{self.class.name} - #{e}" end |