Skip to content

Commit a1392bf

Browse files
Merge pull request #15 from JaviCerveraIngram/master
Rename Scheme to Schema. Updated requirements. Add Copyright. Some formatting fixes.
2 parents ad00be9 + 78e7b0d commit a1392bf

31 files changed

+396
-97
lines changed

connect/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
18
from .resource import FulfillmentAutomation
29

310
name = 'connect'

connect/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# -*- coding: utf-8 -*-
22

3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
38
import json
49
import os
510

connect/logger/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
18
from .logger import function_log, logger
29

310
# TODO add auto settings for cloud platforms

connect/logger/logger.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# -*- coding: utf-8 -*-
22

3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
38
import json
49
import logging
510
import os

connect/models/__init__.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
18
from .activation_response import ActivationTemplateResponse, ActivationTileResponse
2-
from .base import BaseScheme
3-
from .fulfillment import FulfillmentScheme
4-
from .parameters import Param, ParamScheme
5-
from .server_error import ServerErrorScheme
9+
from .base import BaseSchema
10+
from .fulfillment import FulfillmentSchema
11+
from .parameters import Param, ParamSchema
12+
from .server_error import ServerErrorSchema
613

714
__all__ = [
815
'ActivationTemplateResponse',
916
'ActivationTileResponse',
10-
'BaseScheme',
11-
'FulfillmentScheme',
12-
'ServerErrorScheme',
17+
'BaseSchema',
18+
'FulfillmentSchema',
19+
'ServerErrorSchema',
1320
'Param',
14-
'ParamScheme',
21+
'ParamSchema',
1522
]

connect/models/activation_response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
18
import json
29

310

connect/models/asset.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
18
from marshmallow import fields, post_load
29

3-
from .base import BaseObject, BaseScheme
4-
from .connection import ConnectionScheme
5-
from .parameters import ParamScheme
6-
from .product import ItemScheme, ProductScheme
7-
from .tiers import TiersSchemeMixin
10+
from .base import BaseModel, BaseSchema
11+
from .connection import ConnectionSchema
12+
from .parameters import ParamSchema
13+
from .product import ItemSchema, ProductSchema
14+
from .tiers import TiersSchemaMixin
815

916

10-
class Asset(BaseObject):
17+
class Asset(BaseModel):
1118
pass
1219

1320

14-
class AssetScheme(BaseScheme):
21+
class AssetSchema(BaseSchema):
1522
status = fields.Str()
1623
external_id = fields.Str()
1724
external_uid = fields.UUID()
18-
product = fields.Nested(ProductScheme, only=('id', 'name'))
25+
product = fields.Nested(ProductSchema, only=('id', 'name'))
1926
connection = fields.Nested(
20-
ConnectionScheme, only=('id', 'type', 'provider', 'vendor'),
27+
ConnectionSchema, only=('id', 'type', 'provider', 'vendor'),
2128
)
22-
items = fields.List(fields.Nested(ItemScheme))
23-
params = fields.List(fields.Nested(ParamScheme))
24-
tiers = fields.Nested(TiersSchemeMixin)
29+
items = fields.List(fields.Nested(ItemSchema))
30+
params = fields.List(fields.Nested(ParamSchema))
31+
tiers = fields.Nested(TiersSchemaMixin)
2532

2633
@post_load
2734
def make_object(self, data):

connect/models/base.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
18
from marshmallow import Schema, fields, post_load
29

310

4-
class BaseObject:
11+
class BaseModel:
512
def __init__(self, *args, **kwargs):
613
self.id = kwargs.get('id')
714
if kwargs:
815
for attr, val in kwargs.items():
916
setattr(self, attr, val)
1017

1118

12-
class BaseScheme(Schema):
19+
class BaseSchema(Schema):
1320
id = fields.Str()
1421

1522
@post_load
1623
def make_object(self, data):
17-
return BaseObject(**data)
24+
return BaseModel(**data)

connect/models/company.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
18
from marshmallow import fields, post_load
29

3-
from .base import BaseObject, BaseScheme
10+
from .base import BaseModel, BaseSchema
411

512

6-
class Company(BaseObject):
13+
class Company(BaseModel):
714
pass
815

916

10-
class CompanyScheme(BaseScheme):
17+
class CompanySchema(BaseSchema):
1118
name = fields.Str()
1219

1320
@post_load

connect/models/connection.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This file is part of the Ingram Micro Cloud Blue Connect SDK.
5+
Copyright (c) 2019 Ingram Micro. All Rights Reserved.
6+
"""
7+
18
from marshmallow import fields, post_load
29

3-
from .base import BaseObject, BaseScheme
4-
from .company import CompanyScheme
5-
from .hub import HubScheme
6-
from .product import ProductScheme
10+
from .base import BaseModel, BaseSchema
11+
from .company import CompanySchema
12+
from .hub import HubSchema
13+
from .product import ProductSchema
714

815

9-
class Connection(BaseObject):
16+
class Connection(BaseModel):
1017
pass
1118

1219

13-
class ConnectionScheme(BaseScheme):
20+
class ConnectionSchema(BaseSchema):
1421
type = fields.Str()
15-
provider = fields.Nested(CompanyScheme, only=('id', 'name'))
16-
vendor = fields.Nested(CompanyScheme, only=('id', 'name'))
17-
product = fields.Nested(ProductScheme)
18-
hub = fields.Nested(HubScheme)
22+
provider = fields.Nested(CompanySchema, only=('id', 'name'))
23+
vendor = fields.Nested(CompanySchema, only=('id', 'name'))
24+
product = fields.Nested(ProductSchema)
25+
hub = fields.Nested(HubSchema)
1926

2027
@post_load
2128
def make_object(self, data):

0 commit comments

Comments
 (0)