maestrano 0.10.0 → 0.11.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/README.md +259 -7
- data/lib/maestrano/sso/base_group.rb +14 -2
- data/lib/maestrano/sso/base_user.rb +3 -1
- data/lib/maestrano/version.rb +1 -1
- data/test/maestrano/sso/base_group_test.rb +30 -14
- data/test/maestrano/sso/base_user_test.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94146280a117fc153c4747915002c5697c060788
|
4
|
+
data.tar.gz: 6ed575bd6107b474f198e8ca06dc05368d4486ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f33f2d0360c1afca5cdd73dd987156e773eb363db502f5f272f92c2736af38f0d143b26c49847edec71b034c69f4d9aa803acbba7645746b1cf3a6f11335e4
|
7
|
+
data.tar.gz: a9d42f25ed6d85c22411cf58f5a2d2eba675c7bb1cfd6eda711675bbc659713503224b687607e3f98ffeb897638a0758d50359d01d5bccf503e766ff44c81f78
|
data/README.md
CHANGED
@@ -25,8 +25,12 @@ Maestrano Cloud Integration is currently in closed beta. Want to know more? Send
|
|
25
25
|
* [Groups Controller](#groups-controller-service-cancellation)
|
26
26
|
* [Group Users Controller](#group-users-controller-business-member-removal)
|
27
27
|
6. [API](#api)
|
28
|
-
* [
|
29
|
-
|
28
|
+
* [Payment API](#payment-api)
|
29
|
+
* [Bill](#bill)
|
30
|
+
* [Recurring Bill](#recurring-bill)
|
31
|
+
* [Membership API](#membership-api)
|
32
|
+
* [User](#user)
|
33
|
+
* [Group](#group)
|
30
34
|
7. [Connec!™ Data Sharing](#connec-data-sharing)
|
31
35
|
* [Making Requests](#making-requests)
|
32
36
|
* [Webhook Notifications](#webhook-notifications)
|
@@ -202,10 +206,10 @@ Maestrano.configure do |config|
|
|
202
206
|
# config.webhook.connec.subscriptions = {
|
203
207
|
# accounts: false,
|
204
208
|
# company: false,
|
205
|
-
#
|
206
|
-
#
|
207
|
-
#
|
208
|
-
#
|
209
|
+
# invoices: false,
|
210
|
+
# items: false,
|
211
|
+
# organizations: false,
|
212
|
+
# people: false,
|
209
213
|
# tax_codes: false,
|
210
214
|
# tax_rates: false
|
211
215
|
# }
|
@@ -313,7 +317,11 @@ class Organization
|
|
313
317
|
organization.provider = 'maestrano'
|
314
318
|
organization.uid = sso_hash[:uid]
|
315
319
|
organization.name = sso_hash[:info][:company_name] || 'Some default'
|
320
|
+
# organization.principal_email = sso_hash[:info][:email]
|
321
|
+
# organization.city = sso_hash[:info][:city]
|
322
|
+
# organization.olson_tz = sso_hash[:info][:timezone]
|
316
323
|
# organization.country_alpha2 = sso_hash[:info][:country]
|
324
|
+
# organization.currency_code = sso_hash[:info][:currency]
|
317
325
|
# organization.free_trial_end_at = sso_hash[:info][:free_trial_end_at]
|
318
326
|
|
319
327
|
# Save the organization
|
@@ -814,8 +822,252 @@ rec_bill = Maestrano::Account::RecurringBill.retrieve("rbill-f1d2s54")
|
|
814
822
|
rec_bill.cancel
|
815
823
|
```
|
816
824
|
|
825
|
+
|
826
|
+
### Membership API
|
827
|
+
|
828
|
+
#### User
|
829
|
+
A user is a member of a group having access to your application. Users are currently readonly.
|
830
|
+
|
831
|
+
```ruby
|
832
|
+
Maestrano::Account::User
|
833
|
+
```
|
834
|
+
|
835
|
+
##### Attributes
|
836
|
+
|
837
|
+
<table>
|
838
|
+
<tr>
|
839
|
+
<th>Field</th>
|
840
|
+
<th>Mode</th>
|
841
|
+
<th>Type</th>
|
842
|
+
<th>Required</th>
|
843
|
+
<th>Default</th>
|
844
|
+
<th>Description</th>
|
845
|
+
<tr>
|
846
|
+
|
847
|
+
<tr>
|
848
|
+
<td><b>id</b></td>
|
849
|
+
<td>readonly</td>
|
850
|
+
<td>String</td>
|
851
|
+
<td>-</td>
|
852
|
+
<td>-</td>
|
853
|
+
<td>The id of the user</td>
|
854
|
+
<tr>
|
855
|
+
|
856
|
+
<tr>
|
857
|
+
<td><b>name</b></td>
|
858
|
+
<td>readonly</td>
|
859
|
+
<td>String</td>
|
860
|
+
<td><b>-</b></td>
|
861
|
+
<td>-</td>
|
862
|
+
<td>The user first name</td>
|
863
|
+
<tr>
|
864
|
+
|
865
|
+
<tr>
|
866
|
+
<td><b>surname</b></td>
|
867
|
+
<td>readonly</td>
|
868
|
+
<td>String</td>
|
869
|
+
<td><b>-</b></td>
|
870
|
+
<td>-</td>
|
871
|
+
<td>The user last name</td>
|
872
|
+
<tr>
|
873
|
+
|
874
|
+
<tr>
|
875
|
+
<td><b>email</b></td>
|
876
|
+
<td>readonly</td>
|
877
|
+
<td>String</td>
|
878
|
+
<td><b>-</b></td>
|
879
|
+
<td>-</td>
|
880
|
+
<td>The user real email address</td>
|
881
|
+
<tr>
|
882
|
+
|
883
|
+
<tr>
|
884
|
+
<td><b>company_name</b></td>
|
885
|
+
<td>readonly</td>
|
886
|
+
<td>String</td>
|
887
|
+
<td><b>-</b></td>
|
888
|
+
<td>-</td>
|
889
|
+
<td>The user company name as it was entered when they signed up. Nothing related to the user group name.</td>
|
890
|
+
<tr>
|
891
|
+
|
892
|
+
<tr>
|
893
|
+
<td><b>country</b></td>
|
894
|
+
<td>readonly</td>
|
895
|
+
<td>String</td>
|
896
|
+
<td><b>-</b></td>
|
897
|
+
<td>-</td>
|
898
|
+
<td>The country of the user in <a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2 format</a> (2 letter code). E.g: 'US' for USA, 'AU' for Australia.</td>
|
899
|
+
<tr>
|
900
|
+
|
901
|
+
<tr>
|
902
|
+
<td><b>created_at</b></td>
|
903
|
+
<td>readonly</td>
|
904
|
+
<td>Time</td>
|
905
|
+
<td>-</td>
|
906
|
+
<td>-</td>
|
907
|
+
<td>When the user was created</td>
|
908
|
+
<tr>
|
909
|
+
|
910
|
+
<tr>
|
911
|
+
<td><b>updated_at</b></td>
|
912
|
+
<td>readonly</td>
|
913
|
+
<td>Time</td>
|
914
|
+
<td>-</td>
|
915
|
+
<td>-</td>
|
916
|
+
<td>When the user was last updated</td>
|
917
|
+
<tr>
|
918
|
+
|
919
|
+
</table>
|
920
|
+
|
921
|
+
##### Actions
|
922
|
+
|
923
|
+
List all users having access to your application
|
924
|
+
```ruby
|
925
|
+
users = Maestrano::Account::User.all;
|
926
|
+
```
|
927
|
+
|
928
|
+
Access a single user by id
|
929
|
+
```ruby
|
930
|
+
user = Maestrano::Account::User.retrieve("usr-f1d2s54");
|
931
|
+
```
|
932
|
+
|
933
|
+
#### Group
|
934
|
+
A group represents a customer account and is composed of members (users) having access to your application. A group also represents a chargeable account (see Bill/RecurringBill). Typically you can remotely check if a group has entered a credit card on Maestrano.
|
935
|
+
|
936
|
+
Groups are currently readonly.
|
937
|
+
|
938
|
+
|
939
|
+
```ruby
|
940
|
+
Maestrano::Account::Group
|
941
|
+
```
|
942
|
+
|
943
|
+
##### Attributes
|
944
|
+
|
945
|
+
<table>
|
946
|
+
<tr>
|
947
|
+
<th>Field</th>
|
948
|
+
<th>Mode</th>
|
949
|
+
<th>Type</th>
|
950
|
+
<th>Required</th>
|
951
|
+
<th>Default</th>
|
952
|
+
<th>Description</th>
|
953
|
+
<tr>
|
954
|
+
|
955
|
+
<tr>
|
956
|
+
<td><b>id</b></td>
|
957
|
+
<td>readonly</td>
|
958
|
+
<td>String</td>
|
959
|
+
<td>-</td>
|
960
|
+
<td>-</td>
|
961
|
+
<td>The id of the group</td>
|
962
|
+
<tr>
|
963
|
+
|
964
|
+
<tr>
|
965
|
+
<td><b>name</b></td>
|
966
|
+
<td>readonly</td>
|
967
|
+
<td>String</td>
|
968
|
+
<td><b>-</b></td>
|
969
|
+
<td>-</td>
|
970
|
+
<td>The group name</td>
|
971
|
+
<tr>
|
972
|
+
|
973
|
+
<tr>
|
974
|
+
<td><b>email</b></td>
|
975
|
+
<td>readonly</td>
|
976
|
+
<td>string</td>
|
977
|
+
<td><b>-</b></td>
|
978
|
+
<td>-</td>
|
979
|
+
<td>The principal email address for this group (admin email address)</td>
|
980
|
+
<tr>
|
981
|
+
|
982
|
+
<tr>
|
983
|
+
<td><b>has_credit_card</b></td>
|
984
|
+
<td>readonly</td>
|
985
|
+
<td>Boolean</td>
|
986
|
+
<td><b>-</b></td>
|
987
|
+
<td>-</td>
|
988
|
+
<td>Whether the group has entered a credit card on Maestrano or not</td>
|
989
|
+
<tr>
|
990
|
+
|
991
|
+
<tr>
|
992
|
+
<td><b>free_trial_end_at</b></td>
|
993
|
+
<td>readonly</td>
|
994
|
+
<td>Time</td>
|
995
|
+
<td><b>-</b></td>
|
996
|
+
<td>-</td>
|
997
|
+
<td>When the group free trial will be finishing on Maestrano. You may optionally consider this date for your own free trial (optional)</td>
|
998
|
+
<tr>
|
999
|
+
|
1000
|
+
<tr>
|
1001
|
+
<td><b>currency</b></td>
|
1002
|
+
<td>readonly</td>
|
1003
|
+
<td>String</td>
|
1004
|
+
<td>-</td>
|
1005
|
+
<td>-</td>
|
1006
|
+
<td>The currency used by this Group in <a href="http://en.wikipedia.org/wiki/ISO_4217#Active_codes">ISO 4217 format</a> (3 letter code)</td>
|
1007
|
+
<tr>
|
1008
|
+
|
1009
|
+
<tr>
|
1010
|
+
<td><b>country</b></td>
|
1011
|
+
<td>readonly</td>
|
1012
|
+
<td>String</td>
|
1013
|
+
<td><b>-</b></td>
|
1014
|
+
<td>-</td>
|
1015
|
+
<td>The country of the group in <a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2 format</a> (2 letter code). E.g: 'US' for USA, 'AU' for Australia.</td>
|
1016
|
+
<tr>
|
1017
|
+
|
1018
|
+
<tr>
|
1019
|
+
<td><b>city</b></td>
|
1020
|
+
<td>readonly</td>
|
1021
|
+
<td>String</td>
|
1022
|
+
<td><b>-</b></td>
|
1023
|
+
<td>-</td>
|
1024
|
+
<td>The city of the group</td>
|
1025
|
+
<tr>
|
1026
|
+
|
1027
|
+
<tr>
|
1028
|
+
<td><b>timezone</b></td>
|
1029
|
+
<td>readonly</td>
|
1030
|
+
<td>String</td>
|
1031
|
+
<td><b>-</b></td>
|
1032
|
+
<td>-</td>
|
1033
|
+
<td>The group timezone in <a href="http://en.wikipedia.org/wiki/List_of_tz_database_time_zones">Olson format</a></td>
|
1034
|
+
<tr>
|
1035
|
+
|
1036
|
+
<tr>
|
1037
|
+
<td><b>created_at</b></td>
|
1038
|
+
<td>readonly</td>
|
1039
|
+
<td>Time</td>
|
1040
|
+
<td>-</td>
|
1041
|
+
<td>-</td>
|
1042
|
+
<td>When the group was created</td>
|
1043
|
+
<tr>
|
1044
|
+
|
1045
|
+
<tr>
|
1046
|
+
<td><b>updated_at</b></td>
|
1047
|
+
<td>readonly</td>
|
1048
|
+
<td>Time</td>
|
1049
|
+
<td>-</td>
|
1050
|
+
<td>-</td>
|
1051
|
+
<td>When the group was last updated</td>
|
1052
|
+
<tr>
|
1053
|
+
|
1054
|
+
</table>
|
1055
|
+
|
1056
|
+
##### Actions
|
1057
|
+
|
1058
|
+
List all groups having access to your application
|
1059
|
+
```ruby
|
1060
|
+
groups = Maestrano::Account::Group.all;
|
1061
|
+
```
|
1062
|
+
|
1063
|
+
Access a single group by id
|
1064
|
+
```ruby
|
1065
|
+
group = Maestrano::Account::Group.retrieve("usr-f1d2s54");
|
1066
|
+
```
|
1067
|
+
|
1068
|
+
|
817
1069
|
## Connec!™ Data Sharing
|
818
|
-
Maestrano offers the capability to share actual business data between
|
1070
|
+
Maestrano offers the capability to share actual business data between applications via its data sharing platform Connec!™.
|
819
1071
|
|
820
1072
|
The platform exposes a set of RESTful JSON APIs allowing your application to receive data generated by other applications and update data in other applications as well!
|
821
1073
|
|
@@ -2,7 +2,9 @@ module Maestrano
|
|
2
2
|
module SSO
|
3
3
|
class BaseGroup
|
4
4
|
attr_accessor :local_id
|
5
|
-
attr_reader :uid
|
5
|
+
attr_reader :uid, :company_name, :free_trial_end_at, :has_credit_card, :name, :email, :city,
|
6
|
+
:country, :timezone, :currency
|
7
|
+
|
6
8
|
|
7
9
|
# Initializer
|
8
10
|
# @param Maestrano::SAML::Response
|
@@ -10,9 +12,14 @@ module Maestrano
|
|
10
12
|
att = saml_response.attributes
|
11
13
|
@uid = att['group_uid']
|
12
14
|
@has_credit_card = (att['group_has_credit_card'] == 'true')
|
13
|
-
@country = att['country']
|
14
15
|
@free_trial_end_at = Time.iso8601(att['group_end_free_trial'])
|
15
16
|
@company_name = att['company_name']
|
17
|
+
@name = att['group_name']
|
18
|
+
@email = att['group_email']
|
19
|
+
@city = att['group_city']
|
20
|
+
@timezone = att['group_timezone']
|
21
|
+
@currency = att['group_currency']
|
22
|
+
@country = att['country']
|
16
23
|
end
|
17
24
|
|
18
25
|
def to_hash
|
@@ -23,7 +30,12 @@ module Maestrano
|
|
23
30
|
free_trial_end_at: self.free_trial_end_at,
|
24
31
|
company_name: self.company_name,
|
25
32
|
has_credit_card: self.has_credit_card,
|
33
|
+
name: self.name,
|
34
|
+
email: self.email,
|
35
|
+
city: self.city,
|
26
36
|
country: self.country,
|
37
|
+
timezone: self.timezone,
|
38
|
+
currency: self.currency
|
27
39
|
},
|
28
40
|
extra: {}
|
29
41
|
}
|
@@ -4,7 +4,7 @@ module Maestrano
|
|
4
4
|
attr_accessor :local_id
|
5
5
|
attr_reader :sso_session,:sso_session_recheck,
|
6
6
|
:group_uid,:group_role,:uid,:virtual_uid,:email,
|
7
|
-
:virtual_email,:first_name, :last_name,:country, :company_name
|
7
|
+
:virtual_email,:first_name, :last_name,:country, :company_name, :group_name
|
8
8
|
|
9
9
|
# Initializer
|
10
10
|
# @param Maestrano::SAML::Response
|
@@ -13,6 +13,7 @@ module Maestrano
|
|
13
13
|
@sso_session = att['mno_session']
|
14
14
|
@sso_session_recheck = Time.iso8601(att['mno_session_recheck'])
|
15
15
|
@group_uid = att['group_uid']
|
16
|
+
@group_name = att['group_name']
|
16
17
|
@group_role = att['group_role']
|
17
18
|
@uid = att['uid']
|
18
19
|
@virtual_uid = att['virtual_uid']
|
@@ -59,6 +60,7 @@ module Maestrano
|
|
59
60
|
virtual_email: self.virtual_email,
|
60
61
|
group: {
|
61
62
|
uid: self.group_uid,
|
63
|
+
name: self.group_name,
|
62
64
|
role: self.group_role,
|
63
65
|
},
|
64
66
|
session: {
|
data/lib/maestrano/version.rb
CHANGED
@@ -8,20 +8,25 @@ module Maestrano
|
|
8
8
|
setup do
|
9
9
|
@saml_response = Maestrano::Saml::Response.new(response_document)
|
10
10
|
@saml_response.stubs(:attributes).returns({
|
11
|
-
'mno_session'
|
12
|
-
'mno_session_recheck'
|
13
|
-
'group_uid'
|
14
|
-
'
|
15
|
-
'
|
16
|
-
'
|
17
|
-
'
|
18
|
-
'
|
19
|
-
'
|
20
|
-
'
|
21
|
-
'
|
22
|
-
|
23
|
-
|
24
|
-
|
11
|
+
'mno_session' => 'f54sd54fd64fs5df4s3d48gf2',
|
12
|
+
'mno_session_recheck' => Time.now.utc.iso8601,
|
13
|
+
'group_uid' => 'cld-1',
|
14
|
+
'group_name' => 'Some Group Name',
|
15
|
+
'group_currency' => 'AUD',
|
16
|
+
'group_timezone' => 'America/Los_Angeles',
|
17
|
+
'group_email' => 'principal@maestrano.com',
|
18
|
+
'group_end_free_trial' => Time.now.utc.iso8601,
|
19
|
+
'group_role' => 'Admin',
|
20
|
+
'group_country' => 'AU',
|
21
|
+
'group_city' => 'Sydney',
|
22
|
+
'uid' => "usr-1",
|
23
|
+
'virtual_uid' => "usr-1.cld-1",
|
24
|
+
'email' => "j.doe@doecorp.com",
|
25
|
+
'virtual_email' => "usr-1.cld-1@mail.maestrano.com",
|
26
|
+
'name' => "John",
|
27
|
+
"surname" => "Doe",
|
28
|
+
"country" => "AU",
|
29
|
+
"company_name" => "DoeCorp"
|
25
30
|
})
|
26
31
|
end
|
27
32
|
|
@@ -35,6 +40,12 @@ module Maestrano
|
|
35
40
|
assert group.has_credit_card == (@saml_response.attributes['group_has_credit_card'] == 'true')
|
36
41
|
assert group.free_trial_end_at == Time.iso8601(@saml_response.attributes['group_end_free_trial'])
|
37
42
|
assert group.company_name == @saml_response.attributes['company_name']
|
43
|
+
assert group.name == @saml_response.attributes['group_name']
|
44
|
+
assert group.email == @saml_response.attributes['group_email']
|
45
|
+
assert group.currency == @saml_response.attributes['group_currency']
|
46
|
+
assert group.timezone == @saml_response.attributes['group_timezone']
|
47
|
+
assert group.city == @saml_response.attributes['group_city']
|
48
|
+
assert group.email == @saml_response.attributes['group_email']
|
38
49
|
assert group.country == @saml_response.attributes['country']
|
39
50
|
end
|
40
51
|
|
@@ -47,7 +58,12 @@ module Maestrano
|
|
47
58
|
free_trial_end_at: sso_group.free_trial_end_at,
|
48
59
|
company_name: sso_group.company_name,
|
49
60
|
has_credit_card: sso_group.has_credit_card,
|
61
|
+
name: sso_group.name,
|
62
|
+
email: sso_group.email,
|
63
|
+
city: sso_group.city,
|
50
64
|
country: sso_group.country,
|
65
|
+
timezone: sso_group.timezone,
|
66
|
+
currency: sso_group.currency
|
51
67
|
},
|
52
68
|
extra: {}
|
53
69
|
}
|
@@ -11,8 +11,14 @@ module Maestrano
|
|
11
11
|
'mno_session' => 'f54sd54fd64fs5df4s3d48gf2',
|
12
12
|
'mno_session_recheck' => Time.now.utc.iso8601,
|
13
13
|
'group_uid' => 'cld-1',
|
14
|
+
'group_name' => 'Some Group Name',
|
15
|
+
'group_currency' => 'AUD',
|
16
|
+
'group_timezone' => 'America/Los_Angeles',
|
17
|
+
'group_email' => 'principal@maestrano.com',
|
14
18
|
'group_end_free_trial' => Time.now.utc.iso8601,
|
15
19
|
'group_role' => 'Admin',
|
20
|
+
'group_country' => 'AU',
|
21
|
+
'group_city' => 'Sydney',
|
16
22
|
'uid' => "usr-1",
|
17
23
|
'virtual_uid' => "usr-1.cld-1",
|
18
24
|
'email' => "j.doe@doecorp.com",
|
@@ -33,6 +39,7 @@ module Maestrano
|
|
33
39
|
assert user.sso_session == @saml_response.attributes['mno_session']
|
34
40
|
assert user.sso_session_recheck == Time.iso8601(@saml_response.attributes['mno_session_recheck'])
|
35
41
|
assert user.group_uid == @saml_response.attributes['group_uid']
|
42
|
+
assert user.group_name == @saml_response.attributes['group_name']
|
36
43
|
assert user.group_role == @saml_response.attributes['group_role']
|
37
44
|
assert user.uid == @saml_response.attributes['uid']
|
38
45
|
assert user.virtual_uid == @saml_response.attributes['virtual_uid']
|
@@ -65,6 +72,7 @@ module Maestrano
|
|
65
72
|
virtual_email: sso_user.virtual_email,
|
66
73
|
group: {
|
67
74
|
uid: sso_user.group_uid,
|
75
|
+
name: sso_user.group_name,
|
68
76
|
role: sso_user.group_role
|
69
77
|
},
|
70
78
|
session: {
|
@@ -97,6 +105,7 @@ module Maestrano
|
|
97
105
|
virtual_email: sso_user.virtual_email,
|
98
106
|
group: {
|
99
107
|
uid: sso_user.group_uid,
|
108
|
+
name: sso_user.group_name,
|
100
109
|
role: sso_user.group_role,
|
101
110
|
},
|
102
111
|
session: {
|
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.11.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: 2015-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|