superbot-cloud 0.1.19 → 0.1.20

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
  SHA256:
3
- metadata.gz: 5a9d3104480558f1d2611d811fe52920244cf502ab70d1a0ffc7d6d4f9e28a9c
4
- data.tar.gz: ef334a9ad002c647fb9029b7704a02d78ca53266415e3ca6b6f3c7419ed74b3f
3
+ metadata.gz: f149174047438d78cdf91f26516e2795ba53b9ab701b7dd4563d036384702fd2
4
+ data.tar.gz: 1a7607932dfc2aa85903c0090c90dfef8879cc046e78335a6144254e0843d8e7
5
5
  SHA512:
6
- metadata.gz: d133a15f010b11308d09a31d0f24ecabb956ae1e9e944758f3c8d8b59f51f3fe0d01f099b70442ad67404a35e0f5236b8c8347101657b52b9bab975bf6564a83
7
- data.tar.gz: 58ef5bfebf9d0eea808ad5bced543e56af3162542aa195343ce9fc373ab2c5b44076dcaebbf46f4f5fb351017551965bdd24820150519ed52c852225b53097ed
6
+ metadata.gz: 88024f39aaf13db2702d47b7b0b0ec8e27b736e966ba6b06e8176386caa4169e6a3d18084713d3c2775fb1b1d5ee61918e509fabd778574b1318499823efc9ff
7
+ data.tar.gz: ed809591a0110e3f56d3e56a88f403baccde19a1b0f9c2fe0d4f1614048af9608874ed02781117f6da88b3ab514d9024565ebfb18fa364af410071b42a3a41d2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbot-cloud (0.1.19)
4
+ superbot-cloud (0.1.20)
5
5
  marcel (= 0.3.3)
6
6
  multipart-post (= 2.0.0)
7
7
 
@@ -10,13 +10,19 @@ GEM
10
10
  specs:
11
11
  addressable (2.5.2)
12
12
  public_suffix (>= 2.0.2, < 4.0)
13
+ archive-zip (0.11.0)
14
+ io-like (~> 0.3.0)
13
15
  ast (2.4.0)
14
16
  childprocess (0.9.0)
15
17
  ffi (~> 1.0, >= 1.0.11)
18
+ chromedriver-helper (2.1.0)
19
+ archive-zip (~> 0.10)
20
+ nokogiri (~> 1.8)
16
21
  clamp (1.2.1)
17
22
  diff-lcs (1.3)
18
23
  excon (0.62.0)
19
24
  ffi (1.9.25)
25
+ io-like (0.3.0)
20
26
  jaro_winkler (1.5.1)
21
27
  kommando (0.1.2)
22
28
  launchy (2.4.3)
@@ -24,8 +30,11 @@ GEM
24
30
  marcel (0.3.3)
25
31
  mimemagic (~> 0.3.2)
26
32
  mimemagic (0.3.2)
33
+ mini_portile2 (2.3.0)
27
34
  multipart-post (2.0.0)
28
35
  mustermann (1.0.3)
36
+ nokogiri (1.8.5)
37
+ mini_portile2 (~> 2.3.0)
29
38
  parallel (1.12.1)
30
39
  parser (2.5.1.2)
31
40
  ast (~> 2.4.0)
@@ -68,20 +77,21 @@ GEM
68
77
  rack-protection (= 2.0.4)
69
78
  tilt (~> 2.0)
70
79
  sinatra-silent (0.0.1)
71
- superbot (0.1.28)
80
+ superbot (0.1.29)
72
81
  clamp (= 1.2.1)
73
82
  kommando (~> 0.1)
74
83
  launchy (= 2.4.3)
75
- selenium-webdriver (~> 3.14, >= 3.14.0)
76
84
  sinatra (= 2.0.4)
77
85
  sinatra-silent (= 0.0.1)
78
- superbot-cloud (~> 0.1.18)
79
- superbot-teleport (~> 0.2.1)
86
+ superbot-cloud (~> 0.1.19)
87
+ superbot-selenium-webdriver (~> 1.0.1)
88
+ superbot-teleport (~> 0.2.2)
80
89
  zaru (= 0.2.0)
81
- superbot-teleport (0.2.1)
82
- clamp (= 1.2.1)
90
+ superbot-selenium-webdriver (1.0.1)
91
+ chromedriver-helper (= 2.1.0)
92
+ selenium-webdriver (= 3.141.0)
93
+ superbot-teleport (0.2.2)
83
94
  excon
84
- kommando (~> 0.1)
85
95
  tilt (2.0.9)
86
96
  unicode-display_width (1.4.0)
87
97
  zaru (0.2.0)
@@ -7,14 +7,17 @@ module Superbot
7
7
  module Api
8
8
  BASE_URI = "#{Superbot::Cloud::BASE_URI}/api/v1"
