shelly 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/lib/shelly/base.rb CHANGED
@@ -1,5 +1,3 @@
1
- require "yaml"
2
-
3
1
  module Shelly
4
2
  class Base
5
3
  def current_user
@@ -8,20 +6,8 @@ module Shelly
8
6
  @user
9
7
  end
10
8
 
11
- def config
12
- @config ||= if File.exists?(config_file_path)
13
- YAML::load(File.read(config_file_path))
14
- else
15
- {}
16
- end
17
- end
18
-
19
- def config_file_path
20
- File.join(current_user.config_dir, "config.yml")
21
- end
22
-
23
9
  def shelly
24
- @shelly ||= Client.new(current_user.email, current_user.password, config)
10
+ @shelly ||= Client.new(current_user.email, current_user.password)
25
11
  end
26
12
  end
27
13
  end
data/lib/shelly/client.rb CHANGED
@@ -19,14 +19,13 @@ module Shelly
19
19
  end
20
20
  end
21
21
 
22
- def initialize(email = nil, password = nil, options = {})
22
+ def initialize(email = nil, password = nil)
23
23
  @email = email
24
24
  @password = password
25
- @options = options
26
25
  end
27
26
 
28
27
  def api_url
29
- @options["shelly_url"] || ENV["SHELLY_URL"] || "https://admin.winniecloud.com/apiv2"
28
+ ENV["SHELLY_URL"] || "https://admin.winniecloud.com/apiv2"
30
29
  end
31
30
 
32
31
  def register_user(email, password, ssh_key)
@@ -1,3 +1,3 @@
1
1
  module Shelly
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -15,21 +15,4 @@ describe Shelly::Base do
15
15
  user.password.should == "the-kal-el"
16
16
  end
17
17
  end
18
-
19
- describe "#config" do
20
- context "config file exists" do
21
- it "should return loaded config as a Hash" do
22
- File.open("~/.shelly/config.yml", "w") { |f| f << "shelly_url: http://api.example.com/v4/\n" }
23
- base = Shelly::Base.new
24
- base.config.should == {"shelly_url" => "http://api.example.com/v4/"}
25
- end
26
- end
27
-
28
- context "config file doesn't exist" do
29
- it "should return an empty Hash" do
30
- base = Shelly::Base.new
31
- base.config.should == {}
32
- end
33
- end
34
- end
35
18
  end
@@ -8,13 +8,6 @@ describe Shelly::Client do
8
8
  end
9
9
 
10
10
  describe "#api_url" do
11
- context "API URL passed with options hash" do
12
- it "should use provided value" do
13
- client = Shelly::Client.new("bob@example.com", "secret", "shelly_url" => "https://api2.example.com")
14
- client.api_url.should == "https://api2.example.com"
15
- end
16
- end
17
-
18
11
  context "env SHELLY_URL is not set" do
19
12
  it "should return default API URL" do
20
13
  ENV['SHELLY_URL'].should be_nil
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelly
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Shelly Cloud team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-04 00:00:00 +02:00
18
+ date: 2011-10-05 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency