aptible-api 0.1.1 → 0.1.2

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: ea7e2616fd2d3e935b31c76ece6d0661e7629b69
4
- data.tar.gz: e0600845d8af38042268b708ebb75b33a6c97f3c
3
+ metadata.gz: dfdcc30829f257c5b6d98ad8ede2ea34b7a5f328
4
+ data.tar.gz: 79ce495635673d2b54c9e60d142fb7b2d27f13fd
5
5
  SHA512:
6
- metadata.gz: b5b392099aafa2cd1352451fe736903395f566bebcf7a6176985fd56600386d74501c1c8a0cf639987ee5b8b04a7eaa526a09aad96e71ba74f4ec87421b2103a
7
- data.tar.gz: 0021aeb7fa253f60327c9f836dccd3cccd2d7e4189e4a716499d7668f89d0c59f87ad6e66ef70c20040b49445c5de62da1df3eecf5daa8605be1dea31de5ca92
6
+ metadata.gz: d435190c8b3dff583848b19285a2e50ef7d06bb7a1c9f10e8cd276eaa00e444e851e34a8da4c7a39f32d4674a771efd89c8d5b1675bad2534abcf639b85a9b26
7
+ data.tar.gz: 36a56dadd99b38fa76a6558fd598fee051f798fa41b0e3fcd018b2a2d8ec1a8564ea73ca56642daa65ff86d7f4b6af37408651bdfa0d38e79ff5732fc7e2f49f
data/README.md CHANGED
@@ -46,9 +46,9 @@ client.href
46
46
 
47
47
  | Parameter | Description | Default |
48
48
  | --------- | ----------- | --------------- |
49
- | `root_url` | Root URL of the authorization server | `https://api.aptible.com` |
49
+ | `root_url` | Root URL of the API server | `ENV['APTIBLE_API_ROOT_URL']` or [https://api.aptible.com](https://api.aptible.com) |
50
50
 
51
- To point the client at a different authorization server (e.g., during development), add the following to your application's initializers:
51
+ To point the client at a different API server (e.g., during development), add the following to your application's initializers (or set the `APTIBLE_API_ROOT_URL` environment variable):
52
52
 
53
53
  ```ruby
54
54
  Aptible::Api.configure do |config|
data/lib/aptible/api.rb CHANGED
@@ -8,7 +8,9 @@ module Aptible
8
8
  include GemConfig::Base
9
9
 
10
10
  with_configuration do
11
- has :root_url, classes: [String], default: 'https://api.aptible.com'
11
+ has :root_url,
12
+ classes: [String],
13
+ default: ENV['APTIBLE_API_ROOT_URL'] || 'https://api.aptible.com'
12
14
  end
13
15
  end
14
16
  end
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Api
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -6,4 +6,12 @@ describe Aptible::Api do
6
6
  expect(config).to be_a GemConfig::Configuration
7
7
  expect(config.root_url).to eq 'https://api.aptible.com'
8
8
  end
9
+
10
+ pending 'uses ENV["APTIBLE_API_ROOT_URL"] if defined' do
11
+ config = described_class.configuration
12
+ set_env 'APTIBLE_API_ROOT_URL', 'http://foobar.com' do
13
+ config.reset
14
+ expect(config.root_url).to eq 'http://foobar.com'
15
+ end
16
+ end
9
17
  end
@@ -0,0 +1,10 @@
1
+ def set_env(*args, &block)
2
+ hash = args.first.is_a?(Hash) ? args.first : Hash[*args]
3
+ old_values = Hash[hash.map { |k, v| [k, ENV[k]] }]
4
+ begin
5
+ hash.each { |k, v| ENV[k] = v }
6
+ yield
7
+ ensure
8
+ old_values.each { |k, v| ENV[k] = v }
9
+ end
10
+ end
data/spec/spec_helper.rb CHANGED
@@ -8,3 +8,7 @@ end
8
8
 
9
9
  # Require library up front
10
10
  require 'aptible/api'
11
+
12
+ RSpec.configure do |config|
13
+ config.before { Aptible::Api.configuration.reset }
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-12 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config
@@ -156,6 +156,7 @@ files:
156
156
  - lib/aptible/api/version.rb
157
157
  - spec/aptible/api/client_spec.rb
158
158
  - spec/aptible/api_spec.rb
159
+ - spec/shared/set_env.rb
159
160
  - spec/spec_helper.rb
160
161
  homepage: https://github.com/aptible/aptible-api
161
162
  licenses:
@@ -184,4 +185,5 @@ summary: Ruby client for api.aptible.com
184
185
  test_files:
185
186
  - spec/aptible/api/client_spec.rb
186
187
  - spec/aptible/api_spec.rb
188
+ - spec/shared/set_env.rb
187
189
  - spec/spec_helper.rb