9
9
  ENDPOINT_MAP = {
10
- login: { method: :post, endpoint: 'sessions' },
11
- token: { method: :post, endpoint: 'token' },
12
- organization_list: { method: :get, endpoint: 'organizations' },
13
- test_list: { method: :get, endpoint: 'tests' },
14
- test_upload: { method: :post_multipart, endpoint: 'tests' },
15
- delete_test: { method: :delete, endpoint: 'tests', required_param: :name },
16
- webdriver_session_list: { method: :get, endpoint: 'webdriver_sessions' },
17
- delete_webdriver_session: { method: :delete, endpoint: 'webdriver_sessions', required_param: :session_id }
10
+ login: { method: :post, endpoint: 'sessions' },
11
+ token: { method: :post, endpoint: 'token' },
12
+ organization_list: { method: :get, endpoint: 'organizations' },
13
+ test_list: { method: :get, endpoint: 'tests' },
14
+ test_upload: { method: :post_multipart, endpoint: 'tests' },
15
+ delete_test: { method: :delete, endpoint: 'tests', required_param: :name },
16
+ webdriver_session_list: { method: :get, endpoint: 'webdriver_sessions' },
17
+ delete_webdriver_session: { method: :delete, endpoint: 'webdriver_sessions', required_param: :session_id },
18
+ organization_members_list: { method: :get, endpoint: 'members' },
19
+ organization_add_member: { method: :post, endpoint: 'members' },
20
+ organization_remove_member: { method: :delete, endpoint: 'members', required_param: :username }
18
21
  }.freeze
19
22
 
20
23
  def self.request(type, params: {})
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Superbot
4
+ module Cloud
5
+ module CLI
6
+ module Member
7
+ class AddCommand < BaseCommand
8
+ parameter "USERNAME", "Username of a user to add", required: true
9
+
10
+ def execute
11
+ add_member
12
+ end
13
+
14
+ def add_member
15
+ api_response = Superbot::Cloud::Api.request(:organization_add_member, params: { organization_name: organization, username: username })
16
+ puts "Succesfully added %<username>s to %<organization>s organization" % api_response.slice(:username, :organization)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Superbot
4
+ module Cloud
5
+ module CLI
6
+ module Member
7
+ class BaseCommand < Clamp::Command
8
+ option ["--org"], "ORGANIZATION", "Organization to to take actions on", attribute_name: :organization
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Superbot
4
+ module Cloud
5
+ module CLI
6
+ module Member
7
+ class ListCommand < BaseCommand
8
+ def execute
9
+ list_members
10
+ end
11
+
12
+ def list_members
13
+ api_response = Superbot::Cloud::Api.request(:organization_members_list, params: { organization_name: @organization })
14
+ abort api_response[:error] if api_response[:error]
15
+ puts "Organization: #{api_response[:organization]}"
16
+ puts "Members:"
17
+ puts(api_response[:members].map { |m| m[:username] })
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Superbot
4
+ module Cloud
5
+ module CLI
6
+ module Member
7
+ class RemoveCommand < BaseCommand
8
+ parameter "USERNAME", "Username of a user to remove"
9
+
10
+ def execute
11
+ remove_member
12
+ end
13
+
14
+ def remove_member
15
+ api_response = Superbot::Cloud::Api.request(:organization_remove_member, params: { organization_name: organization, username: username })
16
+ puts "Member successfully removed from organization"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'member/base_command'
4
+ require_relative 'member/add_command'
5
+ require_relative 'member/remove_command'
6
+ require_relative 'member/list_command'
7
+
8
+ module Superbot
9
+ module Cloud
10
+ module CLI
11
+ class MemberCommand < Clamp::Command
12
+ include Superbot::Cloud::Validations
13
+
14
+ subcommand ['add'], "Add member to organization", Member::AddCommand
15
+ subcommand ['remove'], "Remove member from organization", Member::RemoveCommand
16
+ subcommand ['list'], "List your organization members", Member::ListCommand
17
+
18
+
19
+ def self.run
20
+ require_login
21
+ super
22
+ rescue StandardError => exc
23
+ warn exc.message
24
+ warn exc.backtrace.join("\n")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -6,6 +6,7 @@ require_relative 'version_command'
6
6
  require_relative 'organization_command'
7
7
  require_relative 'test_command'
8
8
  require_relative 'webdriver_command'
9
+ require_relative 'member_command'
9
10
 
10
11
  module Superbot
11
12
  module Cloud
@@ -16,6 +17,7 @@ module Superbot
16
17
  subcommand(['org'], 'Manage your organizations', OrganizationCommand)
17
18
  subcommand ['test'], "Manage your tests", TestCommand
18
19
  subcommand ['webdriver'], "Manage your webdriver sessions", WebdriverCommand
20
+ subcommand ['member'], "Manage your organization members", MemberCommand
19
21
 
20
22
  option ['-v', '--version'], :flag, "Show version information" do
21
23
  puts Superbot::Cloud::VERSION
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Superbot
4
4
  module Cloud
5
- VERSION = "0.1.19"
5
+ VERSION = "0.1.20"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superbot-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Superbots
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-10 00:00:00.000000000 Z
11
+ date: 2018-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -135,6 +135,11 @@ files:
135
135
  - lib/superbot/cloud/api.rb
136
136
  - lib/superbot/cloud/cli.rb
137
137
  - lib/superbot/cloud/cli/login_command.rb
138
+ - lib/superbot/cloud/cli/member/add_command.rb
139
+ - lib/superbot/cloud/cli/member/base_command.rb
140
+ - lib/superbot/cloud/cli/member/list_command.rb
141
+ - lib/superbot/cloud/cli/member/remove_command.rb
142
+ - lib/superbot/cloud/cli/member_command.rb
138
143
  - lib/superbot/cloud/cli/organization/list_command.rb
139
144
  - lib/superbot/cloud/cli/organization_command.rb
140
145
  - lib/superbot/cloud/cli/root_command.rb