restpack_core_client 0.2.0
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 +15 -0
- data/.gitignore +17 -0
- data/.travis.yml +4 -0
- data/Gemfile +8 -0
- data/LICENSE +19 -0
- data/README.md +20 -0
- data/Rakefile +31 -0
- data/lib/restpack_core_client/api.rb +64 -0
- data/lib/restpack_core_client/cache.rb +39 -0
- data/lib/restpack_core_client/models/application.rb +34 -0
- data/lib/restpack_core_client/models/channel.rb +31 -0
- data/lib/restpack_core_client/models/configuration.rb +23 -0
- data/lib/restpack_core_client/models/domain.rb +19 -0
- data/lib/restpack_core_client/version.rb +7 -0
- data/lib/restpack_core_client.rb +5 -0
- data/restpack_core_client.gemspec +25 -0
- data/spec/api_spec.rb +49 -0
- data/spec/cache_spec.rb +11 -0
- data/spec/fixtures/get_channel.json +184 -0
- data/spec/spec_helper.rb +6 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OWNkNmU5M2I0NWFkNzgwNWM0NDE0MTIzOTVjZDc2NWY5ZTRmOTMwYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YTMyMzViZjVjODc3NjA0OTUxZjlkMjU3OGRmMTk4YzdlZjY1MTkxNg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTZlYzU3ZjU0MDIwNjc1MTZmY2FkMzE3MzU4MTNkZmZlNTc0ZTE2ZjkzZjBj
|
10
|
+
NDMxNDgzOTc0OGRkMjkyYTgxYTU1ODYyNDQxM2U2ZjBmYmUwNGZkZmM3M2I1
|
11
|
+
ZjZkYzhkN2M2NGU2ZTE5OTlhNDBjYWEwY2NmYWIxN2VhODM4YWU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MGUyMTllOGZkYWJhMmM1YTc0YzM4MDE2Y2E3ZjcyNjA3N2MxNjhhYmY5MGRh
|
14
|
+
ZjI0ZDk3ZTI5YzEzMDFhMzk3YjFkZmU2Y2RiYjVlY2NiZGMxY2U4MDg2NTg4
|
15
|
+
YTg2MjkxMGMxZDU0YWMzYWU1ZDVkYTZmZDIyY2Y3ZGIyNzc0MjA=
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2013 Gavin Joyce and RestPack contributors
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# RestPack core.client [](https://travis-ci.org/RestPack/restpack_core_client) [](https://gemnasium.com/RestPack/restpack_core_client)
|
2
|
+
|
3
|
+
A client gem for restpack_core_service
|
4
|
+
|
5
|
+
## Using the gem
|
6
|
+
|
7
|
+
Instructions coming soon...
|
8
|
+
|
9
|
+
## Developer Environment Setup
|
10
|
+
|
11
|
+
```
|
12
|
+
bundle install
|
13
|
+
```
|
14
|
+
|
15
|
+
## Running Tests
|
16
|
+
|
17
|
+
```
|
18
|
+
rake test
|
19
|
+
```
|
20
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
task :default => :test
|
4
|
+
task :test => :spec
|
5
|
+
|
6
|
+
begin
|
7
|
+
require "rspec/core/rake_task"
|
8
|
+
|
9
|
+
desc "Run all specs"
|
10
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
11
|
+
t.rspec_opts = ['-cfs']
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
end
|
15
|
+
|
16
|
+
task :gem do
|
17
|
+
["gem:build", "gem:push"].each do |task|
|
18
|
+
Rake::Task[task].reenable
|
19
|
+
Rake::Task[task].invoke
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
namespace :gem do
|
24
|
+
task :build do
|
25
|
+
sh "gem build restpack_core_client.gemspec"
|
26
|
+
end
|
27
|
+
|
28
|
+
task :push do
|
29
|
+
sh "gem push restpack_core_client-#{RestPack::Core::Client::VERSION}.gem"
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative 'models/channel'
|
2
|
+
require_relative 'models/application'
|
3
|
+
require_relative 'models/domain'
|
4
|
+
require_relative 'models/configuration'
|
5
|
+
|
6
|
+
module RestPack
|
7
|
+
module Core
|
8
|
+
module Client
|
9
|
+
class API
|
10
|
+
def initialize(domain, access_key)
|
11
|
+
@domain = domain
|
12
|
+
@access_key = access_key
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_channel(id)
|
16
|
+
json = RestClient.get("http://:#{@access_key}@#{@domain}/api/v1/channels/#{id}.json")
|
17
|
+
data = Yajl::Parser.parse(json, :symbolize_keys => true)
|
18
|
+
|
19
|
+
hydrate_channel(data)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_domain(host)
|
23
|
+
json = RestClient.get("http://:#{@access_key}@#{@domain}/api/v1/domains/search.json?host=#{host}")
|
24
|
+
result = Yajl::Parser.parse(json, :symbolize_keys => true)
|
25
|
+
|
26
|
+
raise "host is not configured: #{host}" if result.empty?
|
27
|
+
|
28
|
+
result[:domains].first
|
29
|
+
end
|
30
|
+
|
31
|
+
def root_configurations
|
32
|
+
json = RestClient.get("http://:#{@access_key}@#{@domain}/api/v1/configurations/root.json")
|
33
|
+
data = Yajl::Parser.parse(json, :symbolize_keys => true)
|
34
|
+
|
35
|
+
configurations = []
|
36
|
+
data[:configurations].each do |configuration_data|
|
37
|
+
configurations << Configuration.new(configuration_data)
|
38
|
+
end
|
39
|
+
configurations
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def hydrate_channel(channel_response)
|
45
|
+
channel = Channel.new(channel_response[:channels].first)
|
46
|
+
|
47
|
+
channel_response[:applications].each do |application_data|
|
48
|
+
Application.new(application_data, channel)
|
49
|
+
end
|
50
|
+
|
51
|
+
channel_response[:domains].each do |domain_data|
|
52
|
+
Domain.new(domain_data, channel)
|
53
|
+
end
|
54
|
+
|
55
|
+
channel_response[:configurations].each do |configuration_data|
|
56
|
+
Configuration.new(configuration_data, channel)
|
57
|
+
end
|
58
|
+
|
59
|
+
channel
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module RestPack
|
2
|
+
module Core
|
3
|
+
module Client
|
4
|
+
class Cache
|
5
|
+
attr_accessor :configurations
|
6
|
+
|
7
|
+
def initialize(api)
|
8
|
+
@api = api
|
9
|
+
@channel_ids = {}
|
10
|
+
@channels = {}
|
11
|
+
@configurations = api.root_configurations
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.create(domain, access_key)
|
15
|
+
api = RestPack::Core::Client::API.new(domain, access_key)
|
16
|
+
Cache.new(api)
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_channel(host)
|
20
|
+
channel_id = get_channel_id(host)
|
21
|
+
@channels[channel_id] ||= @api.get_channel(channel_id)
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_channel_id(host)
|
25
|
+
@channel_ids[host] ||= @api.get_domain(host)[:channel_id]
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_configuration(key)
|
29
|
+
@configurations.find { |c| c.key == key.to_s }
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_configuration_value(key, default_value = nil)
|
33
|
+
config = get_configuration(key)
|
34
|
+
config.nil? ? default_value : config.value
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module RestPack::Core::Client
|
2
|
+
class Application
|
3
|
+
attr_accessor :id, :name, :href, :channel, :domains, :configurations
|
4
|
+
|
5
|
+
def initialize(data, channel)
|
6
|
+
@domains = []
|
7
|
+
@configurations = []
|
8
|
+
|
9
|
+
@id = data[:id].to_i
|
10
|
+
@name = data[:name]
|
11
|
+
@href = data[:href]
|
12
|
+
|
13
|
+
@channel = channel
|
14
|
+
@channel.applications << self
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_configuration_by_key(key)
|
18
|
+
@configurations.find { |c| c.key == key.to_s }
|
19
|
+
end
|
20
|
+
|
21
|
+
def known_domain_names
|
22
|
+
configuration = get_configuration_by_key(:domains)
|
23
|
+
configuration.nil? ? {} : configuration.value
|
24
|
+
end
|
25
|
+
|
26
|
+
def home_domain #TODO: GJ: dynamic
|
27
|
+
known_domain_names[:home]
|
28
|
+
end
|
29
|
+
|
30
|
+
def auth_domain
|
31
|
+
known_domain_names[:auth]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module RestPack::Core::Client
|
2
|
+
class Channel
|
3
|
+
attr_accessor :id, :name, :href, :applications, :domains, :configurations
|
4
|
+
|
5
|
+
def initialize(data)
|
6
|
+
@applications = []
|
7
|
+
@domains = []
|
8
|
+
@configurations = []
|
9
|
+
|
10
|
+
@id = data[:id].to_i
|
11
|
+
@name = data[:name]
|
12
|
+
@href = data[:href]
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_application(id)
|
16
|
+
@applications.find { |a| a.id == id.to_i }
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_domain(id)
|
20
|
+
@domains.find { |a| a.id == id.to_i }
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_domain_by_host(host)
|
24
|
+
@domains.find { |a| a.host == host }
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_configuration(id)
|
28
|
+
@configurations.find { |a| a.id == id.to_i }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RestPack::Core::Client
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :id, :key, :value, :href, :channel, :application, :domain
|
4
|
+
|
5
|
+
def initialize(data, channel = nil)
|
6
|
+
@id = data[:id].to_i
|
7
|
+
@key = data[:key]
|
8
|
+
@value = data[:value]
|
9
|
+
@href = data[:href]
|
10
|
+
|
11
|
+
if channel
|
12
|
+
@channel = channel
|
13
|
+
@application = channel.get_application(data[:application_id])
|
14
|
+
@domain = channel.get_domain(data[:domain_id])
|
15
|
+
|
16
|
+
@channel.configurations << self
|
17
|
+
@application.configurations << self if @application
|
18
|
+
@domain.configurations << self if @domain
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module RestPack::Core::Client
|
2
|
+
class Domain
|
3
|
+
attr_accessor :id, :host, :href, :channel, :application, :configurations
|
4
|
+
|
5
|
+
def initialize(data, channel)
|
6
|
+
@configurations = []
|
7
|
+
|
8
|
+
@id = data[:id].to_i
|
9
|
+
@host = data[:host]
|
10
|
+
@href = data[:href]
|
11
|
+
|
12
|
+
@channel = channel
|
13
|
+
@application = channel.get_application(data[:links][:application])
|
14
|
+
|
15
|
+
@channel.domains << self
|
16
|
+
@application.domains << self
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'restpack_core_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "restpack_core_client"
|
8
|
+
gem.version = RestPack::Core::Client::VERSION
|
9
|
+
gem.authors = ["Gavin Joyce"]
|
10
|
+
gem.email = ["gavinjoyce@gmail.com"]
|
11
|
+
gem.description = %q{A simple client gem for restpack-core-service}
|
12
|
+
gem.summary = %q{A simple client gem for restpack-core-service}
|
13
|
+
gem.homepage = "https://github.com/RestPack"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'rest-client', '~> 1.6.7'
|
21
|
+
gem.add_dependency 'yajl-ruby', '~> 1.1.0'
|
22
|
+
|
23
|
+
gem.add_development_dependency 'rspec', '~> 2.12.1'
|
24
|
+
gem.add_development_dependency 'rake', '~> 10.0.3'
|
25
|
+
end
|
data/spec/api_spec.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RestPack::Core::Client::API do
|
4
|
+
let(:api) { RestPack::Core::Client::API.new('domain', 'access_key') }
|
5
|
+
|
6
|
+
describe '.get_channel' do
|
7
|
+
before do
|
8
|
+
json = File.read("#{Bundler.root}/spec/fixtures/get_channel.json")
|
9
|
+
RestClient.stub(:get).and_return(json)
|
10
|
+
end
|
11
|
+
context 'the returned channel' do
|
12
|
+
let(:channel) { api.get_channel(31) }
|
13
|
+
|
14
|
+
it 'has correct attributes' do
|
15
|
+
channel.id.should == 31
|
16
|
+
channel.name.should == 'RestPack Sample Apps'
|
17
|
+
channel.href.should == '/api/v1/channels/31.json'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'has applications' do
|
21
|
+
channel.applications.length.should == 1
|
22
|
+
channel.applications[0].id.should == 43
|
23
|
+
channel.applications[0].name.should == 'Simple Sinatra App'
|
24
|
+
channel.applications[0].href.should == '/api/v1/applications/43.json'
|
25
|
+
channel.applications[0].channel.should == channel
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'has domains' do
|
29
|
+
channel.domains.length.should == 3
|
30
|
+
channel.domains[0].id.should == 83
|
31
|
+
channel.domains[0].host.should == 'sinatra-sample.restpack.io'
|
32
|
+
channel.domains[0].href.should == '/api/v1/domains/83.json'
|
33
|
+
channel.domains[0].channel.should == channel
|
34
|
+
channel.domains[0].application.should_not == nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'has configurations' do
|
38
|
+
channel.configurations.length.should == 2
|
39
|
+
channel.configurations[0].id.should == 98
|
40
|
+
channel.configurations[0].key.should == 'domains'
|
41
|
+
channel.configurations[0].value.should == {
|
42
|
+
home: "sinatra-sample.restpack.io:9001",
|
43
|
+
auth: "auth.restpack.io:8081"
|
44
|
+
}
|
45
|
+
channel.configurations[0].href.should == '/api/v1/configurations/98.json'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/spec/cache_spec.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'restpack_core_client/cache'
|
3
|
+
|
4
|
+
describe RestPack::Core::Client::Cache do
|
5
|
+
let(:api) { RestPack::Core::Client::API.new('core.internal.domain.ie', 'password') }
|
6
|
+
let(:cache) { RestPack::Core::Client::Cache.new(api) }
|
7
|
+
|
8
|
+
context "with an empty cache" do
|
9
|
+
pending
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,184 @@
|
|
1
|
+
{
|
2
|
+
"channels": [
|
3
|
+
{
|
4
|
+
"id": "31",
|
5
|
+
"name": "RestPack Sample Apps",
|
6
|
+
"href": "/api/v1/channels/31.json"
|
7
|
+
}
|
8
|
+
],
|
9
|
+
"meta": {
|
10
|
+
"channels": {
|
11
|
+
"page": 1,
|
12
|
+
"page_size": 50,
|
13
|
+
"count": 1,
|
14
|
+
"includes": [
|
15
|
+
"applications",
|
16
|
+
"domains",
|
17
|
+
"configurations"
|
18
|
+
],
|
19
|
+
"page_count": 1,
|
20
|
+
"previous_page": null,
|
21
|
+
"next_page": null,
|
22
|
+
"previous_href": null,
|
23
|
+
"next_href": null
|
24
|
+
},
|
25
|
+
"applications": {
|
26
|
+
"page": 1,
|
27
|
+
"page_size": 50,
|
28
|
+
"count": 1,
|
29
|
+
"includes": [],
|
30
|
+
"page_count": 1,
|
31
|
+
"previous_page": null,
|
32
|
+
"next_page": null,
|
33
|
+
"previous_href": null,
|
34
|
+
"next_href": null
|
35
|
+
},
|
36
|
+
"domains": {
|
37
|
+
"page": 1,
|
38
|
+
"page_size": 50,
|
39
|
+
"count": 3,
|
40
|
+
"includes": [],
|
41
|
+
"page_count": 1,
|
42
|
+
"previous_page": null,
|
43
|
+
"next_page": null,
|
44
|
+
"previous_href": null,
|
45
|
+
"next_href": null
|
46
|
+
},
|
47
|
+
"configurations": {
|
48
|
+
"page": 1,
|
49
|
+
"page_size": 50,
|
50
|
+
"count": 2,
|
51
|
+
"includes": [],
|
52
|
+
"page_count": 1,
|
53
|
+
"previous_page": null,
|
54
|
+
"next_page": null,
|
55
|
+
"previous_href": null,
|
56
|
+
"next_href": null
|
57
|
+
}
|
58
|
+
},
|
59
|
+
"links": {
|
60
|
+
"channels.applications": {
|
61
|
+
"href": "/api/v1/applications.json?channel_id={channels.id}",
|
62
|
+
"type": "applications"
|
63
|
+
},
|
64
|
+
"channels.domains": {
|
65
|
+
"href": "/api/v1/domains.json?channel_id={channels.id}",
|
66
|
+
"type": "domains"
|
67
|
+
},
|
68
|
+
"channels.configurations": {
|
69
|
+
"href": "/api/v1/configurations.json?channel_id={channels.id}",
|
70
|
+
"type": "configurations"
|
71
|
+
},
|
72
|
+
"applications.channel": {
|
73
|
+
"href": "/api/v1/channels/{applications.channel}.json",
|
74
|
+
"type": "channels"
|
75
|
+
},
|
76
|
+
"applications.domains": {
|
77
|
+
"href": "/api/v1/domains.json?application_id={applications.id}",
|
78
|
+
"type": "domains"
|
79
|
+
},
|
80
|
+
"applications.configurations": {
|
81
|
+
"href": "/api/v1/configurations.json?application_id={applications.id}",
|
82
|
+
"type": "configurations"
|
83
|
+
},
|
84
|
+
"domains.channel": {
|
85
|
+
"href": "/api/v1/channels/{domains.channel}.json",
|
86
|
+
"type": "channels"
|
87
|
+
},
|
88
|
+
"domains.application": {
|
89
|
+
"href": "/api/v1/applications/{domains.application}.json",
|
90
|
+
"type": "applications"
|
91
|
+
},
|
92
|
+
"domains.configurations": {
|
93
|
+
"href": "/api/v1/configurations.json?domain_id={domains.id}",
|
94
|
+
"type": "configurations"
|
95
|
+
},
|
96
|
+
"configurations.channel": {
|
97
|
+
"href": "/api/v1/channels/{configurations.channel}.json",
|
98
|
+
"type": "channels"
|
99
|
+
},
|
100
|
+
"configurations.application": {
|
101
|
+
"href": "/api/v1/applications/{configurations.application}.json",
|
102
|
+
"type": "applications"
|
103
|
+
},
|
104
|
+
"configurations.domain": {
|
105
|
+
"href": "/api/v1/domains/{configurations.domain}.json",
|
106
|
+
"type": "domains"
|
107
|
+
}
|
108
|
+
},
|
109
|
+
"applications": [
|
110
|
+
{
|
111
|
+
"id": "43",
|
112
|
+
"name": "Simple Sinatra App",
|
113
|
+
"href": "/api/v1/applications/43.json",
|
114
|
+
"links": {
|
115
|
+
"channel": "31"
|
116
|
+
}
|
117
|
+
}
|
118
|
+
],
|
119
|
+
"domains": [
|
120
|
+
{
|
121
|
+
"id": "83",
|
122
|
+
"host": "sinatra-sample.restpack.io",
|
123
|
+
"href": "/api/v1/domains/83.json",
|
124
|
+
"links": {
|
125
|
+
"channel": "31",
|
126
|
+
"application": "43"
|
127
|
+
}
|
128
|
+
},
|
129
|
+
{
|
130
|
+
"id": "84",
|
131
|
+
"host": "rails-sample.restpack.io",
|
132
|
+
"href": "/api/v1/domains/84.json",
|
133
|
+
"links": {
|
134
|
+
"channel": "31",
|
135
|
+
"application": "43"
|
136
|
+
}
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"id": "85",
|
140
|
+
"host": "auth.restpack.io",
|
141
|
+
"href": "/api/v1/domains/85.json",
|
142
|
+
"links": {
|
143
|
+
"channel": "31",
|
144
|
+
"application": "43"
|
145
|
+
}
|
146
|
+
}
|
147
|
+
],
|
148
|
+
"configurations": [
|
149
|
+
{
|
150
|
+
"id": "98",
|
151
|
+
"key": "domains",
|
152
|
+
"value": {
|
153
|
+
"home": "sinatra-sample.restpack.io:9001",
|
154
|
+
"auth": "auth.restpack.io:8081"
|
155
|
+
},
|
156
|
+
"href": "/api/v1/configurations/98.json",
|
157
|
+
"links": {
|
158
|
+
"channel": "31",
|
159
|
+
"application": "43",
|
160
|
+
"domain": ""
|
161
|
+
}
|
162
|
+
},
|
163
|
+
{
|
164
|
+
"id": "99",
|
165
|
+
"key": "omniauth",
|
166
|
+
"value": {
|
167
|
+
"twitter": {
|
168
|
+
"consumer_key": "aaa",
|
169
|
+
"consumer_secret": "bbb"
|
170
|
+
},
|
171
|
+
"google_oauth2": {
|
172
|
+
"consumer_key": "35232323.apps.googleusercontent.com",
|
173
|
+
"consumer_secret": "ccc"
|
174
|
+
}
|
175
|
+
},
|
176
|
+
"href": "/api/v1/configurations/99.json",
|
177
|
+
"links": {
|
178
|
+
"channel": "31",
|
179
|
+
"application": "43",
|
180
|
+
"domain": ""
|
181
|
+
}
|
182
|
+
}
|
183
|
+
]
|
184
|
+
}
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: restpack_core_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gavin Joyce
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.6.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.6.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: yajl-ruby
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.12.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.12.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 10.0.3
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 10.0.3
|
69
|
+
description: A simple client gem for restpack-core-service
|
70
|
+
email:
|
71
|
+
- gavinjoyce@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .travis.yml
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/restpack_core_client.rb
|
83
|
+
- lib/restpack_core_client/api.rb
|
84
|
+
- lib/restpack_core_client/cache.rb
|
85
|
+
- lib/restpack_core_client/models/application.rb
|
86
|
+
- lib/restpack_core_client/models/channel.rb
|
87
|
+
- lib/restpack_core_client/models/configuration.rb
|
88
|
+
- lib/restpack_core_client/models/domain.rb
|
89
|
+
- lib/restpack_core_client/version.rb
|
90
|
+
- restpack_core_client.gemspec
|
91
|
+
- spec/api_spec.rb
|
92
|
+
- spec/cache_spec.rb
|
93
|
+
- spec/fixtures/get_channel.json
|
94
|
+
- spec/spec_helper.rb
|
95
|
+
homepage: https://github.com/RestPack
|
96
|
+
licenses: []
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.0.3
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: A simple client gem for restpack-core-service
|
118
|
+
test_files:
|
119
|
+
- spec/api_spec.rb
|
120
|
+
- spec/cache_spec.rb
|
121
|
+
- spec/fixtures/get_channel.json
|
122
|
+
- spec/spec_helper.rb
|