messagemedia_signingkeys_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.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +198 -0
  4. data/lib/message_media_signing_keys.rb +70 -0
  5. data/lib/message_media_signing_keys/api_helper.rb +273 -0
  6. data/lib/message_media_signing_keys/configuration.rb +29 -0
  7. data/lib/message_media_signing_keys/controllers/base_controller.rb +59 -0
  8. data/lib/message_media_signing_keys/controllers/signature_key_management_controller.rb +507 -0
  9. data/lib/message_media_signing_keys/exceptions/api_exception.rb +18 -0
  10. data/lib/message_media_signing_keys/exceptions/create_signature_key400_response_exception.rb +32 -0
  11. data/lib/message_media_signing_keys/exceptions/create_signature_key403_response_exception.rb +27 -0
  12. data/lib/message_media_signing_keys/exceptions/delete_signature_key403_response_exception.rb +27 -0
  13. data/lib/message_media_signing_keys/exceptions/disable_the_current_enabled_signature_key403_response_exception.rb +27 -0
  14. data/lib/message_media_signing_keys/exceptions/enable_signature_key400_response_exception.rb +32 -0
  15. data/lib/message_media_signing_keys/exceptions/enable_signature_key403_response_exception.rb +27 -0
  16. data/lib/message_media_signing_keys/exceptions/get_enabled_signature_key403_response_exception.rb +27 -0
  17. data/lib/message_media_signing_keys/exceptions/get_signature_key_detail400_response_exception.rb +32 -0
  18. data/lib/message_media_signing_keys/exceptions/get_signature_key_detail403_response_exception.rb +27 -0
  19. data/lib/message_media_signing_keys/exceptions/get_signature_key_list400_response_exception.rb +32 -0
  20. data/lib/message_media_signing_keys/exceptions/get_signature_key_list403_response_exception.rb +27 -0
  21. data/lib/message_media_signing_keys/http/auth/basic_auth.rb +20 -0
  22. data/lib/message_media_signing_keys/http/faraday_client.rb +55 -0
  23. data/lib/message_media_signing_keys/http/http_call_back.rb +22 -0
  24. data/lib/message_media_signing_keys/http/http_client.rb +102 -0
  25. data/lib/message_media_signing_keys/http/http_context.rb +18 -0
  26. data/lib/message_media_signing_keys/http/http_method_enum.rb +11 -0
  27. data/lib/message_media_signing_keys/http/http_request.rb +48 -0
  28. data/lib/message_media_signing_keys/http/http_response.rb +21 -0
  29. data/lib/message_media_signing_keys/message_media_signing_keys_client.rb +27 -0
  30. data/lib/message_media_signing_keys/models/base_model.rb +34 -0
  31. data/lib/message_media_signing_keys/models/create_signature_key_request.rb +42 -0
  32. data/lib/message_media_signing_keys/models/create_signature_key_response.rb +78 -0
  33. data/lib/message_media_signing_keys/models/enable_signature_key_request.rb +33 -0
  34. data/lib/message_media_signing_keys/models/enable_signature_key_response.rb +69 -0
  35. data/lib/message_media_signing_keys/models/get_enabled_signature_key_response.rb +69 -0
  36. data/lib/message_media_signing_keys/models/get_signature_key_detail_response.rb +69 -0
  37. data/lib/message_media_signing_keys/models/get_signature_key_list_response.rb +69 -0
  38. metadata +164 -0
