leancloud 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/leancloud +1 -0
- data/lib/leancloud.rb +1 -1
- data/lib/leancloud/http/lean_http.rb +35 -2
- data/lib/leancloud/http/symbol_uploader.rb +0 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 360b3214a779dc8432edac48644e13561e1ad1f2
|
4
|
+
data.tar.gz: 9729d17f0c5f4b4e3e6c5bb534d83a6c74c996d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b078c46c74c2d0e56a083357f41a4cda4b54da8c7c15ae31aa31a36f39167c591dced1aa8541cce732b15ed1386f469830a6de745b17761fcff6ff351d425863
|
7
|
+
data.tar.gz: bd6db7c7893bb8bf515bfc738256c6a9e4cb66b434760ab0f3c547733a37045450dd30850266d693ffc83b0f038e8b8b2e1677d0067969e02e0c7fcf12921eba
|
data/bin/leancloud
CHANGED
@@ -47,6 +47,7 @@ CLActive do
|
|
47
47
|
option :id, '-i i', '--id=id', 'App ID'
|
48
48
|
option :key, '-k k', '--key=key', 'App Key'
|
49
49
|
option :file, '-f f', '--file=file', 'DSYM file path'
|
50
|
+
option :region, '-r r', '--region', 'LeanCloud server region'
|
50
51
|
option :verbose, '-v', '--verbose', 'Verbose mode'
|
51
52
|
action do |opts|
|
52
53
|
uploader = LeanCloud::SymbolUploader.new(opts)
|
data/lib/leancloud.rb
CHANGED
@@ -4,12 +4,45 @@ module LeanCloud
|
|
4
4
|
|
5
5
|
# LeanCloud HTTP manager
|
6
6
|
class LeanHTTP < LeanObject
|
7
|
-
|
7
|
+
|
8
|
+
DOMAINS = {
|
9
|
+
"cn" => 'api.leancloud.cn',
|
10
|
+
"us" => 'avoscloud.us'
|
11
|
+
}
|
12
|
+
|
13
|
+
BASE_URL_FMT = 'https://%{domain}/1.1/'
|
14
|
+
|
15
|
+
def initialize(opts = {})
|
16
|
+
@options = opts
|
17
|
+
end
|
8
18
|
|
9
19
|
protected
|
10
20
|
|
21
|
+
def region
|
22
|
+
@region ||= valid_region
|
23
|
+
end
|
24
|
+
|
25
|
+
def valid_region
|
26
|
+
region = @options[:region];
|
27
|
+
|
28
|
+
if region
|
29
|
+
exit_with_error('Unsupported server region') unless DOMAINS.has_key?(region)
|
30
|
+
region
|
31
|
+
else
|
32
|
+
'cn'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def domain
|
37
|
+
@domain ||= DOMAINS[region]
|
38
|
+
end
|
39
|
+
|
40
|
+
def base_url
|
41
|
+
@base_url ||= BASE_URL_FMT % { :domain => domain }
|
42
|
+
end
|
43
|
+
|
11
44
|
def api(path)
|
12
|
-
URI.join(
|
45
|
+
URI.join(base_url, path)
|
13
46
|
end
|
14
47
|
|
15
48
|
end
|