superbot-cloud 0.1.11 → 0.1.13

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: 95f7b0130f9adf8531a841cda20fa97ad78431b6d7b11109b8fe06fc79a1acc3
4
- data.tar.gz: 197fd5861fd0cac3ce1350099ca69dca9821f82dcda6ed884897e2e21e1e9365
3
+ metadata.gz: c10739967cbc668d1244c50b38d0b8cc3dba4f8c6fdd22a8fdce31fdef52c453
4
+ data.tar.gz: b1f1d0af3db49ff0b73d8dbb8e2f3110b02d29942b87551c1b8354ac3c348ef0
5
5
  SHA512:
6
- metadata.gz: 53c8e647210dd13dbb28bfc3c4fa13afd22846c81640fd30c26ae71d9ce3795d17f3cc573e3ae6a21a240f1a3a6147144e4b9592ebd42517392d5dd094c50965
7
- data.tar.gz: 92123bbb7f3178bf75dc33d60c221b77dfd872ae2f231414bcfc063040c050b8e2104d436a3a5b5c50d4b719354f9d64b608586a4f0fe591dd54130178dd2a33
6
+ metadata.gz: cd23e009917aec06984513d315510a0ec6459b1fa9153afa4c0def55c6b5b686a61fb1676ab25eb2ae01b2dc8d0dae7fcd0fe033f123a4b93b755157a547e501
7
+ data.tar.gz: 78347ed794edcf7321033dc1a6e125f1a89cd29d4083b1096df2e2133b6af7bb8a696468ffd7e5bfbb5eca711785218dcd912263dc589c9f688ccffee0fb5fc8
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbot-cloud (0.1.11)
4
+ superbot-cloud (0.1.13)
5
5
  marcel (= 0.3.3)
6
6
  multipart-post (= 2.0.0)
7
7
 
@@ -60,13 +60,13 @@ GEM
60
60
  rack-protection (= 2.0.3)
61
61
  tilt (~> 2.0)
62
62
  sinatra-silent (0.0.1)
63
- superbot (0.1.14)
63
+ superbot (0.1.16)
64
64
  clamp (= 1.2.1)
65
65
  kommando (~> 0.1)
66
66
  launchy (= 2.4.3)
67
67
  sinatra (= 2.0.3)
68
68
  sinatra-silent (= 0.0.1)
69
- superbot-cloud (~> 0.1.9)
69
+ superbot-cloud (~> 0.1.11)
70
70
  zaru (= 0.2.0)
71
71
  tilt (2.0.8)
72
72
  unicode-display_width (1.4.0)
@@ -80,7 +80,7 @@ DEPENDENCIES
80
80
  rake (~> 10.0)
81
81
  rspec (~> 3.0)
82
82
  rubocop (~> 0.53)
83
- superbot (~> 0.1.13)
83
+ superbot (~> 0.1.16)
84
84
  superbot-cloud!
85
85
 
86
86
  BUNDLED WITH
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Superbot
4
4
  module Cloud
5
- VERSION = "0.1.11"
5
+ VERSION = "0.1.13"
6
6
  end
7
7
  end
@@ -5,21 +5,27 @@ module Superbot
5
5
  LOGIN_URI = "http://#{Superbot::DOMAIN}/login/cloud"
6
6
  CREDENTIALS_PATH = File.join(Dir.home, '.superbot')
7
7
  private_constant :CREDENTIALS_PATH
8
- CREDENTIALS_FILE_PATH = File.join(CREDENTIALS_PATH, 'cloud_token.json')
8
+ CREDENTIALS_FILE_PATH = File.join(CREDENTIALS_PATH, 'cloud_credentials.json')
9
9
  private_constant :CREDENTIALS_FILE_PATH
10
10
 
11
11
  def self.credentials
12
- return unless File.exist?(CREDENTIALS_FILE_PATH)
12
+ all_credentials[Superbot::DOMAIN.to_sym]
13
+ end
13
14
 
14
- @credentials ||= JSON.parse(File.read(CREDENTIALS_FILE_PATH), symbolize_names: true)
15
+ def self.all_credentials
16
+ @all_credentials ||=
17
+ if File.exist?(CREDENTIALS_FILE_PATH)
18
+ JSON.parse(File.read(CREDENTIALS_FILE_PATH), symbolize_names: true)
19
+ else
20
+ {}
21
+ end
15
22
  end
16
23
 
17
24
  def self.save_credentials(data)
18
- data.transform_keys!(&:to_sym)
19
- @credentials = data
25
+ all_credentials[Superbot::DOMAIN.to_sym] = data.transform_keys!(&:to_sym)
20
26
  FileUtils.mkdir_p CREDENTIALS_PATH
21
- File.write CREDENTIALS_FILE_PATH, @credentials.to_json
22
- puts "Logged in as #{@credentials[:username]} (#{@credentials[:email]})"
27
+ File.write CREDENTIALS_FILE_PATH, all_credentials.to_json
28
+ puts "Logged in as %<username>s (%<email>s)" % credentials.slice(:username, :email)
23
29
  end
24
30
  end
25
31
  end
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_runtime_dependency "multipart-post", "2.0.0"
37
37
  spec.add_runtime_dependency "marcel", "0.3.3"
38
38
 
39
- spec.add_development_dependency "superbot", "~> 0.1.13"
39
+ spec.add_development_dependency "superbot", "~> 0.1.16"
40
40
  spec.add_development_dependency "bundler", "~> 1.16"
41
41
  spec.add_development_dependency "rake", "~> 10.0"
42
42
  spec.add_development_dependency "rspec", "~> 3.0"
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.11
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Superbots
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.13
47
+ version: 0.1.16
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.13
54
+ version: 0.1.16
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement