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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f6c7b62f1159bc25c6790cb28b1d5812dfaf4b6
4
- data.tar.gz: f300c9975b39eb710a4de1d9c1bf40a906be6bd2
3
+ metadata.gz: 360b3214a779dc8432edac48644e13561e1ad1f2
4
+ data.tar.gz: 9729d17f0c5f4b4e3e6c5bb534d83a6c74c996d3
5
5
  SHA512:
6
- metadata.gz: 6b13fcc81c483837e95374bd7f8b4f8f4536e5d969fad6b4a6dbeb92a9baf79b713d0c9be913804d3b68c282eb188199a73b44379e032166414c681bac108951
7
- data.tar.gz: 5eca7836061c200fbe2d1c1d0a58872ffd9b12256fdd48c57e5edbf4631ef84e7356a77605f417fe33bc4c561e3bbd5c13b3fcc8af1db935415b1148700bab15
6
+ metadata.gz: b078c46c74c2d0e56a083357f41a4cda4b54da8c7c15ae31aa31a36f39167c591dced1aa8541cce732b15ed1386f469830a6de745b17761fcff6ff351d425863
7
+ data.tar.gz: bd6db7c7893bb8bf515bfc738256c6a9e4cb66b434760ab0f3c547733a37045450dd30850266d693ffc83b0f038e8b8b2e1677d0067969e02e0c7fcf12921eba
@@ -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)
@@ -9,5 +9,5 @@ Encoding.default_internal = Encoding::UTF_8
9
9
 
10
10
  # LeanCloud main module
11
11
  module LeanCloud
12
- VERSION = '0.0.11'
12
+ VERSION = '0.0.13'
13
13
  end
@@ -4,12 +4,45 @@ module LeanCloud
4
4
 
5
5
  # LeanCloud HTTP manager
6
6
  class LeanHTTP < LeanObject
7
- BASE_URL = 'https://api.leancloud.cn/1.1/'
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(BASE_URL, path)
45
+ URI.join(base_url, path)
13
46
  end
14
47
 
15
48
  end
@@ -8,10 +8,6 @@ module LeanCloud
8
8
  # LeanCloud symbol uploader
9
9
  class SymbolUploader < LeanHTTP
10
10
 
11
- def initialize(opts)
12
- @options = opts
13
- end
14
-
15
11
  private
16
12
 
17
13
  attr_reader :dsym_path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leancloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tianyong Tang