hsquare 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: a6accecebc76281dd41587f399dcbbf5da0a7716
4
- data.tar.gz: 76d95e3e9a90d33098b110812b735a97365e7351
3
+ metadata.gz: 68295eded2a69aee55bc5c7872dad307b18a3e4f
4
+ data.tar.gz: 7cf7568ee2a4f0d1054d96507f01687a77cd9f24
5
5
  SHA512:
6
- metadata.gz: b3ec2cb67d65ea50ee6e4a3cfc90a0fc5de57595729d8a75abc40ef3dd95ddc37c40be588052eacf3c21180f69e2c9f7100d2fc7bdd67ad77b96a60f0cc3f93b
7
- data.tar.gz: f719ef6fab4063965563dbf9b9a453895caadd65f7e3c8d5f4a8bbf567b372ed240e6fa9c1e3bc36c12117ab5f6a60366e9dfa2fcf4ac5662465751ee1a2f224
6
+ metadata.gz: d03de4a91ec006cc6991a4f26b13c1d3a5fa3a177d6b43397fee736c54af37606ce989d30a863b567f4ff099c72de73cbbe8fda3e322418fa9c436687438bda8
7
+ data.tar.gz: 718edeb0586fb2159bac6df201516c457aa4c3c4d4e0f6758c4ffe9bd95a3758222324d10dc7527206ab30840f151b790cd95db769105b26980c663162f42ba6
@@ -7,6 +7,9 @@ module Hsquare
7
7
  # Public: Admin access key of the application.
8
8
  attr_accessor :admin_key
9
9
 
10
+ # Public: API base URI for the application.
11
+ attr_accessor :base_uri
12
+
10
13
  # Public: Initializes new application object.
11
14
  #
12
15
  # attributes - Attributes for the new application.
@@ -17,6 +20,7 @@ module Hsquare
17
20
  def initialize(attributes = {})
18
21
  @label = attributes[:label]
19
22
  @admin_key = attributes[:admin_key]
23
+ @base_uri = attributes[:base_uri]
20
24
  end
21
25
 
22
26
  # Public: Client with admin key associated with the application.
@@ -24,6 +28,7 @@ module Hsquare
24
28
  # Returns client class for the application inherits Hsquare::Client.
25
29
  def admin_client
26
30
  @admin_client ||= Class.new(Hsquare::Client::Admin).tap do |klass|
31
+ klass.base_uri(base_uri) if base_uri
27
32
  klass.admin_key = admin_key if admin_key
28
33
  end
29
34
  end
@@ -13,6 +13,15 @@ module Hsquare
13
13
  default_application.admin_key = admin_key
14
14
  end
15
15
 
16
+ # Public: Sets API base URI for default application.
17
+ #
18
+ # base_uri - Base URI to set.
19
+ #
20
+ # Returns newly set base URI.
21
+ def base_uri=(base_uri)
22
+ default_application.base_uri = base_uri
23
+ end
24
+
16
25
  # Public: Retrieves default application.
17
26
  #
18
27
  # Returns Hsquare::Application object for default application.
@@ -1,3 +1,3 @@
1
1
  module Hsquare
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -13,6 +13,14 @@ RSpec.describe Hsquare::Application do
13
13
  it { expect(application.admin_client.default_options[:headers]['Authorization']).to eq("KakaoAK #{admin_key}") }
14
14
  end
15
15
 
16
+ context 'when base_uri is set' do
17
+ let(:base_uri) { 'http://localhost:3000' }
18
+ let(:application) { Hsquare::Application.new base_uri: base_uri }
19
+
20
+ it { expect(application.admin_client.default_options).not_to be_empty }
21
+ it { expect(application.admin_client.default_options[:base_uri]).to eq(base_uri) }
22
+ end
23
+
16
24
  context 'when proxy is set' do
17
25
  let(:configuration) { Hsquare::Configuration.new.tap { |c| c.http_proxy = 'http://proxy.com:80' } }
18
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hsquare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inbeom Hwang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-24 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty