aspose_email_cloud 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,88 @@
1
+ require 'date'
2
+
3
+ module AsposeEmailCloud
4
+ # base class containing fundamental method such as to_hash, build_from_hash and more
5
+ class BaseObject
6
+
7
+ # build the object from hash
8
+ def build_from_hash(attributes)
9
+ return nil unless attributes.is_a?(Hash)
10
+ self.class.swagger_types.each_pair do |key, type|
11
+ if type =~ /^Array<(.*)>/i
12
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
13
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
14
+ else
15
+ #TODO show warning in debug mode
16
+ end
17
+ elsif !attributes[self.class.attribute_map[key]].nil?
18
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
19
+ else
20
+ # data not found in attributes(hash), not an issue as the data can be optional
21
+ end
22
+ end
23
+
24
+ self
25
+ end
26
+
27
+ def _deserialize(type, value)
28
+ case type.to_sym
29
+ when :DateTime
30
+ DateTime.parse(value)
31
+ when :Date
32
+ Date.parse(value)
33
+ when :String
34
+ value.to_s
35
+ when :Integer
36
+ value.to_i
37
+ when :Float
38
+ value.to_f
39
+ when :BOOLEAN
40
+ if value =~ /^(true|t|yes|y|1)$/i
41
+ true
42
+ else
43
+ false
44
+ end
45
+ when :Object
46
+ value
47
+ else # model
48
+ _model = AsposeEmailCloud.const_get(type).new
49
+ _model.build_from_hash(value)
50
+ end
51
+ end
52
+
53
+ def to_s
54
+ to_hash.to_s
55
+ end
56
+
57
+ # to_body is an alias to to_body (backward compatibility))
58
+ def to_body
59
+ to_hash
60
+ end
61
+
62
+ # return the object in the form of hash
63
+ def to_hash
64
+ hash = {}
65
+ self.class.attribute_map.each_pair do |attr, param|
66
+ value = self.send(attr)
67
+ next if value.nil?
68
+ if value.is_a?(Array)
69
+ hash[param] = value.compact.map{ |v| _to_hash(v) }
70
+ else
71
+ hash[param] = _to_hash(value)
72
+ end
73
+ end
74
+ hash
75
+ end
76
+
77
+ # Method to output non-array value in the form of hash
78
+ # For object, use to_hash. Otherwise, just return the value
79
+ def _to_hash(value)
80
+ if value.respond_to? :to_hash
81
+ value.to_hash
82
+ else
83
+ value
84
+ end
85
+ end
86
+
87
+ end
88
+ end
@@ -0,0 +1,63 @@
1
+ module AsposeEmailCloud
2
+ #
3
+ class EmailDocument < BaseObject
4
+ attr_accessor :links, :document_properties, :data, :format
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'links' => :'Links',
11
+
12
+ #
13
+ :'document_properties' => :'DocumentProperties',
14
+
15
+ #
16
+ :'data' => :'Data',
17
+
18
+ #
19
+ :'format' => :'Format'
20
+
21
+ }
22
+ end
23
+
24
+ # attribute type
25
+ def self.swagger_types
26
+ {
27
+ :'links' => :'Array<Link>',
28
+ :'document_properties' => :'EmailProperties',
29
+ :'data' => :'Stream',
30
+ :'format' => :'String'
31
+
32
+ }
33
+ end
34
+
35
+ def initialize(attributes = {})
36
+ return if !attributes.is_a?(Hash) || attributes.empty?
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
40
+
41
+
42
+ if attributes[:'Links']
43
+ if (value = attributes[:'Links']).is_a?(Array)
44
+ self.links = value
45
+ end
46
+ end
47
+
48
+ if attributes[:'DocumentProperties']
49
+ self.document_properties = attributes[:'DocumentProperties']
50
+ end
51
+
52
+ if attributes[:'Data']
53
+ self.data = attributes[:'Data']
54
+ end
55
+
56
+ if attributes[:'Format']
57
+ self.format = attributes[:'Format']
58
+ end
59
+
60
+ end
61
+
62
+ end
63
+ end
@@ -0,0 +1,79 @@
1
+ module AsposeEmailCloud
2
+ #
3
+ class EmailDocumentResponse < BaseObject
4
+ attr_accessor :link, :properties, :document, :status, :code
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'link' => :'Link',
11
+
12
+ #
13
+ :'properties' => :'Properties',
14
+
15
+ #
16
+ :'document' => :'Document',
17
+
18
+ #
19
+ :'status' => :'Status',
20
+
21
+ #
22
+ :'code' => :'Code'
23
+
24
+ }
25
+ end
26
+
27
+ # attribute type
28
+ def self.swagger_types
29
+ {
30
+ :'link' => :'Link',
31
+ :'properties' => :'Array<EmailProperty>',
32
+ :'document' => :'EmailDocument',
33
+ :'status' => :'String',
34
+ :'code' => :'Integer'
35
+
36
+ }
37
+ end
38
+
39
+ def initialize(attributes = {})
40
+ return if !attributes.is_a?(Hash) || attributes.empty?
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
44
+
45
+
46
+ if attributes[:'Link']
47
+ self.link = attributes[:'Link']
48
+ end
49
+
50
+ if attributes[:'Properties']
51
+ if (value = attributes[:'Properties']).is_a?(Array)
52
+ self.properties = value
53
+ end
54
+ end
55
+
56
+ if attributes[:'Document']
57
+ self.document = attributes[:'Document']
58
+ end
59
+
60
+ if attributes[:'Status']
61
+ self.status = attributes[:'Status']
62
+ end
63
+
64
+ if attributes[:'Code']
65
+ self.code = attributes[:'Code']
66
+ end
67
+
68
+ end
69
+
70
+ def status=(status)
71
+ allowed_values = ["Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", "HttpVersionNotSupported"]
72
+ if status && !allowed_values.include?(status)
73
+ fail "invalid value for 'status', must be one of #{allowed_values}"
74
+ end
75
+ @status = status
76
+ end
77
+
78
+ end
79
+ end
@@ -0,0 +1,47 @@
1
+ module AsposeEmailCloud
2
+ #
3
+ class EmailProperties < BaseObject
4
+ attr_accessor :link, :list
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'link' => :'Link',
11
+
12
+ #
13
+ :'list' => :'List'
14
+
15
+ }
16
+ end
17
+
18
+ # attribute type
19
+ def self.swagger_types
20
+ {
21
+ :'link' => :'Link',
22
+ :'list' => :'Array<EmailProperty>'
23
+
24
+ }
25
+ end
26
+
27
+ def initialize(attributes = {})
28
+ return if !attributes.is_a?(Hash) || attributes.empty?
29
+
30
+ # convert string to symbol for hash key
31
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
32
+
33
+
34
+ if attributes[:'Link']
35
+ self.link = attributes[:'Link']
36
+ end
37
+
38
+ if attributes[:'List']
39
+ if (value = attributes[:'List']).is_a?(Array)
40
+ self.list = value
41
+ end
42
+ end
43
+
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,53 @@
1
+ module AsposeEmailCloud
2
+ #
3
+ class EmailProperty < BaseObject
4
+ attr_accessor :link, :name, :value
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'link' => :'Link',
11
+
12
+ #
13
+ :'name' => :'Name',
14
+
15
+ #
16
+ :'value' => :'Value'
17
+
18
+ }
19
+ end
20
+
21
+ # attribute type
22
+ def self.swagger_types
23
+ {
24
+ :'link' => :'Link',
25
+ :'name' => :'String',
26
+ :'value' => :'Object'
27
+
28
+ }
29
+ end
30
+
31
+ def initialize(attributes = {})
32
+ return if !attributes.is_a?(Hash) || attributes.empty?
33
+
34
+ # convert string to symbol for hash key
35
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
36
+
37
+
38
+ if attributes[:'Link']
39
+ self.link = attributes[:'Link']
40
+ end
41
+
42
+ if attributes[:'Name']
43
+ self.name = attributes[:'Name']
44
+ end
45
+
46
+ if attributes[:'Value']
47
+ self.value = attributes[:'Value']
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+ end
@@ -0,0 +1,61 @@
1
+ module AsposeEmailCloud
2
+ #
3
+ class EmailPropertyResponse < BaseObject
4
+ attr_accessor :email_property, :status, :code
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'email_property' => :'EmailProperty',
11
+
12
+ #
13
+ :'status' => :'Status',
14
+
15
+ #
16
+ :'code' => :'Code'
17
+
18
+ }
19
+ end
20
+
21
+ # attribute type
22
+ def self.swagger_types
23
+ {
24
+ :'email_property' => :'EmailProperty',
25
+ :'status' => :'String',
26
+ :'code' => :'Integer'
27
+
28
+ }
29
+ end
30
+
31
+ def initialize(attributes = {})
32
+ return if !attributes.is_a?(Hash) || attributes.empty?
33
+
34
+ # convert string to symbol for hash key
35
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
36
+
37
+
38
+ if attributes[:'EmailProperty']
39
+ self.email_property = attributes[:'EmailProperty']
40
+ end
41
+
42
+ if attributes[:'Status']
43
+ self.status = attributes[:'Status']
44
+ end
45
+
46
+ if attributes[:'Code']
47
+ self.code = attributes[:'Code']
48
+ end
49
+
50
+ end
51
+
52
+ def status=(status)
53
+ allowed_values = ["Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", "HttpVersionNotSupported"]
54
+ if status && !allowed_values.include?(status)
55
+ fail "invalid value for 'status', must be one of #{allowed_values}"
56
+ end
57
+ @status = status
58
+ end
59
+
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ module AsposeEmailCloud
2
+ #
3
+ class Link < BaseObject
4
+ attr_accessor :href, :rel, :type, :title
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'href' => :'Href',
11
+
12
+ #
13
+ :'rel' => :'Rel',
14
+
15
+ #
16
+ :'type' => :'Type',
17
+
18
+ #
19
+ :'title' => :'Title'
20
+
21
+ }
22
+ end
23
+
24
+ # attribute type
25
+ def self.swagger_types
26
+ {
27
+ :'href' => :'String',
28
+ :'rel' => :'String',
29
+ :'type' => :'String',
30
+ :'title' => :'String'
31
+
32
+ }
33
+ end
34
+
35
+ def initialize(attributes = {})
36
+ return if !attributes.is_a?(Hash) || attributes.empty?
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
40
+
41
+
42
+ if attributes[:'Href']
43
+ self.href = attributes[:'Href']
44
+ end
45
+
46
+ if attributes[:'Rel']
47
+ self.rel = attributes[:'Rel']
48
+ end
49
+
50
+ if attributes[:'Type']
51
+ self.type = attributes[:'Type']
52
+ end
53
+
54
+ if attributes[:'Title']
55
+ self.title = attributes[:'Title']
56
+ end
57
+
58
+ end
59
+
60
+ end
61
+ end