logworm 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Rakefile +1 -1
- data/lib/base/db.rb +16 -5
- data/logworm.gemspec +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/lib/base/db.rb
CHANGED
@@ -9,9 +9,8 @@ module Logworm
|
|
9
9
|
class DB
|
10
10
|
|
11
11
|
DEFAULT_HOST = "db.logworm.com"
|
12
|
-
URL_FORMAT = /
|
13
|
-
# URI:
|
14
|
-
|
12
|
+
URL_FORMAT = /logworm:\/\/([^:]+):([^@]+)@([^\/]+)\/([^\/]+)\/([^\/]+)\//
|
13
|
+
# URI: logworm://<consumer_key>:<consumer_secret>@db.logworm.com/<access_token>/<access_token_secret>/
|
15
14
|
|
16
15
|
def initialize(url)
|
17
16
|
match = DB.parse_url(url)
|
@@ -30,7 +29,7 @@ module Logworm
|
|
30
29
|
def self.with_tokens(token, token_secret)
|
31
30
|
consumer_key = ENV["#{ENV['APP_ID']}_APPS_KEY"]
|
32
31
|
consumer_secret = ENV["#{ENV['APP_ID']}_APPS_SECRET"]
|
33
|
-
DB.new(
|
32
|
+
DB.new(DB.url(consumer_key, consumer_secret, token, token_secret))
|
34
33
|
end
|
35
34
|
|
36
35
|
def self.from_config
|
@@ -54,7 +53,19 @@ module Logworm
|
|
54
53
|
raise "The application is not properly configured. Either use 'heroku addon:add' to add logworm to your app, or save your project's credentials into the .logworm file" unless db
|
55
54
|
db
|
56
55
|
end
|
57
|
-
|
56
|
+
|
57
|
+
def self.url(consumer_key, consumer_secret, token, token_secret, host = DEFAULT_HOST)
|
58
|
+
"logworm://#{consumer_key}:#{consumer_secret}@#{host}/#{token}/#{token_secret}/"
|
59
|
+
end
|
60
|
+
|
61
|
+
def url()
|
62
|
+
DB.url(@consumer_key, @consumer_secret, @token, @token_secret, @host)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.example_url
|
66
|
+
self.url("Ub5sOstT9w", "GZi0HciTVcoFHEoIZ7", "OzO71hEvWYDmncbf3C", "J7wq4X06MihhZgqDeB")
|
67
|
+
end
|
68
|
+
|
58
69
|
def tables()
|
59
70
|
res = db_call(:get, "#{@host}/")
|
60
71
|
end
|
data/logworm.gemspec
CHANGED