maestrano 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/maestrano.rb +2 -0
- data/lib/maestrano/account/group.rb +7 -0
- data/lib/maestrano/account/user.rb +7 -0
- data/lib/maestrano/api/util.rb +2 -0
- data/lib/maestrano/version.rb +1 -1
- data/test/helpers/api_helpers.rb +58 -0
- data/test/maestrano/account/group_test.rb +33 -0
- data/test/maestrano/account/user_test.rb +33 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7b52772f9c6a0b6f00927d0b361d6c35512cfc2
|
4
|
+
data.tar.gz: 6dd4ac9f9718ea41f5f9293b6b2cdfb178842fd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: addeb6545bd045619468ba85bb75042e89e1f25939a69c117926c256a5870023e44db735c472d6ad181cf959a0e89192bb603cfeafe9b179358497558850aa81
|
7
|
+
data.tar.gz: 73bada943c7f5fd95852fd1493a22d18e7e1784e8a0e64b2f4edf1eefd76edf4e187e26d395389288438968b7298b706b0b7082c8bd0ec0aaa9b504800ef92bb
|
data/lib/maestrano.rb
CHANGED
@@ -49,6 +49,8 @@ require 'maestrano/api/list_object'
|
|
49
49
|
require 'maestrano/api/resource'
|
50
50
|
|
51
51
|
# API - Account Entities
|
52
|
+
require 'maestrano/account/user'
|
53
|
+
require 'maestrano/account/group'
|
52
54
|
require 'maestrano/account/bill'
|
53
55
|
require 'maestrano/account/recurring_bill'
|
54
56
|
|
data/lib/maestrano/api/util.rb
CHANGED
@@ -20,6 +20,8 @@ module Maestrano
|
|
20
20
|
|
21
21
|
def self.object_classes
|
22
22
|
@object_classes ||= {
|
23
|
+
'account_user' => Maestrano::Account::User,
|
24
|
+
'account_group' => Maestrano::Account::Group,
|
23
25
|
'account_bill' => Maestrano::Account::Bill,
|
24
26
|
'account_recurring_bill' => Maestrano::Account::RecurringBill,
|
25
27
|
'internal_list_object' => Maestrano::API::ListObject
|
data/lib/maestrano/version.rb
CHANGED
data/test/helpers/api_helpers.rb
CHANGED
@@ -10,6 +10,64 @@ module APITestHelper
|
|
10
10
|
m
|
11
11
|
end
|
12
12
|
|
13
|
+
def test_account_group_content(params={})
|
14
|
+
{
|
15
|
+
object: 'account_group',
|
16
|
+
id: 'cld-4f5d',
|
17
|
+
created_at: Time.now.utc.iso8601,
|
18
|
+
updated_at: Time.now.utc.iso8601,
|
19
|
+
has_credit_card: true,
|
20
|
+
status: 'running',
|
21
|
+
}.merge(params)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_account_group(params={})
|
25
|
+
{
|
26
|
+
success: true,
|
27
|
+
errors: {},
|
28
|
+
data: test_account_group_content(params)
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_account_group_array
|
33
|
+
{
|
34
|
+
success: true,
|
35
|
+
errors: {},
|
36
|
+
data: [test_account_group_content, test_account_group_content, test_account_group_content],
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_account_user_content(params={})
|
41
|
+
{
|
42
|
+
object: 'account_user',
|
43
|
+
id: 'usr-123',
|
44
|
+
name: 'John',
|
45
|
+
surname: 'Doe',
|
46
|
+
email: 'john.doe@maestrano.com',
|
47
|
+
company_name: 'DoeCorp',
|
48
|
+
country: 'AU',
|
49
|
+
sso_session: 'd45sg47f52sd1cz7x5c44czx7czx7',
|
50
|
+
created_at: Time.now.utc.iso8601,
|
51
|
+
updated_at: Time.now.utc.iso8601,
|
52
|
+
}.merge(params)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_account_user(params={})
|
56
|
+
{
|
57
|
+
success: true,
|
58
|
+
errors: {},
|
59
|
+
data: test_account_user_content(params)
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_account_user_array
|
64
|
+
{
|
65
|
+
success: true,
|
66
|
+
errors: {},
|
67
|
+
data: [test_account_user_content, test_account_user_content, test_account_user_content],
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
13
71
|
def test_account_bill_content(params={})
|
14
72
|
{
|
15
73
|
object: 'account_bill',
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Maestrano
|
4
|
+
module Account
|
5
|
+
class GroupTest < Test::Unit::TestCase
|
6
|
+
include APITestHelper
|
7
|
+
|
8
|
+
should "should be listable" do
|
9
|
+
@api_mock.expects(:get).once.returns(test_response(test_account_group_array))
|
10
|
+
c = Maestrano::Account::Group.all
|
11
|
+
assert c.data.kind_of? Array
|
12
|
+
c.each do |entity|
|
13
|
+
assert entity.kind_of?(Maestrano::Account::Group)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
should "should not be updateable" do
|
18
|
+
assert_raises NoMethodError do
|
19
|
+
@api_mock.stubs(:put).returns(test_response(test_account_group))
|
20
|
+
c = Maestrano::Account::Group.construct_from(test_account_group[:data])
|
21
|
+
c.save
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
should "should not be creatable" do
|
26
|
+
assert_raises NoMethodError do
|
27
|
+
@api_mock.stubs(:post).returns(test_response(test_account_group))
|
28
|
+
c = Maestrano::Account::Group.create({name: "Bla"})
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Maestrano
|
4
|
+
module Account
|
5
|
+
class UserTest < Test::Unit::TestCase
|
6
|
+
include APITestHelper
|
7
|
+
|
8
|
+
should "should be listable" do
|
9
|
+
@api_mock.expects(:get).once.returns(test_response(test_account_user_array))
|
10
|
+
c = Maestrano::Account::User.all
|
11
|
+
assert c.data.kind_of? Array
|
12
|
+
c.each do |entity|
|
13
|
+
assert entity.kind_of?(Maestrano::Account::User)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
should "should not be updateable" do
|
18
|
+
assert_raises NoMethodError do
|
19
|
+
@api_mock.stubs(:put).returns(test_response(test_account_user))
|
20
|
+
c = Maestrano::Account::User.construct_from(test_account_user[:data])
|
21
|
+
c.save
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
should "should not be creatable" do
|
26
|
+
assert_raises NoMethodError do
|
27
|
+
@api_mock.stubs(:post).returns(test_response(test_account_user))
|
28
|
+
c = Maestrano::Account::User.create({name: "Bla"})
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maestrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Lachaume
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -168,7 +168,9 @@ files:
|
|
168
168
|
- bin/maestrano-console
|
169
169
|
- lib/maestrano.rb
|
170
170
|
- lib/maestrano/account/bill.rb
|
171
|
+
- lib/maestrano/account/group.rb
|
171
172
|
- lib/maestrano/account/recurring_bill.rb
|
173
|
+
- lib/maestrano/account/user.rb
|
172
174
|
- lib/maestrano/api/error/authentication_error.rb
|
173
175
|
- lib/maestrano/api/error/base_error.rb
|
174
176
|
- lib/maestrano/api/error/connection_error.rb
|
@@ -207,7 +209,9 @@ files:
|
|
207
209
|
- test/helpers/api_helpers.rb
|
208
210
|
- test/helpers/saml_helpers.rb
|
209
211
|
- test/maestrano/account/bill_test.rb
|
212
|
+
- test/maestrano/account/group_test.rb
|
210
213
|
- test/maestrano/account/recurring_bill_test.rb
|
214
|
+
- test/maestrano/account/user_test.rb
|
211
215
|
- test/maestrano/api/list_object_test.rb
|
212
216
|
- test/maestrano/api/object_test.rb
|
213
217
|
- test/maestrano/api/resource_test.rb
|
@@ -274,7 +278,9 @@ test_files:
|
|
274
278
|
- test/helpers/api_helpers.rb
|
275
279
|
- test/helpers/saml_helpers.rb
|
276
280
|
- test/maestrano/account/bill_test.rb
|
281
|
+
- test/maestrano/account/group_test.rb
|
277
282
|
- test/maestrano/account/recurring_bill_test.rb
|
283
|
+
- test/maestrano/account/user_test.rb
|
278
284
|
- test/maestrano/api/list_object_test.rb
|
279
285
|
- test/maestrano/api/object_test.rb
|
280
286
|
- test/maestrano/api/resource_test.rb
|