mundi_api 0.9.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 +2186 -0
- data/lib/mundi_api.rb +137 -0
- data/lib/mundi_api/api_helper.rb +209 -0
- data/lib/mundi_api/configuration.rb +25 -0
- data/lib/mundi_api/controllers/base_controller.rb +61 -0
- data/lib/mundi_api/controllers/charges_controller.rb +359 -0
- data/lib/mundi_api/controllers/customers_controller.rb +758 -0
- data/lib/mundi_api/controllers/invoices_controller.rb +184 -0
- data/lib/mundi_api/controllers/orders_controller.rb +171 -0
- data/lib/mundi_api/controllers/plans_controller.rb +387 -0
- data/lib/mundi_api/controllers/subscriptions_controller.rb +648 -0
- data/lib/mundi_api/controllers/tokens_controller.rb +87 -0
- data/lib/mundi_api/exceptions/api_exception.rb +18 -0
- data/lib/mundi_api/exceptions/error_exception.rb +37 -0
- data/lib/mundi_api/http/auth/basic_auth.rb +20 -0
- data/lib/mundi_api/http/faraday_client.rb +55 -0
- data/lib/mundi_api/http/http_call_back.rb +22 -0
- data/lib/mundi_api/http/http_client.rb +92 -0
- data/lib/mundi_api/http/http_context.rb +18 -0
- data/lib/mundi_api/http/http_method_enum.rb +11 -0
- data/lib/mundi_api/http/http_request.rb +48 -0
- data/lib/mundi_api/http/http_response.rb +21 -0
- data/lib/mundi_api/models/base_model.rb +34 -0
- data/lib/mundi_api/models/create_access_token_request.rb +35 -0
- data/lib/mundi_api/models/create_address_request.rb +108 -0
- data/lib/mundi_api/models/create_bank_transfer_payment_request.rb +44 -0
- data/lib/mundi_api/models/create_boleto_payment_request.rb +83 -0
- data/lib/mundi_api/models/create_cancel_charge_request.rb +35 -0
- data/lib/mundi_api/models/create_cancel_subscription_request.rb +35 -0
- data/lib/mundi_api/models/create_capture_charge_request.rb +45 -0
- data/lib/mundi_api/models/create_card_options_request.rb +36 -0
- data/lib/mundi_api/models/create_card_request.rb +136 -0
- data/lib/mundi_api/models/create_card_token_request.rb +80 -0
- data/lib/mundi_api/models/create_charge_request.rb +92 -0
- data/lib/mundi_api/models/create_checkout_boleto_payment_request.rb +54 -0
- data/lib/mundi_api/models/create_checkout_card_installment_option_request.rb +44 -0
- data/lib/mundi_api/models/create_checkout_card_payment_request.rb +51 -0
- data/lib/mundi_api/models/create_checkout_payment_request.rb +82 -0
- data/lib/mundi_api/models/create_credit_card_payment_request.rb +108 -0
- data/lib/mundi_api/models/create_customer_request.rb +108 -0
- data/lib/mundi_api/models/create_discount_request.rb +62 -0
- data/lib/mundi_api/models/create_order_item_request.rb +71 -0
- data/lib/mundi_api/models/create_order_request.rb +114 -0
- data/lib/mundi_api/models/create_payment_request.rb +121 -0
- data/lib/mundi_api/models/create_phone_request.rb +53 -0
- data/lib/mundi_api/models/create_phones_request.rb +46 -0
- data/lib/mundi_api/models/create_plan_item_request.rb +81 -0
- data/lib/mundi_api/models/create_plan_request.rb +199 -0
- data/lib/mundi_api/models/create_price_bracket_request.rb +62 -0
- data/lib/mundi_api/models/create_pricing_scheme_request.rb +69 -0
- data/lib/mundi_api/models/create_seller_request.rb +90 -0
- data/lib/mundi_api/models/create_setup_request.rb +55 -0
- data/lib/mundi_api/models/create_shipping_request.rb +81 -0
- data/lib/mundi_api/models/create_subscription_item_request.rb +106 -0
- data/lib/mundi_api/models/create_subscription_request.rb +269 -0
- data/lib/mundi_api/models/create_token_request.rb +44 -0
- data/lib/mundi_api/models/create_usage_request.rb +54 -0
- data/lib/mundi_api/models/create_voucher_payment_request.rb +72 -0
- data/lib/mundi_api/models/get_access_token_response.rb +73 -0
- data/lib/mundi_api/models/get_address_response.rb +163 -0
- data/lib/mundi_api/models/get_bank_transfer_transaction_response.rb +118 -0
- data/lib/mundi_api/models/get_billing_address_response.rb +98 -0
- data/lib/mundi_api/models/get_boleto_transaction_response.rb +137 -0
- data/lib/mundi_api/models/get_card_response.rb +164 -0
- data/lib/mundi_api/models/get_card_token_response.rb +89 -0
- data/lib/mundi_api/models/get_charge_response.rb +184 -0
- data/lib/mundi_api/models/get_checkout_payment_settings_response.rb +99 -0
- data/lib/mundi_api/models/get_credit_card_transaction_response.rb +163 -0
- data/lib/mundi_api/models/get_customer_response.rb +145 -0
- data/lib/mundi_api/models/get_discount_response.rb +100 -0
- data/lib/mundi_api/models/get_invoice_item_response.rb +73 -0
- data/lib/mundi_api/models/get_invoice_response.rb +210 -0
- data/lib/mundi_api/models/get_order_item_response.rb +63 -0
- data/lib/mundi_api/models/get_order_response.rb +167 -0
- data/lib/mundi_api/models/get_period_response.rb +73 -0
- data/lib/mundi_api/models/get_phone_response.rb +53 -0
- data/lib/mundi_api/models/get_phones_response.rb +46 -0
- data/lib/mundi_api/models/get_plan_item_response.rb +127 -0
- data/lib/mundi_api/models/get_plan_response.rb +223 -0
- data/lib/mundi_api/models/get_price_bracket_response.rb +62 -0
- data/lib/mundi_api/models/get_pricing_scheme_response.rb +69 -0
- data/lib/mundi_api/models/get_safety_pay_transaction_response.rb +109 -0
- data/lib/mundi_api/models/get_seller_response.rb +126 -0
- data/lib/mundi_api/models/get_setup_response.rb +62 -0
- data/lib/mundi_api/models/get_shipping_response.rb +72 -0
- data/lib/mundi_api/models/get_subscription_item_response.rb +135 -0
- data/lib/mundi_api/models/get_subscription_response.rb +261 -0
- data/lib/mundi_api/models/get_token_response.rb +72 -0
- data/lib/mundi_api/models/get_transaction_response.rb +136 -0
- data/lib/mundi_api/models/get_usage_response.rb +82 -0
- data/lib/mundi_api/models/get_voucher_transaction_response.rb +163 -0
- data/lib/mundi_api/models/list_access_tokens_response.rb +51 -0
- data/lib/mundi_api/models/list_addresses_response.rb +51 -0
- data/lib/mundi_api/models/list_cards_response.rb +51 -0
- data/lib/mundi_api/models/list_charges_response.rb +51 -0
- data/lib/mundi_api/models/list_customers_response.rb +51 -0
- data/lib/mundi_api/models/list_invoices_response.rb +51 -0
- data/lib/mundi_api/models/list_order_response.rb +51 -0
- data/lib/mundi_api/models/list_plans_response.rb +51 -0
- data/lib/mundi_api/models/list_subscription_items_response.rb +51 -0
- data/lib/mundi_api/models/list_subscriptions_response.rb +51 -0
- data/lib/mundi_api/models/list_transactions_response.rb +51 -0
- data/lib/mundi_api/models/list_usages_response.rb +51 -0
- data/lib/mundi_api/models/paging_response.rb +53 -0
- data/lib/mundi_api/models/update_address_request.rb +53 -0
- data/lib/mundi_api/models/update_card_request.rb +81 -0
- data/lib/mundi_api/models/update_charge_card_request.rb +62 -0
- data/lib/mundi_api/models/update_charge_due_date_request.rb +36 -0
- data/lib/mundi_api/models/update_charge_payment_method_request.rb +74 -0
- data/lib/mundi_api/models/update_customer_request.rb +90 -0
- data/lib/mundi_api/models/update_metadata_request.rb +35 -0
- data/lib/mundi_api/models/update_plan_item_request.rb +81 -0
- data/lib/mundi_api/models/update_plan_request.rb +161 -0
- data/lib/mundi_api/models/update_price_bracket_request.rb +62 -0
- data/lib/mundi_api/models/update_pricing_scheme_request.rb +69 -0
- data/lib/mundi_api/models/update_subscription_billing_date_request.rb +37 -0
- data/lib/mundi_api/models/update_subscription_card_request.rb +44 -0
- data/lib/mundi_api/models/update_subscription_item_request.rb +81 -0
- data/lib/mundi_api/models/update_subscription_payment_method_request.rb +53 -0
- data/lib/mundi_api/mundi_api_client.rb +63 -0
- metadata +246 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# TokensController
|
6
|
+
class TokensController < BaseController
|
7
|
+
@instance = TokensController.new
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_accessor :instance
|
11
|
+
end
|
12
|
+
|
13
|
+
def instance
|
14
|
+
self.class.instance
|
15
|
+
end
|
16
|
+
|
17
|
+
# Gets a token from its id
|
18
|
+
# @param [String] id Required parameter: Token id
|
19
|
+
# @param [String] public_key Required parameter: Public key
|
20
|
+
# @return GetTokenResponse response from the API call
|
21
|
+
def get_token(id,
|
22
|
+
public_key)
|
23
|
+
# Prepare query url.
|
24
|
+
_query_builder = Configuration.base_uri.dup
|
25
|
+
_query_builder << '/tokens/{id}?appId={public_key}'
|
26
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
27
|
+
_query_builder,
|
28
|
+
'id' => id,
|
29
|
+
'public_key' => public_key
|
30
|
+
)
|
31
|
+
_query_url = APIHelper.clean_url _query_builder
|
32
|
+
|
33
|
+
# Prepare headers.
|
34
|
+
_headers = {
|
35
|
+
'accept' => 'application/json'
|
36
|
+
}
|
37
|
+
|
38
|
+
# Prepare and execute HttpRequest.
|
39
|
+
_request = @http_client.get(
|
40
|
+
_query_url,
|
41
|
+
headers: _headers
|
42
|
+
)
|
43
|
+
_context = execute_request(_request)
|
44
|
+
validate_response(_context)
|
45
|
+
|
46
|
+
# Return appropriate response type.
|
47
|
+
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
48
|
+
GetTokenResponse.from_hash(decoded)
|
49
|
+
end
|
50
|
+
|
51
|
+
# TODO: type endpoint description here
|
52
|
+
# @param [String] public_key Required parameter: Public key
|
53
|
+
# @param [CreateTokenRequest] request Required parameter: Request for
|
54
|
+
# creating a token
|
55
|
+
# @return GetTokenResponse response from the API call
|
56
|
+
def create_token(public_key,
|
57
|
+
request)
|
58
|
+
# Prepare query url.
|
59
|
+
_query_builder = Configuration.base_uri.dup
|
60
|
+
_query_builder << '/tokens?appId={public_key}'
|
61
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
62
|
+
_query_builder,
|
63
|
+
'public_key' => public_key
|
64
|
+
)
|
65
|
+
_query_url = APIHelper.clean_url _query_builder
|
66
|
+
|
67
|
+
# Prepare headers.
|
68
|
+
_headers = {
|
69
|
+
'accept' => 'application/json',
|
70
|
+
'content-type' => 'application/json; charset=utf-8'
|
71
|
+
}
|
72
|
+
|
73
|
+
# Prepare and execute HttpRequest.
|
74
|
+
_request = @http_client.post(
|
75
|
+
_query_url,
|
76
|
+
headers: _headers,
|
77
|
+
parameters: request.to_json
|
78
|
+
)
|
79
|
+
_context = execute_request(_request)
|
80
|
+
validate_response(_context)
|
81
|
+
|
82
|
+
# Return appropriate response type.
|
83
|
+
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
84
|
+
GetTokenResponse.from_hash(decoded)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
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,37 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# Api Error Exception
|
6
|
+
class ErrorException < 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 [Object]
|
13
|
+
attr_accessor :errors
|
14
|
+
|
15
|
+
# TODO: Write general description for this method
|
16
|
+
# @return [Object]
|
17
|
+
attr_accessor :request
|
18
|
+
|
19
|
+
# The constructor.
|
20
|
+
# @param [String] The reason for raising an exception.
|
21
|
+
# @param [HttpContext] The HttpContext of the API call.
|
22
|
+
def initialize(reason, context)
|
23
|
+
super(reason, context)
|
24
|
+
hash = APIHelper.json_deserialize(@context.response.raw_body)
|
25
|
+
unbox(hash)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Populates this object by extracting properties from a hash.
|
29
|
+
# @param [Hash] The deserialized response sent by the server in the
|
30
|
+
# response body.
|
31
|
+
def unbox(hash)
|
32
|
+
@message = hash['message']
|
33
|
+
@errors = hash['errors']
|
34
|
+
@request = hash['request']
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
require 'base64'
|
5
|
+
|
6
|
+
module MundiApi
|
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 by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
require 'faraday/http_cache'
|
4
|
+
|
5
|
+
module MundiApi
|
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 by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
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
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# An interface for the methods that an HTTP Client must implement.
|
6
|
+
#
|
7
|
+
# This class should not be instantiated but should be used as a base class
|
8
|
+
# for HTTP Client classes.
|
9
|
+
class HttpClient
|
10
|
+
# Execute an HttpRequest when the response is expected to be a string.
|
11
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
12
|
+
def execute_as_string(_http_request)
|
13
|
+
raise NotImplementedError, 'This method needs
|
14
|
+
to be implemented in a child class.'
|
15
|
+
end
|
16
|
+
|
17
|
+
# Execute an HttpRequest when the response is expected to be binary.
|
18
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
19
|
+
def execute_as_binary(_http_request)
|
20
|
+
raise NotImplementedError, 'This method needs
|
21
|
+
to be implemented in a child class.'
|
22
|
+
end
|
23
|
+
|
24
|
+
# Converts the HTTP Response from the client to an HttpResponse object.
|
25
|
+
# @param [Dynamic] The response object received from the client.
|
26
|
+
def convert_response(_response)
|
27
|
+
raise NotImplementedError, 'This method needs
|
28
|
+
to be implemented in a child class.'
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get a GET HttpRequest object.
|
32
|
+
# @param [String] The URL to send the request to.
|
33
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
34
|
+
def get(query_url,
|
35
|
+
headers: {})
|
36
|
+
HttpRequest.new(HttpMethodEnum::GET,
|
37
|
+
query_url,
|
38
|
+
headers: headers)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get a POST HttpRequest object.
|
42
|
+
# @param [String] The URL to send the request to.
|
43
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
44
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
45
|
+
def post(query_url,
|
46
|
+
headers: {},
|
47
|
+
parameters: {})
|
48
|
+
HttpRequest.new(HttpMethodEnum::POST,
|
49
|
+
query_url,
|
50
|
+
headers: headers,
|
51
|
+
parameters: parameters)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Get a PUT HttpRequest object.
|
55
|
+
# @param [String] The URL to send the request to.
|
56
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
57
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
58
|
+
def put(query_url,
|
59
|
+
headers: {},
|
60
|
+
parameters: {})
|
61
|
+
HttpRequest.new(HttpMethodEnum::PUT,
|
62
|
+
query_url,
|
63
|
+
headers: headers,
|
64
|
+
parameters: parameters)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Get a PATCH HttpRequest object.
|
68
|
+
# @param [String] The URL to send the request to.
|
69
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
70
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
71
|
+
def patch(query_url,
|
72
|
+
headers: {},
|
73
|
+
parameters: {})
|
74
|
+
HttpRequest.new(HttpMethodEnum::PATCH,
|
75
|
+
query_url,
|
76
|
+
headers: headers,
|
77
|
+
parameters: parameters)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Get a DELETE HttpRequest object.
|
81
|
+
# @param [String] The URL to send the request to.
|
82
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
83
|
+
def delete(query_url,
|
84
|
+
headers: {},
|
85
|
+
parameters: {})
|
86
|
+
HttpRequest.new(HttpMethodEnum::DELETE,
|
87
|
+
query_url,
|
88
|
+
headers: headers,
|
89
|
+
parameters: parameters)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# Represents an Http call in context.
|
6
|
+
class HttpContext
|
7
|
+
attr_accessor :request, :response
|
8
|
+
|
9
|
+
# The constructor.
|
10
|
+
# @param [HttpRequest] An HttpRequest object representing the HTTP request.
|
11
|
+
# @param [HttpResponse] An HttpResponse object representing the HTTP
|
12
|
+
# response.
|
13
|
+
def initialize(request, response)
|
14
|
+
@request = request
|
15
|
+
@response = response
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# HTTP Methods Enumeration.
|
6
|
+
class HttpMethodEnum
|
7
|
+
HTTPMETHODENUM = [GET = 'GET'.freeze, POST = 'POST'.freeze,
|
8
|
+
PUT = 'PUT'.freeze, PATCH = 'PATCH'.freeze,
|
9
|
+
DELETE = 'DELETE'.freeze].freeze
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
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 by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
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
|