@@ -0,0 +1,18 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # Class for exceptions when there is a network error, status code error, etc.
6
+ class APIException < StandardError
7
+ attr_reader :context, :response_code
8
+
9
+ # The constructor.
10
+ # @param [String] The reason for raising an exception.
11
+ # @param [HttpContext] The HttpContext of the API call.
12
+ def initialize(reason, context)
13
+ super(reason)
14
+ @context = context
15
+ @response_code = context.response.status_code
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,32 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # Create signature key 400 response class.
6
+ class CreateSignatureKey400ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [List of String]
13
+ attr_accessor :details
14
+
15
+ # The constructor.
16
+ # @param [String] The reason for raising an exception.
17
+ # @param [HttpContext] The HttpContext of the API call.
18
+ def initialize(reason, context)
19
+ super(reason, context)
20
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
21
+ unbox(hash)
22
+ end
23
+
24
+ # Populates this object by extracting properties from a hash.
25
+ # @param [Hash] The deserialized response sent by the server in the
26
+ # response body.
27
+ def unbox(hash)
28
+ @message = hash['message']
29
+ @details = hash['details']
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # Create signature key 403 response class.
6
+ class CreateSignatureKey403ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # The constructor.
12
+ # @param [String] The reason for raising an exception.
13
+ # @param [HttpContext] The HttpContext of the API call.
14
+ def initialize(reason, context)
15
+ super(reason, context)
16
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
17
+ unbox(hash)
18
+ end
19
+
20
+ # Populates this object by extracting properties from a hash.
21
+ # @param [Hash] The deserialized response sent by the server in the
22
+ # response body.
23
+ def unbox(hash)
24
+ @message = hash['message']
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # Delete signature key 403 response class.
6
+ class DeleteSignatureKey403ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # The constructor.
12
+ # @param [String] The reason for raising an exception.
13
+ # @param [HttpContext] The HttpContext of the API call.
14
+ def initialize(reason, context)
15
+ super(reason, context)
16
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
17
+ unbox(hash)
18
+ end
19
+
20
+ # Populates this object by extracting properties from a hash.
21
+ # @param [Hash] The deserialized response sent by the server in the
22
+ # response body.
23
+ def unbox(hash)
24
+ @message = hash['message']
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # Disable the current enabled signature key. 403 response class.
6
+ class DisableTheCurrentEnabledSignatureKey403ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # The constructor.
12
+ # @param [String] The reason for raising an exception.
13
+ # @param [HttpContext] The HttpContext of the API call.
14
+ def initialize(reason, context)
15
+ super(reason, context)
16
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
17
+ unbox(hash)
18
+ end
19
+
20
+ # Populates this object by extracting properties from a hash.
21
+ # @param [Hash] The deserialized response sent by the server in the
22
+ # response body.
23
+ def unbox(hash)
24
+ @message = hash['message']
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # Enable signature key 400 response class.
6
+ class EnableSignatureKey400ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [List of String]
13
+ attr_accessor :details
14
+
15
+ # The constructor.
16
+ # @param [String] The reason for raising an exception.
17
+ # @param [HttpContext] The HttpContext of the API call.
18
+ def initialize(reason, context)
19
+ super(reason, context)
20
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
21
+ unbox(hash)
22
+ end
23
+
24
+ # Populates this object by extracting properties from a hash.
25
+ # @param [Hash] The deserialized response sent by the server in the
26
+ # response body.
27
+ def unbox(hash)
28
+ @message = hash['message']
29
+ @details = hash['details']
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # Enable signature key 403 response class.
6
+ class EnableSignatureKey403ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # The constructor.
12
+ # @param [String] The reason for raising an exception.
13
+ # @param [HttpContext] The HttpContext of the API call.
14
+ def initialize(reason, context)
15
+ super(reason, context)
16
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
17
+ unbox(hash)
18
+ end
19
+
20
+ # Populates this object by extracting properties from a hash.
21
+ # @param [Hash] The deserialized response sent by the server in the
22
+ # response body.
23
+ def unbox(hash)
24
+ @message = hash['message']
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # Get enabled signature key 403 response class.
6
+ class GetEnabledSignatureKey403ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # The constructor.
12
+ # @param [String] The reason for raising an exception.
13
+ # @param [HttpContext] The HttpContext of the API call.
14
+ def initialize(reason, context)
15
+ super(reason, context)
16
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
17
+ unbox(hash)
18
+ end
19
+
20
+ # Populates this object by extracting properties from a hash.
21
+ # @param [Hash] The deserialized response sent by the server in the
22
+ # response body.
23
+ def unbox(hash)
24
+ @message = hash['message']
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # GET signature key detail 400 response class.
6
+ class GETSignatureKeyDetail400ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [List of String]
13
+ attr_accessor :details
14
+
15
+ # The constructor.
16
+ # @param [String] The reason for raising an exception.
17
+ # @param [HttpContext] The HttpContext of the API call.
18
+ def initialize(reason, context)
19
+ super(reason, context)
20
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
21
+ unbox(hash)
22
+ end
23
+
24
+ # Populates this object by extracting properties from a hash.
25
+ # @param [Hash] The deserialized response sent by the server in the
26
+ # response body.
27
+ def unbox(hash)
28
+ @message = hash['message']
29
+ @details = hash['details']
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # GET signature key detail 403 response class.
6
+ class GETSignatureKeyDetail403ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # The constructor.
12
+ # @param [String] The reason for raising an exception.
13
+ # @param [HttpContext] The HttpContext of the API call.
14
+ def initialize(reason, context)
15
+ super(reason, context)
16
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
17
+ unbox(hash)
18
+ end
19
+
20
+ # Populates this object by extracting properties from a hash.
21
+ # @param [Hash] The deserialized response sent by the server in the
22
+ # response body.
23
+ def unbox(hash)
24
+ @message = hash['message']
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # GET signature key list 400 response class.
6
+ class GETSignatureKeyList400ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [List of String]
13
+ attr_accessor :details
14
+
15
+ # The constructor.
16
+ # @param [String] The reason for raising an exception.
17
+ # @param [HttpContext] The HttpContext of the API call.
18
+ def initialize(reason, context)
19
+ super(reason, context)
20
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
21
+ unbox(hash)
22
+ end
23
+
24
+ # Populates this object by extracting properties from a hash.
25
+ # @param [Hash] The deserialized response sent by the server in the
26
+ # response body.
27
+ def unbox(hash)
28
+ @message = hash['message']
29
+ @details = hash['details']
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # GET signature key list 403 response class.
6
+ class GETSignatureKeyList403ResponseException < APIException
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :message
10
+
11
+ # The constructor.
12
+ # @param [String] The reason for raising an exception.
13
+ # @param [HttpContext] The HttpContext of the API call.
14
+ def initialize(reason, context)
15
+ super(reason, context)
16
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
17
+ unbox(hash)
18
+ end
19
+
20
+ # Populates this object by extracting properties from a hash.
21
+ # @param [Hash] The deserialized response sent by the server in the
22
+ # response body.
23
+ def unbox(hash)
24
+ @message = hash['message']
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'base64'
5
+
6
+ module MessageMediaSigningKeys
7
+ # Utility class for basic authorization.
8
+ class BasicAuth
9
+ # Add basic authentication to the request.
10
+ # @param [HttpRequest] The HttpRequest object to which authentication will
11
+ # be added.
12
+ def self.apply(http_request)
13
+ username = Configuration.basic_auth_user_name
14
+ password = Configuration.basic_auth_password
15
+ value = Base64.strict_encode64("#{username}:#{password}")
16
+ header_value = "Basic #{value}"
17
+ http_request.headers['Authorization'] = header_value
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,55 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+ require 'faraday/http_cache'
4
+
5
+ module MessageMediaSigningKeys
6
+ # An implementation of HttpClient.
7
+ class FaradayClient < HttpClient
8
+ # The constructor.
9
+ def initialize(timeout: nil, cache: false,
10
+ max_retries: nil, retry_interval: nil)
11
+ @connection = Faraday.new do |faraday|
12
+ faraday.use Faraday::HttpCache, serializer: Marshal if cache
13
+ faraday.request :multipart
14
+ faraday.request :url_encoded
15
+ faraday.ssl[:ca_file] = Certifi.where
16
+ faraday.adapter Faraday.default_adapter
17
+ faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
18
+ faraday.options[:open_timeout] = timeout if timeout
19
+ faraday.request :retry, max: max_retries, interval: if max_retries &&
20
+ retry_interval
21
+ retry_interval
22
+ end
23
+ end
24
+ end
25
+
26
+ # Method overridden from HttpClient.
27
+ def execute_as_string(http_request)
28
+ response = @connection.send(
29
+ http_request.http_method.downcase,
30
+ http_request.query_url
31
+ ) do |request|
32
+ request.headers = http_request.headers
33
+ request.body = http_request.parameters
34
+ end
35
+ convert_response(response)
36
+ end
37
+
38
+ # Method overridden from HttpClient.
39
+ def execute_as_binary(http_request)
40
+ response = @connection.send(
41
+ http_request.http_method.downcase,
42
+ http_request.query_url
43
+ ) do |request|
44
+ request.headers = http_request.headers
45
+ request.body = http_request.parameters
46
+ end
47
+ convert_response(response)
48
+ end
49
+
50
+ # Method overridden from HttpClient.
51
+ def convert_response(response)
52
+ HttpResponse.new(response.status, response.headers, response.body)
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,22 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaSigningKeys
5
+ # HttpCallBack allows defining callables for pre and post API calls.
6
+ class HttpCallBack
7
+ # A controller will call this method before making an HTTP Request.
8
+ # @param [HttpRequest] The HttpRequest object which the HttpClient
9
+ # will execute.
10
+ def on_before_request(_http_request)
11
+ raise NotImplementedError, 'This method needs
12
+ to be implemented in a child class.'
13
+ end
14
+
15
+ # A controller will call this method after making an HTTP Request.
16
+ # @param [HttpContext] The HttpContext of the API call.
17
+ def on_after_response(_http_context)
18
+ raise NotImplementedError, 'This method needs
19
+ to be implemented in a child class.'
20
+ end
21
+ end
22
+ end