aptible-api 0.4.8 → 0.5.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 +4 -4
- data/aptible-api.gemspec +3 -4
- data/lib/aptible/api.rb +2 -55
- data/lib/aptible/api/account.rb +19 -16
- data/lib/aptible/api/agent.rb +6 -0
- data/lib/aptible/api/app.rb +11 -10
- data/lib/aptible/api/configuration.rb +4 -3
- data/lib/aptible/api/container.rb +4 -3
- data/lib/aptible/api/database.rb +8 -7
- data/lib/aptible/api/disk.rb +7 -6
- data/lib/aptible/api/image.rb +4 -3
- data/lib/aptible/api/operation.rb +9 -6
- data/lib/aptible/api/permission.rb +4 -3
- data/lib/aptible/api/release.rb +5 -4
- data/lib/aptible/api/resource.rb +7 -101
- data/lib/aptible/api/service.rb +11 -10
- data/lib/aptible/api/version.rb +5 -0
- data/lib/aptible/api/vhost.rb +7 -6
- data/spec/aptible/api/agent_spec.rb +5 -0
- data/spec/aptible/api/resource_spec.rb +2 -48
- data/spec/aptible/api_spec.rb +1 -26
- metadata +8 -33
- data/lib/aptible/api/adapter.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f7914574135166984620bac823d42f06164c7ba
|
4
|
+
data.tar.gz: bff0ea8cf8843b10f9e9571b81d3e147758457bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dbbb0798a405ddeca24b0fd2ca31d7a2271f6b2121c2a1f267cee5cf6647265795af60e15a48248489301c002f1ba62396089e9bb4443a5e2c091db761912c4
|
7
|
+
data.tar.gz: e5c4250d1572130d052d9a3d7e71e79ab51f8b21a57035aa76eeb8d83827a1dd06a9a2a9bc37f3e5bba1261a4ad2e6bf8c662323affc6865ee9dd963994668cb
|
data/aptible-api.gemspec
CHANGED
@@ -3,10 +3,11 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
|
5
5
|
require 'English'
|
6
|
+
require 'aptible/api/version'
|
6
7
|
|
7
8
|
Gem::Specification.new do |spec|
|
8
9
|
spec.name = 'aptible-api'
|
9
|
-
spec.version =
|
10
|
+
spec.version = Aptible::Api::VERSION
|
10
11
|
spec.authors = ['Frank Macreery']
|
11
12
|
spec.email = ['frank@macreery.com']
|
12
13
|
spec.description = %q(Ruby client for api.aptible.com)
|
@@ -18,10 +19,8 @@ Gem::Specification.new do |spec|
|
|
18
19
|
spec.test_files = spec.files.grep(/^spec\//)
|
19
20
|
spec.require_paths = ['lib']
|
20
21
|
|
22
|
+
spec.add_dependency 'aptible-resource'
|
21
23
|
spec.add_dependency 'gem_config'
|
22
|
-
spec.add_dependency 'hyperresource-aptible', '>= 0.9.0'
|
23
|
-
spec.add_dependency 'aptible-auth'
|
24
|
-
spec.add_dependency 'fridge'
|
25
24
|
|
26
25
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
27
26
|
spec.add_development_dependency 'aptible-tasks', '>= 0.2.0'
|
data/lib/aptible/api.rb
CHANGED
@@ -1,69 +1,16 @@
|
|
1
|
-
require 'aptible/auth'
|
2
1
|
require 'gem_config'
|
3
|
-
require 'hyperresource'
|
4
|
-
require 'fridge'
|
5
2
|
|
6
3
|
module Aptible
|
7
|
-
|
4
|
+
module Api
|
8
5
|
include GemConfig::Base
|
9
6
|
|
10
|
-
attr_accessor :token, :config
|
11
|
-
|
12
7
|
with_configuration do
|
13
8
|
has :root_url,
|
14
9
|
classes: [String],
|
15
10
|
default: ENV['APTIBLE_API_ROOT_URL'] || 'https://api.aptible.com'
|
16
11
|
end
|
17
|
-
|
18
|
-
def self.get_data_type_from_response(response)
|
19
|
-
return nil unless response && response.body
|
20
|
-
adapter.get_data_type_from_object(adapter.deserialize(response.body))
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.adapter
|
24
|
-
Aptible::Api::Adapter
|
25
|
-
end
|
26
|
-
|
27
|
-
def adapter
|
28
|
-
self.class.adapter
|
29
|
-
end
|
30
|
-
|
31
|
-
def initialize(options = {})
|
32
|
-
if options.is_a?(Hash)
|
33
|
-
self.token = options[:token]
|
34
|
-
|
35
|
-
options[:root] ||= config.root_url
|
36
|
-
options[:namespace] ||= 'Aptible::Api'
|
37
|
-
options[:headers] ||= { 'Content-Type' => 'application/json' }
|
38
|
-
options[:headers].merge!(
|
39
|
-
'Authorization' => "Bearer #{bearer_token}"
|
40
|
-
) if options[:token]
|
41
|
-
end
|
42
|
-
|
43
|
-
super(options)
|
44
|
-
end
|
45
|
-
|
46
|
-
def find_by_url(url)
|
47
|
-
fail "URL must be rooted at #{root}" unless /^#{root}/.match url
|
48
|
-
|
49
|
-
resource = dup
|
50
|
-
resource.href = url.gsub(/^#{root}/, '')
|
51
|
-
resource.get
|
52
|
-
end
|
53
|
-
|
54
|
-
def bearer_token
|
55
|
-
case token
|
56
|
-
when Aptible::Auth::Token then token.access_token
|
57
|
-
when Fridge::AccessToken then token.to_s
|
58
|
-
when String then token
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def config
|
63
|
-
@config ||= Aptible::Api.configuration
|
64
|
-
end
|
65
12
|
end
|
66
13
|
end
|
67
14
|
|
68
|
-
require 'aptible/api/adapter'
|
69
15
|
require 'aptible/api/resource'
|
16
|
+
require 'aptible/api/agent'
|
data/lib/aptible/api/account.rb
CHANGED
@@ -1,23 +1,26 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
module Api
|
3
|
+
class Account < Resource
|
4
|
+
has_many :apps
|
5
|
+
has_many :databases
|
6
|
+
has_many :disks
|
7
|
+
has_many :services
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
def production?
|
10
|
+
type == 'production'
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
def operations
|
14
|
+
# TODO: Implement /accounts/:id/operations
|
15
|
+
[]
|
16
|
+
end
|
17
|
+
|
18
|
+
def organization
|
19
|
+
require 'aptible/auth'
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
+
auth = Aptible::Auth::Organization.new(token: token, headers: headers)
|
22
|
+
auth.find_by_url(links['organization'].href)
|
23
|
+
end
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
data/lib/aptible/api/app.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
module Api
|
3
|
+
class App < Resource
|
4
|
+
belongs_to :account
|
5
|
+
belongs_to :current_configuration
|
6
|
+
belongs_to :current_image
|
7
|
+
has_many :configurations
|
8
|
+
has_many :images
|
9
|
+
has_many :operations
|
10
|
+
has_many :permissions
|
11
|
+
has_many :services
|
12
|
+
end
|
12
13
|
end
|
13
14
|
end
|
data/lib/aptible/api/database.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
module Api
|
3
|
+
class Database < Resource
|
4
|
+
belongs_to :account
|
5
|
+
has_one :disk
|
6
|
+
has_one :service
|
7
|
+
has_many :operations
|
8
|
+
has_many :permissions
|
9
|
+
end
|
9
10
|
end
|
10
11
|
end
|
data/lib/aptible/api/disk.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
module Api
|
3
|
+
class Disk < Resource
|
4
|
+
belongs_to :account
|
5
|
+
belongs_to :database
|
6
|
+
has_many :operations
|
7
|
+
has_many :permissions
|
8
|
+
end
|
8
9
|
end
|
9
10
|
end
|
data/lib/aptible/api/image.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
2
|
+
module Api
|
3
|
+
class Operation < Resource
|
4
|
+
belongs_to :resource
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def user
|
7
|
+
require 'aptible/auth'
|
8
|
+
|
9
|
+
auth = Aptible::Auth::User.new(token: token, headers: headers)
|
10
|
+
auth.find_by_url(links['user'].href)
|
11
|
+
end
|
9
12
|
end
|
10
13
|
end
|
11
14
|
end
|
data/lib/aptible/api/release.rb
CHANGED
data/lib/aptible/api/resource.rb
CHANGED
@@ -1,110 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'aptible/resource'
|
2
2
|
|
3
|
-
# rubocop:disable ClassAndModuleChildren
|
4
3
|
module Aptible
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
rescue HyperResource::ResponseError
|
10
|
-
nil
|
11
|
-
end
|
12
|
-
alias_method :destroy, :delete
|
13
|
-
|
14
|
-
def self.basename
|
15
|
-
name.split('::').last.downcase.pluralize
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.collection_url
|
19
|
-
config = Aptible::Api.configuration
|
20
|
-
config.root_url.chomp('/') + "/#{basename}"
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.all(options = {})
|
24
|
-
resource = find_by_url(collection_url, options)
|
25
|
-
return [] unless resource
|
26
|
-
resource.send(basename).entries
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.find(id, options = {})
|
30
|
-
find_by_url("#{collection_url}/#{id}", options)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.find_by_url(url, options = {})
|
34
|
-
# REVIEW: Should exception be raised if return type mismatch?
|
35
|
-
new(options).find_by_url(url)
|
36
|
-
rescue HyperResource::ClientError => e
|
37
|
-
if e.response.status == 404
|
38
|
-
return nil
|
39
|
-
else
|
40
|
-
raise e
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.create(params)
|
45
|
-
token = params.delete(:token)
|
46
|
-
auth = Api.new(token: token)
|
47
|
-
auth.send(basename).create(normalize_params(params))
|
48
|
-
end
|
49
|
-
|
50
|
-
# rubocop:disable PredicateName
|
51
|
-
def self.has_many(relation)
|
52
|
-
define_has_many_getter(relation)
|
53
|
-
define_has_many_setter(relation)
|
54
|
-
end
|
55
|
-
# rubocop:enable PredicateName
|
56
|
-
|
57
|
-
def self.belongs_to(relation)
|
58
|
-
define_method relation do
|
59
|
-
get unless loaded
|
60
|
-
if (memoized = instance_variable_get("@#{relation}"))
|
61
|
-
memoized
|
62
|
-
elsif links[relation]
|
63
|
-
instance_variable_set("@#{relation}", links[relation].get)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# rubocop:disable PredicateName
|
69
|
-
def self.has_one(relation)
|
70
|
-
# Better than class << self + alias_method?
|
71
|
-
belongs_to(relation)
|
72
|
-
end
|
73
|
-
# rubocop:enable PredicateName
|
74
|
-
|
75
|
-
def self.define_has_many_getter(relation)
|
76
|
-
define_method relation do
|
77
|
-
get unless loaded
|
78
|
-
if (memoized = instance_variable_get("@#{relation}"))
|
79
|
-
memoized
|
80
|
-
elsif links[relation]
|
81
|
-
instance_variable_set("@#{relation}", links[relation].entries)
|
82
|
-
end
|
4
|
+
module Api
|
5
|
+
class Resource < Aptible::Resource::Base
|
6
|
+
def namespace
|
7
|
+
'Aptible::Api'
|
83
8
|
end
|
84
|
-
end
|
85
9
|
|
86
|
-
|
87
|
-
|
88
|
-
get unless loaded
|
89
|
-
links[relation].create(self.class.normalize_params(params))
|
10
|
+
def root_url
|
11
|
+
Aptible::Api.configuration.root_url
|
90
12
|
end
|
91
13
|
end
|
92
|
-
|
93
|
-
def self.normalize_params(params = {})
|
94
|
-
params_array = params.map do |key, value|
|
95
|
-
value.is_a?(HyperResource) ? [key, value.href] : [key, value]
|
96
|
-
end
|
97
|
-
Hash[params_array]
|
98
|
-
end
|
99
|
-
|
100
|
-
def update(params)
|
101
|
-
super(self.class.normalize_params(params))
|
102
|
-
end
|
103
|
-
|
104
|
-
# NOTE: The following does not update the object in-place
|
105
|
-
def reload
|
106
|
-
self.class.find_by_url(href, headers: headers)
|
107
|
-
end
|
108
14
|
end
|
109
15
|
end
|
110
16
|
|
data/lib/aptible/api/service.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
module Api
|
3
|
+
class Service < Resource
|
4
|
+
belongs_to :account
|
5
|
+
belongs_to :app
|
6
|
+
belongs_to :database
|
7
|
+
belongs_to :current_release
|
8
|
+
has_many :vhosts
|
9
|
+
has_many :operations
|
10
|
+
has_many :permissions
|
11
|
+
has_many :releases
|
12
|
+
end
|
12
13
|
end
|
13
14
|
end
|
data/lib/aptible/api/vhost.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
module Api
|
3
|
+
class Vhost < Resource
|
4
|
+
belongs_to :service
|
5
|
+
has_many :operations
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
def provisioned?
|
8
|
+
provisioned
|
9
|
+
end
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -1,52 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Aptible::Api::Resource do
|
4
|
-
|
5
|
-
|
6
|
-
url = Aptible::Api::Disk.collection_url
|
7
|
-
expect(url).to eq 'https://api.aptible.com/disks'
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
describe '.find' do
|
12
|
-
it 'should call find_by_url' do
|
13
|
-
url = 'https://api.aptible.com/disks/42'
|
14
|
-
expect(Aptible::Api::Disk).to receive(:find_by_url).with url, {}
|
15
|
-
Aptible::Api::Disk.find(42)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '.all' do
|
20
|
-
let(:app) { double Aptible::Api::App }
|
21
|
-
let(:collection) { double Aptible::Api }
|
22
|
-
|
23
|
-
before do
|
24
|
-
collection.stub(:apps) { [app] }
|
25
|
-
Aptible::Api::App.any_instance.stub(:find_by_url) { collection }
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should be an array' do
|
29
|
-
expect(Aptible::Api::App.all).to be_a Array
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should return the root collection' do
|
33
|
-
expect(Aptible::Api::App.all).to eq [app]
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should pass options to the HyperResource initializer' do
|
37
|
-
klass = Aptible::Api::App
|
38
|
-
options = { token: 'token' }
|
39
|
-
expect(klass).to receive(:new).with(options).and_return klass.new
|
40
|
-
Aptible::Api::App.all(options)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '.create' do
|
45
|
-
it 'should create a new top-level resource' do
|
46
|
-
apps = double Aptible::Api
|
47
|
-
Aptible::Api.stub_chain(:new, :apps) { apps }
|
48
|
-
expect(apps).to receive(:create).with(foo: 'bar')
|
49
|
-
Aptible::Api::App.create(foo: 'bar')
|
50
|
-
end
|
51
|
-
end
|
4
|
+
its(:namespace) { should eq 'Aptible::Api' }
|
5
|
+
its(:root_url) { should eq 'https://api.aptible.com' }
|
52
6
|
end
|
data/spec/aptible/api_spec.rb
CHANGED
@@ -1,32 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Aptible::Api do
|
4
|
-
|
5
|
-
it 'should be a HyperResource instance' do
|
6
|
-
expect(subject).to be_a HyperResource
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#bearer_token' do
|
11
|
-
it 'should accept an Aptible::Auth::Token' do
|
12
|
-
token = Aptible::Auth::Token.new
|
13
|
-
token.stub(:access_token) { 'abtible_auth_token' }
|
14
|
-
subject.stub(:token) { token }
|
15
|
-
expect(subject.bearer_token).to eq token.access_token
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should accept an Fridge::AccessToken' do
|
19
|
-
token = Fridge::AccessToken.new
|
20
|
-
token.stub(:to_s) { 'fridge_access_token' }
|
21
|
-
subject.stub(:token) { token }
|
22
|
-
expect(subject.bearer_token).to eq token.to_s
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should accept a String' do
|
26
|
-
subject.stub(:token) { 'token' }
|
27
|
-
expect(subject.bearer_token).to eq 'token'
|
28
|
-
end
|
29
|
-
end
|
4
|
+
subject { Aptible::Api::App.new }
|
30
5
|
|
31
6
|
it 'should have a configurable root_url' do
|
32
7
|
config = described_class.configuration
|
metadata
CHANGED
@@ -1,45 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
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-04-
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: hyperresource-aptible
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.9.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: aptible-auth
|
14
|
+
name: aptible-resource
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
44
16
|
requirements:
|
45
17
|
- - '>='
|
@@ -53,7 +25,7 @@ dependencies:
|
|
53
25
|
- !ruby/object:Gem::Version
|
54
26
|
version: '0'
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
28
|
+
name: gem_config
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
31
|
- - '>='
|
@@ -182,7 +154,7 @@ files:
|
|
182
154
|
- aptible-api.gemspec
|
183
155
|
- lib/aptible/api.rb
|
184
156
|
- lib/aptible/api/account.rb
|
185
|
-
- lib/aptible/api/
|
157
|
+
- lib/aptible/api/agent.rb
|
186
158
|
- lib/aptible/api/app.rb
|
187
159
|
- lib/aptible/api/configuration.rb
|
188
160
|
- lib/aptible/api/container.rb
|
@@ -194,7 +166,9 @@ files:
|
|
194
166
|
- lib/aptible/api/release.rb
|
195
167
|
- lib/aptible/api/resource.rb
|
196
168
|
- lib/aptible/api/service.rb
|
169
|
+
- lib/aptible/api/version.rb
|
197
170
|
- lib/aptible/api/vhost.rb
|
171
|
+
- spec/aptible/api/agent_spec.rb
|
198
172
|
- spec/aptible/api/resource_spec.rb
|
199
173
|
- spec/aptible/api_spec.rb
|
200
174
|
- spec/shared/set_env.rb
|
@@ -224,6 +198,7 @@ signing_key:
|
|
224
198
|
specification_version: 4
|
225
199
|
summary: Ruby client for api.aptible.com
|
226
200
|
test_files:
|
201
|
+
- spec/aptible/api/agent_spec.rb
|
227
202
|
- spec/aptible/api/resource_spec.rb
|
228
203
|
- spec/aptible/api_spec.rb
|
229
204
|
- spec/shared/set_env.rb
|
data/lib/aptible/api/adapter.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
|
-
module Aptible
|
3
|
-
class Api::Adapter < HyperResource::Adapter::HAL_JSON
|
4
|
-
class << self
|
5
|
-
# rubocop:disable MethodLength
|
6
|
-
def get_data_type_from_object(object)
|
7
|
-
return nil unless object
|
8
|
-
|
9
|
-
if (type = object['_type'])
|
10
|
-
if type.respond_to?(:camelize)
|
11
|
-
type.camelize
|
12
|
-
else
|
13
|
-
type[0].upcase + type[1..-1]
|
14
|
-
end
|
15
|
-
else
|
16
|
-
'Resource'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
# rubocop:enable MethodLength
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|