aws_account_utils 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85f32a777448e44c4427fba054cd2538709eec5e
4
- data.tar.gz: fe866c5493265e7cc1cc0dbe0fb242bb34befa38
3
+ metadata.gz: dd2fc4b4d415b2a0e009fc0c45ca4229f35b52df
4
+ data.tar.gz: 6e00bc736c4a4936d7a2e24600209907d03be45d
5
5
  SHA512:
6
- metadata.gz: 4f543711bf33001e2ad630f5448fe2fa8adce4a6811fdcc14f00b0c3276532985a368e860f6991679dfdc204026cbe25377f512abd26e1addaac6978fad01ee3
7
- data.tar.gz: 8cca8925fed7092ce42273039e6975875737917c12240d7c4aa081781318e0c866a52bcfdcec66c0746ee8376ddc9e4688e5fbf119f0ad1b895d8c94ad20d39d
6
+ metadata.gz: ee23f14287d6477ee440318f4916b239d5388e49dd3a9062d48aad7efdcccb91ae3f9f59e84973c66c678e63ebb063b339de38316c911372c5af19652c74772e
7
+ data.tar.gz: 100c953341ea98e55f613609f7106758835db7be61d7744ff632289cb4b95823531c4c050c5e804d700154ee5cfe422dcf03e17eebbcb3ca693361afad656adb
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.2.3
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 Intuit Inc
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/intuit/aws_account_utils?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1
2
  [![Build Status](https://travis-ci.org/intuit/aws_account_utils.svg?branch=feature_delete_account)](https://travis-ci.org/intuit/aws_account_utils)
2
3
  [![Coverage Status](https://coveralls.io/repos/intuit/aws_account_utils/badge.svg?branch=feature_delete_account&service=github)](https://coveralls.io/github/intuit/aws_account_utils)
3
4
  [![Gem Version](https://badge.fury.io/rb/aws_account_utils.svg)](https://badge.fury.io/rb/aws_account_utils)
@@ -5,6 +6,8 @@
5
6
 
6
7
  # AwsAccountUtils
7
8
 
9
+ [![Join the chat at https://gitter.im/intuit/aws_account_utils](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/intuit/aws_account_utils?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
10
+
8
11
  A collection of helpers for creating and modifying AWS account details that can not be done using any existing AWS API
9
12
 
10
13
  Special Note: the `create_account` operation requires that your IP be white-listed by AWS in order to bypass the CAPTCHA
@@ -34,8 +37,8 @@ Overview
34
37
 
35
38
  If you are required to go through a proxy, the following should be set prior to execution.
36
39
  ```
37
- export no_proxy=127.0.0.1
38
- export http_proxy=myproxyhots.com
40
+ export AWS_ACCOUNT_UTILS_HTTP_PROXY=myproxyhots.com
41
+ export AWS_ACCOUNT_UTILS_HTTP_PROXY_PORT=80
39
42
  ```
40
43
 
41
44
  ```ruby
@@ -62,6 +65,7 @@ aws_utils = AwsAccountUtils::AwsAccountUtils.new(
62
65
  * [request_consolidated_billing](#request_consolidated_billing)
63
66
  * [set_alternate_contacts](#set_alternate_contacts)
64
67
  * [set_challenge_questions](#set_challenge_questions)
68
+ * [set_company_name](#set_company_name)
65
69
 
66
70
  create_account
67
71
  ------------
@@ -95,7 +99,7 @@ resp #=> String
95
99
  account_name: (required, String) - The account name to associate with this new account
96
100
  account_email: (required, String) - The email to associate with this new account
97
101
  account_password: (required, String) - The password to use with this new account
98
- account_details: (required, Hash) - Hash of account deatails
102
+ account_details: (required, Hash) - Hash of account details
99
103
  ```
100
104
 
101
105
  **Returns:**
@@ -465,6 +469,36 @@ answers: (optional, Hash) - A hash of answers to fill in for the security questi
465
469
 
466
470
  ---
467
471
 
472
+ set_company_name
473
+ ------------
474
+
475
+ > Sets company name for the account (any time after account is created)
476
+
477
+ `set_company_name(account_email:, account_password:, company_name:)`
478
+
479
+ **Examples:**
480
+ ```Ruby
481
+
482
+ resp = aws_utils.set_alternate_contacts(account_email: 'adfefef@gmail.com',
483
+ account_password: 'foobar1212121,
484
+ name: 'The Munsters, Inc.')
485
+ resp #=> True/False
486
+ ```
487
+
488
+ **Parameters:**
489
+ ```
490
+ account_email: (required, String) - The email address to use with this account
491
+ account_password: (required, String) - The password to use with this account
492
+ contact_info: (required, String) - The company name to add to this account
493
+
494
+ ```
495
+
496
+ **Returns:**
497
+
498
+ `#return => Boolean`
499
+
500
+ ---
501
+
468
502
  ## Development
469
503
 
470
504
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
1
  require 'rspec/core/rake_task'
2
2
  task :default => :spec
3
3
  RSpec::Core::RakeTask.new
4
+
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.required_ruby_version = '~> 2.1'
21
+ spec.required_ruby_version = '~> 2.2'
22
22
 
23
23
  spec.add_development_dependency 'bundler', '>= 1.6.5'
24
24
  spec.add_development_dependency 'webmock', '~> 1.21', '>= 1.21.0'
@@ -13,6 +13,7 @@ require 'aws_account_utils/consolidated_billing'
13
13
  require 'aws_account_utils/root_access_keys'
14
14
  require 'aws_account_utils/password'
15
15
  require 'aws_account_utils/alternate_contacts'
16
+ require 'aws_account_utils/company_name'
16
17
  require 'aws_account_utils/logout'
17
18
 
18
19
  module AwsAccountUtils
@@ -148,12 +149,21 @@ module AwsAccountUtils
148
149
  raise ArgumentError, "contact_info: must be a hash." unless contact_info.is_a?(Hash)
149
150
 
150
151
  resp = alternate_contacts.set account_email, account_password, contact_info
151
- logger.info 'Set alterante contacts.' if resp
152
+ logger.info 'Set alternate contacts.' if resp
152
153
  resp
153
154
  ensure
154
155
  browser.close rescue nil
155
156
  end
156
157
 
158
+ def set_company_name(account_email:, account_password:, name:)
159
+ resp = company_name.set account_email, account_password, name
160
+ logger.info 'Set company name.' if resp
161
+ resp
162
+ ensure
163
+ browser.close rescue nil
164
+ end
165
+
166
+
157
167
  private
158
168
  def account_registration
159
169
  @account_registration ||= AccountRegistration.new logger, browser
@@ -163,6 +173,10 @@ module AwsAccountUtils
163
173
  @alternate_contacts ||= AlternateContacts.new logger, browser
164
174
  end
165
175
 
176
+ def company_name
177
+ @company_name ||= CompanyName.new logger, browser
178
+ end
179
+
166
180
  def browser
167
181
  @browser ||= WatirBrowser.new(logger).create
168
182
  end
@@ -211,4 +225,4 @@ module AwsAccountUtils
211
225
  @logout ||= Logout.new logger, browser
212
226
  end
213
227
  end
214
- end
228
+ end
@@ -0,0 +1,35 @@
1
+ require 'aws_account_utils/base'
2
+ require 'aws_account_utils/login'
3
+
4
+ module AwsAccountUtils
5
+ class CompanyName < Base
6
+ attr_reader :logger, :browser
7
+
8
+ def initialize(logger, browser)
9
+ @logger = logger
10
+ @browser = browser
11
+ end
12
+
13
+ def set(account_email, account_password, company_name)
14
+ logger.debug "Updating Company Name details."
15
+ Login.new(logger, browser).execute url,
16
+ account_email,
17
+ account_password
18
+ browser.a(:xpath => '//a[@ng-click="toggleEditingContactInfoState()"]').when_present.click
19
+ browser.input(:xpath => '//input[@ng-model="address.company"]').to_subtype.set(company_name)
20
+ # screenshot(browser, "1")
21
+ browser.button(:xpath => '//button[@ng-click="updateContactInformation()"]').when_present.click
22
+ browser.div(:xpath => '//div[@ng-show="options.status == \'success\'"]').wait_until_present
23
+ true
24
+ rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e
25
+ screenshot(browser, "error")
26
+ raise StandardError, "#{self.class.name} - #{e}"
27
+ end
28
+
29
+ private
30
+ def url
31
+ 'https://console.aws.amazon.com/billing/home?#/account'
32
+ end
33
+
34
+ end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module AwsAccountUtils
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -35,16 +35,20 @@ module AwsAccountUtils
35
35
  def proxy_settings
36
36
  {
37
37
  'http' => proxy,
38
- 'http_port' => 80,
38
+ 'http_port' => proxy_port,
39
39
  'ssl' => proxy,
40
- 'ssl_port' => 80,
40
+ 'ssl_port' => proxy_port,
41
41
  'no_proxies_on' => '127.0.0.1',
42
42
  'type' => 1
43
43
  }
44
44
  end
45
45
 
46
46
  def proxy
47
- @proxy ||= ENV['HTTP_PROXY']
47
+ @proxy ||= ENV['AWS_ACCOUNT_UTILS_HTTP_PROXY']
48
+ end
49
+
50
+ def proxy_port
51
+ @proxy_port ||= ENV['AWS_ACCOUNT_UTILS_HTTP_PROXY_PORT']
48
52
  end
49
53
  end
50
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_account_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - keviny22
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -178,6 +178,7 @@ files:
178
178
  - CHANGELOG.md
179
179
  - CODE_OF_CONDUCT.md
180
180
  - Gemfile
181
+ - LICENSE
181
182
  - README.md
182
183
  - Rakefile
183
184
  - aws_account_utils.gemspec
@@ -190,6 +191,7 @@ files:
190
191
  - lib/aws_account_utils/alternate_contacts.rb
191
192
  - lib/aws_account_utils/base.rb
192
193
  - lib/aws_account_utils/challenge_questions.rb
194
+ - lib/aws_account_utils/company_name.rb
193
195
  - lib/aws_account_utils/consolidated_billing.rb
194
196
  - lib/aws_account_utils/customer_information.rb
195
197
  - lib/aws_account_utils/customize_url.rb
@@ -214,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
216
  requirements:
215
217
  - - "~>"
216
218
  - !ruby/object:Gem::Version
217
- version: '2.1'
219
+ version: '2.2'
218
220
  required_rubygems_version: !ruby/object:Gem::Requirement
219
221
  requirements:
220
222
  - - ">="
@@ -222,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
224
  version: '0'
223
225
  requirements: []
224
226
  rubyforge_project:
225
- rubygems_version: 2.2.2
227
+ rubygems_version: 2.4.5.1
226
228
  signing_key:
227
229
  specification_version: 4
228
230
  summary: A set of helper methods for configuring aspects of AWS that do not have an