messagemedia_conversations_sdk 1.0.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 +201 -0
- data/README.md +149 -0
- data/lib/message_media_conversations.rb +63 -0
- data/lib/message_media_conversations/api_helper.rb +273 -0
- data/lib/message_media_conversations/configuration.rb +29 -0
- data/lib/message_media_conversations/controllers/app_users_controller.rb +285 -0
- data/lib/message_media_conversations/controllers/base_controller.rb +59 -0
- data/lib/message_media_conversations/controllers/configuration_controller.rb +90 -0
- data/lib/message_media_conversations/controllers/facebook_controller.rb +192 -0
- data/lib/message_media_conversations/exceptions/api_exception.rb +18 -0
- data/lib/message_media_conversations/http/auth/basic_auth.rb +20 -0
- data/lib/message_media_conversations/http/faraday_client.rb +55 -0
- data/lib/message_media_conversations/http/http_call_back.rb +22 -0
- data/lib/message_media_conversations/http/http_client.rb +102 -0
- data/lib/message_media_conversations/http/http_context.rb +18 -0
- data/lib/message_media_conversations/http/http_method_enum.rb +11 -0
- data/lib/message_media_conversations/http/http_request.rb +48 -0
- data/lib/message_media_conversations/http/http_response.rb +21 -0
- data/lib/message_media_conversations/message_media_conversations_client.rb +39 -0
- data/lib/message_media_conversations/models/app_user_dto.rb +51 -0
- data/lib/message_media_conversations/models/app_users_dto.rb +40 -0
- data/lib/message_media_conversations/models/base_message_dto.rb +42 -0
- data/lib/message_media_conversations/models/base_model.rb +34 -0
- data/lib/message_media_conversations/models/configure_account_request.rb +42 -0
- data/lib/message_media_conversations/models/configure_account_response.rb +42 -0
- data/lib/message_media_conversations/models/facebook_authorisation_response.rb +33 -0
- data/lib/message_media_conversations/models/facebook_page_dto.rb +42 -0
- data/lib/message_media_conversations/models/facebook_pages_dto.rb +40 -0
- data/lib/message_media_conversations/models/get_app_user_by_id_response.rb +51 -0
- data/lib/message_media_conversations/models/get_app_user_messages_response.rb +33 -0
- data/lib/message_media_conversations/models/get_app_users_response.rb +33 -0
- data/lib/message_media_conversations/models/get_facebook_authorisation_url_response.rb +33 -0
- data/lib/message_media_conversations/models/get_facebook_pages_response.rb +33 -0
- data/lib/message_media_conversations/models/message_dto.rb +60 -0
- data/lib/message_media_conversations/models/messages_dto.rb +40 -0
- data/lib/message_media_conversations/models/provision_account_request.rb +42 -0
- data/lib/message_media_conversations/models/send_message_response.rb +42 -0
- metadata +169 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# Represents a single Http Request.
|
6
|
+
class HttpRequest
|
7
|
+
attr_accessor :http_method, :query_url, :headers,
|
8
|
+
:parameters, :username, :password
|
9
|
+
|
10
|
+
# The constructor.
|
11
|
+
# @param [HttpMethodEnum] The HTTP method.
|
12
|
+
# @param [String] The URL to send the request to.
|
13
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
14
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
15
|
+
def initialize(http_method,
|
16
|
+
query_url,
|
17
|
+
headers: {},
|
18
|
+
parameters: {})
|
19
|
+
@http_method = http_method
|
20
|
+
@query_url = query_url
|
21
|
+
@headers = headers
|
22
|
+
@parameters = parameters
|
23
|
+
end
|
24
|
+
|
25
|
+
# Add a header to the HttpRequest.
|
26
|
+
# @param [String] The name of the header.
|
27
|
+
# @param [String] The value of the header.
|
28
|
+
def add_header(name, value)
|
29
|
+
@headers[name] = value
|
30
|
+
end
|
31
|
+
|
32
|
+
# Add a parameter to the HttpRequest.
|
33
|
+
# @param [String] The name of the parameter.
|
34
|
+
# @param [String] The value of the parameter.
|
35
|
+
def add_parameter(name, value)
|
36
|
+
@parameters[name] = value
|
37
|
+
end
|
38
|
+
|
39
|
+
# Add a query parameter to the HttpRequest.
|
40
|
+
# @param [String] The name of the query parameter.
|
41
|
+
# @param [String] The value of the query parameter.
|
42
|
+
def add_query_parameter(name, value)
|
43
|
+
@query_url = APIHelper.append_url_with_query_parameters(@query_url,
|
44
|
+
name => value)
|
45
|
+
@query_url = APIHelper.clean_url(@query_url)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# Http response received.
|
6
|
+
class HttpResponse
|
7
|
+
attr_accessor :status_code, :headers, :raw_body
|
8
|
+
|
9
|
+
# The constructor
|
10
|
+
# @param [Integer] The status code returned by the server.
|
11
|
+
# @param [Hash] The headers sent by the server in the response.
|
12
|
+
# @param [String] The raw body of the response.
|
13
|
+
def initialize(status_code,
|
14
|
+
headers,
|
15
|
+
raw_body)
|
16
|
+
@status_code = status_code
|
17
|
+
@headers = headers
|
18
|
+
@raw_body = raw_body
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# message_media_conversations client class.
|
6
|
+
class MessageMediaConversationsClient
|
7
|
+
# Singleton access to app_users controller.
|
8
|
+
# @return [AppUsersController] Returns the controller instance.
|
9
|
+
def app_users
|
10
|
+
AppUsersController.instance
|
11
|
+
end
|
12
|
+
|
13
|
+
# Singleton access to configuration controller.
|
14
|
+
# @return [ConfigurationController] Returns the controller instance.
|
15
|
+
def configuration
|
16
|
+
ConfigurationController.instance
|
17
|
+
end
|
18
|
+
|
19
|
+
# Singleton access to facebook controller.
|
20
|
+
# @return [FacebookController] Returns the controller instance.
|
21
|
+
def facebook
|
22
|
+
FacebookController.instance
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns the configuration class for easy access.
|
26
|
+
# @return [Configuration] Returns the actual configuration class.
|
27
|
+
def config
|
28
|
+
Configuration
|
29
|
+
end
|
30
|
+
|
31
|
+
# Initializer with authentication and configuration parameters.
|
32
|
+
def initialize(basic_auth_user_name: nil, basic_auth_password: nil)
|
33
|
+
Configuration.basic_auth_user_name = basic_auth_user_name if
|
34
|
+
basic_auth_user_name
|
35
|
+
Configuration.basic_auth_password = basic_auth_password if
|
36
|
+
basic_auth_password
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# AppUserDto Model.
|
6
|
+
class AppUserDto < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :given_name
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :id
|
14
|
+
|
15
|
+
# TODO: Write general description for this method
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :surname
|
18
|
+
|
19
|
+
# A mapping from model property names to API property names.
|
20
|
+
def self.names
|
21
|
+
@_hash = {} if @_hash.nil?
|
22
|
+
@_hash['given_name'] = 'givenName'
|
23
|
+
@_hash['id'] = 'id'
|
24
|
+
@_hash['surname'] = 'surname'
|
25
|
+
@_hash
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(given_name = nil,
|
29
|
+
id = nil,
|
30
|
+
surname = nil)
|
31
|
+
@given_name = given_name
|
32
|
+
@id = id
|
33
|
+
@surname = surname
|
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
|
+
given_name = hash['givenName']
|
42
|
+
id = hash['id']
|
43
|
+
surname = hash['surname']
|
44
|
+
|
45
|
+
# Create object from extracted values.
|
46
|
+
AppUserDto.new(given_name,
|
47
|
+
id,
|
48
|
+
surname)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# AppUsersDto Model.
|
6
|
+
class AppUsersDto < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [List of AppUserDto]
|
9
|
+
attr_accessor :users
|
10
|
+
|
11
|
+
# A mapping from model property names to API property names.
|
12
|
+
def self.names
|
13
|
+
@_hash = {} if @_hash.nil?
|
14
|
+
@_hash['users'] = 'users'
|
15
|
+
@_hash
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(users = nil)
|
19
|
+
@users = users
|
20
|
+
end
|
21
|
+
|
22
|
+
# Creates an instance of the object from a hash.
|
23
|
+
def self.from_hash(hash)
|
24
|
+
return nil unless hash
|
25
|
+
|
26
|
+
# Extract variables from the hash.
|
27
|
+
# Parameter is an array, so we need to iterate through it
|
28
|
+
users = nil
|
29
|
+
unless hash['users'].nil?
|
30
|
+
users = []
|
31
|
+
hash['users'].each do |structure|
|
32
|
+
users << (AppUserDto.from_hash(structure) if structure)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Create object from extracted values.
|
37
|
+
AppUsersDto.new(users)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# BaseMessageDto Model.
|
6
|
+
class BaseMessageDto < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :text
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :channel
|
14
|
+
|
15
|
+
# A mapping from model property names to API property names.
|
16
|
+
def self.names
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['text'] = 'text'
|
19
|
+
@_hash['channel'] = 'channel'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(text = nil,
|
24
|
+
channel = nil)
|
25
|
+
@text = text
|
26
|
+
@channel = channel
|
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
|
+
text = hash['text']
|
35
|
+
channel = hash['channel']
|
36
|
+
|
37
|
+
# Create object from extracted values.
|
38
|
+
BaseMessageDto.new(text,
|
39
|
+
channel)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
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,42 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# ConfigureAccountRequest Model.
|
6
|
+
class ConfigureAccountRequest < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :name
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :callback_url
|
14
|
+
|
15
|
+
# A mapping from model property names to API property names.
|
16
|
+
def self.names
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['name'] = 'name'
|
19
|
+
@_hash['callback_url'] = 'callback_url'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(name = nil,
|
24
|
+
callback_url = nil)
|
25
|
+
@name = name
|
26
|
+
@callback_url = callback_url
|
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
|
+
name = hash['name']
|
35
|
+
callback_url = hash['callback_url']
|
36
|
+
|
37
|
+
# Create object from extracted values.
|
38
|
+
ConfigureAccountRequest.new(name,
|
39
|
+
callback_url)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# ConfigureAccountResponse Model.
|
6
|
+
class ConfigureAccountResponse < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :name
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :callback_url
|
14
|
+
|
15
|
+
# A mapping from model property names to API property names.
|
16
|
+
def self.names
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['name'] = 'name'
|
19
|
+
@_hash['callback_url'] = 'callback_url'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(name = nil,
|
24
|
+
callback_url = nil)
|
25
|
+
@name = name
|
26
|
+
@callback_url = callback_url
|
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
|
+
name = hash['name']
|
35
|
+
callback_url = hash['callback_url']
|
36
|
+
|
37
|
+
# Create object from extracted values.
|
38
|
+
ConfigureAccountResponse.new(name,
|
39
|
+
callback_url)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# FacebookAuthorisationResponse Model.
|
6
|
+
class FacebookAuthorisationResponse < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :authorisation_url
|
10
|
+
|
11
|
+
# A mapping from model property names to API property names.
|
12
|
+
def self.names
|
13
|
+
@_hash = {} if @_hash.nil?
|
14
|
+
@_hash['authorisation_url'] = 'authorisationUrl'
|
15
|
+
@_hash
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(authorisation_url = nil)
|
19
|
+
@authorisation_url = authorisation_url
|
20
|
+
end
|
21
|
+
|
22
|
+
# Creates an instance of the object from a hash.
|
23
|
+
def self.from_hash(hash)
|
24
|
+
return nil unless hash
|
25
|
+
|
26
|
+
# Extract variables from the hash.
|
27
|
+
authorisation_url = hash['authorisationUrl']
|
28
|
+
|
29
|
+
# Create object from extracted values.
|
30
|
+
FacebookAuthorisationResponse.new(authorisation_url)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file was automatically generated for MessageMedia by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MessageMediaConversations
|
5
|
+
# FacebookPageDto Model.
|
6
|
+
class FacebookPageDto < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :id
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :name
|
14
|
+
|
15
|
+
# A mapping from model property names to API property names.
|
16
|
+
def self.names
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['id'] = 'id'
|
19
|
+
@_hash['name'] = 'name'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(id = nil,
|
24
|
+
name = nil)
|
25
|
+
@id = id
|
26
|
+
@name = 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
|
+
id = hash['id']
|
35
|
+
name = hash['name']
|
36
|
+
|
37
|
+
# Create object from extracted values.
|
38
|
+
FacebookPageDto.new(id,
|
39
|
+
name)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|