pepipost_gem 2.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 +7 -0
- data/LICENSE +28 -0
- data/README.md +141 -0
- data/lib/pepipost_gem.rb +40 -0
- data/lib/pepipost_gem/api_helper.rb +273 -0
- data/lib/pepipost_gem/configuration.rb +17 -0
- data/lib/pepipost_gem/controllers/base_controller.rb +49 -0
- data/lib/pepipost_gem/controllers/email_controller.rb +59 -0
- data/lib/pepipost_gem/exceptions/api_exception.rb +18 -0
- data/lib/pepipost_gem/http/faraday_client.rb +55 -0
- data/lib/pepipost_gem/http/http_call_back.rb +22 -0
- data/lib/pepipost_gem/http/http_client.rb +102 -0
- data/lib/pepipost_gem/http/http_context.rb +18 -0
- data/lib/pepipost_gem/http/http_method_enum.rb +11 -0
- data/lib/pepipost_gem/http/http_request.rb +48 -0
- data/lib/pepipost_gem/http/http_response.rb +21 -0
- data/lib/pepipost_gem/models/attachments.rb +42 -0
- data/lib/pepipost_gem/models/attribute.rb +42 -0
- data/lib/pepipost_gem/models/base_model.rb +34 -0
- data/lib/pepipost_gem/models/email_body.rb +119 -0
- data/lib/pepipost_gem/models/email_body_attachments.rb +42 -0
- data/lib/pepipost_gem/models/from.rb +42 -0
- data/lib/pepipost_gem/models/personalizations.rb +85 -0
- data/lib/pepipost_gem/models/send_email_error.rb +42 -0
- data/lib/pepipost_gem/models/send_email_response.rb +52 -0
- data/lib/pepipost_gem/models/settings.rb +69 -0
- data/lib/pepipost_gem/pepipost_gem_client.rb +19 -0
- metadata +152 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module PepipostGem
|
5
|
+
# Attribute Model.
|
6
|
+
class Attribute < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :myname
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :age
|
14
|
+
|
15
|
+
# A mapping from model property names to API property names.
|
16
|
+
def self.names
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['myname'] = 'myname'
|
19
|
+
@_hash['age'] = 'age'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(myname = nil,
|
24
|
+
age = nil)
|
25
|
+
@myname = myname
|
26
|
+
@age = age
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates an instance of the object from a hash.
|
30
|
+
def self.from_hash(hash)
|
31
|
+
return nil unless hash
|
32
|
+
|
33
|
+
# Extract variables from the hash.
|
34
|
+
myname = hash['myname']
|
35
|
+
age = hash['age']
|
36
|
+
|
37
|
+
# Create object from extracted values.
|
38
|
+
Attribute.new(myname,
|
39
|
+
age)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module PepipostGem
|
5
|
+
# Base model.
|
6
|
+
class BaseModel
|
7
|
+
# Returns a Hash representation of the current object.
|
8
|
+
def to_hash
|
9
|
+
hash = {}
|
10
|
+
instance_variables.each do |name|
|
11
|
+
value = instance_variable_get(name)
|
12
|
+
name = name[1..-1]
|
13
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
14
|
+
if value.instance_of? Array
|
15
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
16
|
+
elsif value.instance_of? Hash
|
17
|
+
hash[key] = {}
|
18
|
+
value.each do |k, v|
|
19
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
20
|
+
end
|
21
|
+
else
|
22
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
hash
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns a JSON representation of the curent object.
|
29
|
+
def to_json(options = {})
|
30
|
+
hash = to_hash
|
31
|
+
hash.to_json(options)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module PepipostGem
|
5
|
+
# Mail Body which will be passed as json in apicall.
|
6
|
+
class EmailBody < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [List of Personalizations]
|
9
|
+
attr_accessor :personalizations
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :tags
|
14
|
+
|
15
|
+
# TODO: Write general description for this method
|
16
|
+
# @return [From]
|
17
|
+
attr_accessor :from
|
18
|
+
|
19
|
+
# TODO: Write general description for this method
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :subject
|
22
|
+
|
23
|
+
# TODO: Write general description for this method
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :content
|
26
|
+
|
27
|
+
# TODO: Write general description for this method
|
28
|
+
# @return [List of EmailBodyAttachments]
|
29
|
+
attr_accessor :attachments
|
30
|
+
|
31
|
+
# TODO: Write general description for this method
|
32
|
+
# @return [Settings]
|
33
|
+
attr_accessor :settings
|
34
|
+
|
35
|
+
# TODO: Write general description for this method
|
36
|
+
# @return [String]
|
37
|
+
attr_accessor :reply_to_id
|
38
|
+
|
39
|
+
# TODO: Write general description for this method
|
40
|
+
# @return [Integer]
|
41
|
+
attr_accessor :template_id
|
42
|
+
|
43
|
+
# A mapping from model property names to API property names.
|
44
|
+
def self.names
|
45
|
+
@_hash = {} if @_hash.nil?
|
46
|
+
@_hash['personalizations'] = 'personalizations'
|
47
|
+
@_hash['tags'] = 'tags'
|
48
|
+
@_hash['from'] = 'from'
|
49
|
+
@_hash['subject'] = 'subject'
|
50
|
+
@_hash['content'] = 'content'
|
51
|
+
@_hash['attachments'] = 'attachments'
|
52
|
+
@_hash['settings'] = 'settings'
|
53
|
+
@_hash['reply_to_id'] = 'replyToId'
|
54
|
+
@_hash['template_id'] = 'templateId'
|
55
|
+
@_hash
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize(personalizations = nil,
|
59
|
+
tags = nil,
|
60
|
+
from = nil,
|
61
|
+
subject = nil,
|
62
|
+
content = nil,
|
63
|
+
attachments = nil,
|
64
|
+
settings = nil,
|
65
|
+
reply_to_id = nil,
|
66
|
+
template_id = nil)
|
67
|
+
@personalizations = personalizations
|
68
|
+
@tags = tags
|
69
|
+
@from = from
|
70
|
+
@subject = subject
|
71
|
+
@content = content
|
72
|
+
@attachments = attachments
|
73
|
+
@settings = settings
|
74
|
+
@reply_to_id = reply_to_id
|
75
|
+
@template_id = template_id
|
76
|
+
end
|
77
|
+
|
78
|
+
# Creates an instance of the object from a hash.
|
79
|
+
def self.from_hash(hash)
|
80
|
+
return nil unless hash
|
81
|
+
|
82
|
+
# Extract variables from the hash.
|
83
|
+
# Parameter is an array, so we need to iterate through it
|
84
|
+
personalizations = nil
|
85
|
+
unless hash['personalizations'].nil?
|
86
|
+
personalizations = []
|
87
|
+
hash['personalizations'].each do |structure|
|
88
|
+
personalizations << (Personalizations.from_hash(structure) if structure)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
tags = hash['tags']
|
92
|
+
from = From.from_hash(hash['from']) if hash['from']
|
93
|
+
subject = hash['subject']
|
94
|
+
content = hash['content']
|
95
|
+
# Parameter is an array, so we need to iterate through it
|
96
|
+
attachments = nil
|
97
|
+
unless hash['attachments'].nil?
|
98
|
+
attachments = []
|
99
|
+
hash['attachments'].each do |structure|
|
100
|
+
attachments << (EmailBodyAttachments.from_hash(structure) if structure)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
settings = Settings.from_hash(hash['settings']) if hash['settings']
|
104
|
+
reply_to_id = hash['replyToId']
|
105
|
+
template_id = hash['templateId']
|
106
|
+
|
107
|
+
# Create object from extracted values.
|
108
|
+
EmailBody.new(personalizations,
|
109
|
+
tags,
|
110
|
+
from,
|
111
|
+
subject,
|
112
|
+
content,
|
113
|
+
attachments,
|
114
|
+
settings,
|
115
|
+
reply_to_id,
|
116
|
+
template_id)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module PepipostGem
|
5
|
+
# EmailBodyAttachments Model.
|
6
|
+
class EmailBodyAttachments < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :file_content
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :file_name
|
14
|
+
|
15
|
+
# A mapping from model property names to API property names.
|
16
|
+
def self.names
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['file_content'] = 'fileContent'
|
19
|
+
@_hash['file_name'] = 'fileName'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(file_content = nil,
|
24
|
+
file_name = nil)
|
25
|
+
@file_content = file_content
|
26
|
+
@file_name = file_name
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates an instance of the object from a hash.
|
30
|
+
def self.from_hash(hash)
|
31
|
+
return nil unless hash
|
32
|
+
|
33
|
+
# Extract variables from the hash.
|
34
|
+
file_content = hash['fileContent']
|
35
|
+
file_name = hash['fileName']
|
36
|
+
|
37
|
+
# Create object from extracted values.
|
38
|
+
EmailBodyAttachments.new(file_content,
|
39
|
+
file_name)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module PepipostGem
|
5
|
+
# From Model.
|
6
|
+
class From < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :from_email
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :from_name
|
14
|
+
|
15
|
+
# A mapping from model property names to API property names.
|
16
|
+
def self.names
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['from_email'] = 'fromEmail'
|
19
|
+
@_hash['from_name'] = 'fromName'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(from_email = nil,
|
24
|
+
from_name = nil)
|
25
|
+
@from_email = from_email
|
26
|
+
@from_name = from_name
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates an instance of the object from a hash.
|
30
|
+
def self.from_hash(hash)
|
31
|
+
return nil unless hash
|
32
|
+
|
33
|
+
# Extract variables from the hash.
|
34
|
+
from_email = hash['fromEmail']
|
35
|
+
from_name = hash['fromName']
|
36
|
+
|
37
|
+
# Create object from extracted values.
|
38
|
+
From.new(from_email,
|
39
|
+
from_name)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module PepipostGem
|
5
|
+
# This consits of personlized attachments with recipient,recipient_cc,etc.
|
6
|
+
class Personalizations < BaseModel
|
7
|
+
# Emails to be passed in Apicall
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :recipient
|
10
|
+
|
11
|
+
# Emails to be passed in Apicall
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :x_apiheader_cc
|
14
|
+
|
15
|
+
# Emails to be passed in Apicall
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :x_apiheader
|
18
|
+
|
19
|
+
# Emails to be passed in Apicall
|
20
|
+
# @return [Object]
|
21
|
+
attr_accessor :attributes
|
22
|
+
|
23
|
+
# Emails to be passed in Apicall
|
24
|
+
# @return [List of Attachments]
|
25
|
+
attr_accessor :attachments
|
26
|
+
|
27
|
+
# Emails to be passed in Apicall
|
28
|
+
# @return [List of String]
|
29
|
+
attr_accessor :recipient_cc
|
30
|
+
|
31
|
+
# A mapping from model property names to API property names.
|
32
|
+
def self.names
|
33
|
+
@_hash = {} if @_hash.nil?
|
34
|
+
@_hash['recipient'] = 'recipient'
|
35
|
+
@_hash['x_apiheader_cc'] = 'x-apiheader_cc'
|
36
|
+
@_hash['x_apiheader'] = 'x-apiheader'
|
37
|
+
@_hash['attributes'] = 'attributes'
|
38
|
+
@_hash['attachments'] = 'attachments'
|
39
|
+
@_hash['recipient_cc'] = 'recipient_cc'
|
40
|
+
@_hash
|
41
|
+
end
|
42
|
+
|
43
|
+
def initialize(recipient = nil,
|
44
|
+
x_apiheader_cc = nil,
|
45
|
+
x_apiheader = nil,
|
46
|
+
attributes = nil,
|
47
|
+
attachments = nil,
|
48
|
+
recipient_cc = nil)
|
49
|
+
@recipient = recipient
|
50
|
+
@x_apiheader_cc = x_apiheader_cc
|
51
|
+
@x_apiheader = x_apiheader
|
52
|
+
@attributes = attributes
|
53
|
+
@attachments = attachments
|
54
|
+
@recipient_cc = recipient_cc
|
55
|
+
end
|
56
|
+
|
57
|
+
# Creates an instance of the object from a hash.
|
58
|
+
def self.from_hash(hash)
|
59
|
+
return nil unless hash
|
60
|
+
|
61
|
+
# Extract variables from the hash.
|
62
|
+
recipient = hash['recipient']
|
63
|
+
x_apiheader_cc = hash['x-apiheader_cc']
|
64
|
+
x_apiheader = hash['x-apiheader']
|
65
|
+
attributes = hash['attributes']
|
66
|
+
# Parameter is an array, so we need to iterate through it
|
67
|
+
attachments = nil
|
68
|
+
unless hash['attachments'].nil?
|
69
|
+
attachments = []
|
70
|
+
hash['attachments'].each do |structure|
|
71
|
+
attachments << (Attachments.from_hash(structure) if structure)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
recipient_cc = hash['recipient_cc']
|
75
|
+
|
76
|
+
# Create object from extracted values.
|
77
|
+
Personalizations.new(recipient,
|
78
|
+
x_apiheader_cc,
|
79
|
+
x_apiheader,
|
80
|
+
attributes,
|
81
|
+
attachments,
|
82
|
+
recipient_cc)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module PepipostGem
|
5
|
+
# SendEmailError Model.
|
6
|
+
class SendEmailError < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :error_message
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [Integer]
|
13
|
+
attr_accessor :error_code
|
14
|
+
|
15
|
+
# A mapping from model property names to API property names.
|
16
|
+
def self.names
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['error_message'] = 'error_message'
|
19
|
+
@_hash['error_code'] = 'error_code'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(error_message = nil,
|
24
|
+
error_code = nil)
|
25
|
+
@error_message = error_message
|
26
|
+
@error_code = error_code
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates an instance of the object from a hash.
|
30
|
+
def self.from_hash(hash)
|
31
|
+
return nil unless hash
|
32
|
+
|
33
|
+
# Extract variables from the hash.
|
34
|
+
error_message = hash['error_message']
|
35
|
+
error_code = hash['error_code']
|
36
|
+
|
37
|
+
# Create object from extracted values.
|
38
|
+
SendEmailError.new(error_message,
|
39
|
+
error_code)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module PepipostGem
|
5
|
+
# Response of the email
|
6
|
+
class SendEmailResponse < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [Object]
|
9
|
+
attr_accessor :data
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :message
|
14
|
+
|
15
|
+
# TODO: Write general description for this method
|
16
|
+
# @return [SendEmailError]
|
17
|
+
attr_accessor :error_info
|
18
|
+
|
19
|
+
# A mapping from model property names to API property names.
|
20
|
+
def self.names
|
21
|
+
@_hash = {} if @_hash.nil?
|
22
|
+
@_hash['data'] = 'data'
|
23
|
+
@_hash['message'] = 'message'
|
24
|
+
@_hash['error_info'] = 'error_info'
|
25
|
+
@_hash
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(data = nil,
|
29
|
+
message = nil,
|
30
|
+
error_info = nil)
|
31
|
+
@data = data
|
32
|
+
@message = message
|
33
|
+
@error_info = error_info
|
34
|
+
end
|
35
|
+
|
36
|
+
# Creates an instance of the object from a hash.
|
37
|
+
def self.from_hash(hash)
|
38
|
+
return nil unless hash
|
39
|
+
|
40
|
+
# Extract variables from the hash.
|
41
|
+
data = hash['data']
|
42
|
+
message = hash['message']
|
43
|
+
error_info = SendEmailError.from_hash(hash['error_info']) if
|
44
|
+
hash['error_info']
|
45
|
+
|
46
|
+
# Create object from extracted values.
|
47
|
+
SendEmailResponse.new(data,
|
48
|
+
message,
|
49
|
+
error_info)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|