Skip to content

Commit

Permalink
2.4.5 (#74)
Browse files Browse the repository at this point in the history
Co-authored-by: Unknown <[email protected]>
  • Loading branch information
magnomoreira and samuelleitemundipagg authored Jun 19, 2023
1 parent 433541c commit f5ae6e4
Show file tree
Hide file tree
Showing 15 changed files with 233 additions and 101 deletions.
99 changes: 51 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ This client library is a Ruby gem which can be compiled and used in your Ruby an

1. Open the command line interface or the terminal and navigate to the folder containing the source code.
2. Run ``` gem build mundi_api.gemspec ``` to build the gem.
3. Once built, the gem can be installed on the current work environment using ``` gem install mundi_api-2.4.4.gem ```
3. Once built, the gem can be installed on the current work environment using ``` gem install mundi_api-2.4.5.gem ```

![Building Gem](https://apidocs.io/illustration/ruby?step=buildSDK&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiAPI-Ruby&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4)
![Building Gem](https://apidocs.io/illustration/ruby?step=buildSDK&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiAPI-Ruby&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5)

## How to Use

Expand All @@ -20,41 +20,41 @@ The following section explains how to use the MundiApi Ruby Gem in a new Rails p

Close any existing projects in RubyMine&trade; by selecting ``` File -> Close Project ```. Next, click on ``` Create New Project ``` to create a new project from scratch.

![Create a new project in RubyMine](https://apidocs.io/illustration/ruby?step=createNewProject0&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4)
![Create a new project in RubyMine](https://apidocs.io/illustration/ruby?step=createNewProject0&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5)

Next, provide ``` TestApp ``` as the project name, choose ``` Rails Application ``` as the project type, and click ``` OK ```.

![Create a new Rails Application in RubyMine - step 1](https://apidocs.io/illustration/ruby?step=createNewProject1&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4)
![Create a new Rails Application in RubyMine - step 1](https://apidocs.io/illustration/ruby?step=createNewProject1&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5)

In the next dialog make sure that correct *Ruby SDK* is being used (minimum 2.0.0) and click ``` OK ```.

![Create a new Rails Application in RubyMine - step 2](https://apidocs.io/illustration/ruby?step=createNewProject2&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4)
![Create a new Rails Application in RubyMine - step 2](https://apidocs.io/illustration/ruby?step=createNewProject2&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5)

This will create a new Rails Application project with an existing set of files and folder.

### 2. Add reference of the gem

In order to use the MundiApi gem in the new project we must add a gem reference. Locate the ```Gemfile``` in the *Project Explorer* window under the ``` TestApp ``` project node. The file contains references to all gems being used in the project. Here, add the reference to the library gem by adding the following line: ``` gem 'mundi_api', '~> 2.4.4' ```
In order to use the MundiApi gem in the new project we must add a gem reference. Locate the ```Gemfile``` in the *Project Explorer* window under the ``` TestApp ``` project node. The file contains references to all gems being used in the project. Here, add the reference to the library gem by adding the following line: ``` gem 'mundi_api', '~> 2.4.5' ```

![Add references of the Gemfile](https://apidocs.io/illustration/ruby?step=addReference&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4)
![Add references of the Gemfile](https://apidocs.io/illustration/ruby?step=addReference&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5)

### 3. Adding a new Rails Controller

Once the ``` TestApp ``` project is created, a folder named ``` controllers ``` will be visible in the *Project Explorer* under the following path: ``` TestApp > app > controllers ```. Right click on this folder and select ``` New -> Run Rails Generator... ```.

![Run Rails Generator on Controllers Folder](https://apidocs.io/illustration/ruby?step=addCode0&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4)
![Run Rails Generator on Controllers Folder](https://apidocs.io/illustration/ruby?step=addCode0&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5)

Selecting the said option will popup a small window where the generator names are displayed. Here, select the ``` controller ``` template.

![Create a new Controller](https://apidocs.io/illustration/ruby?step=addCode1&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4)
![Create a new Controller](https://apidocs.io/illustration/ruby?step=addCode1&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5)

Next, a popup window will ask you for a Controller name and included Actions. For controller name provide ``` Hello ``` and include an action named ``` Index ``` and click ``` OK ```.

![Add a new Controller](https://apidocs.io/illustration/ruby?step=addCode2&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4)
![Add a new Controller](https://apidocs.io/illustration/ruby?step=addCode2&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5)

A new controller class anmed ``` HelloController ``` will be created in a file named ``` hello_controller.rb ``` containing a method named ``` Index ```. In this method, add code for initialization and a sample for its usage.

![Initialize the library](https://apidocs.io/illustration/ruby?step=addCode3&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4)
![Initialize the library](https://apidocs.io/illustration/ruby?step=addCode3&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5)

## How to Test

Expand All @@ -71,6 +71,7 @@ In order to setup authentication and initialization of the API client, you need

| Parameter | Description |
|-----------|-------------|
| service_referer_name | TODO: add a description |
| basic_auth_user_name | The username to use with basic authentication |
| basic_auth_password | The password to use with basic authentication |

Expand All @@ -80,18 +81,20 @@ API client can be initialized as following.

```ruby
# Configuration parameters and credentials
service_referer_name = 'service_referer_name'
basic_auth_user_name = 'basic_auth_user_name' # The username to use with basic authentication
basic_auth_password = 'basic_auth_password' # The password to use with basic authentication

client = MundiApi::MundiApiClient.new(
service_referer_name: service_referer_name,
basic_auth_user_name: basic_auth_user_name,
basic_auth_password: basic_auth_password
)
```

The added initlization code can be debugged by putting a breakpoint in the ``` Index ``` method and running the project in debug mode by selecting ``` Run -> Debug 'Development: TestApp' ```.

![Debug the TestApp](https://apidocs.io/illustration/ruby?step=addCode4&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.4&initLine=client%2520%253D%2520MundiApiClient.new%2528%2527basic_auth_user_name%2527%252C%2520%2527basic_auth_password%2527%2529)
![Debug the TestApp](https://apidocs.io/illustration/ruby?step=addCode4&workspaceFolder=MundiAPI-Ruby&workspaceName=MundiApi&projectName=mundi_api&gemName=mundi_api&gemVer=2.4.5&initLine=client%2520%253D%2520MundiApiClient.new%2528%2527service_referer_name%2527%252C%2520%2527basic_auth_user_name%2527%252C%2520%2527basic_auth_password%2527%2529)



Expand Down Expand Up @@ -721,8 +724,8 @@ def get_subscriptions(page = nil,
#### Example Usage
```ruby
page = 244
size = 244
page = 143
size = 143
code = 'code'
billing_type = 'billing_type'
customer_id = 'customer_id'
Expand Down Expand Up @@ -782,8 +785,8 @@ def get_usages_details(subscription_id,
```ruby
subscription_id = 'subscription_id'
cycle_id = 'cycle_id'
size = 244
page = 244
size = 143
page = 143
item_id = 'item_id'
group = 'group'

Expand Down Expand Up @@ -968,8 +971,8 @@ def get_usages(subscription_id,
```ruby
subscription_id = 'subscription_id'
item_id = 'item_id'
page = 244
size = 244
page = 143
size = 143
code = 'code'
group = 'group'
used_since = DateTime.now
Expand Down Expand Up @@ -1060,8 +1063,8 @@ def get_increments(subscription_id,
```ruby
subscription_id = 'subscription_id'
page = 244
size = 244
page = 143
size = 143

result = subscriptions_controller.get_increments(subscription_id, page, size)

Expand Down Expand Up @@ -1160,8 +1163,8 @@ def get_subscription_items(subscription_id,
```ruby
subscription_id = 'subscription_id'
page = 244
size = 244
page = 143
size = 143
name = 'name'
code = 'code'
status = 'status'
Expand Down Expand Up @@ -1518,8 +1521,8 @@ def get_discounts(subscription_id,
```ruby
subscription_id = 'subscription_id'
page = 244
size = 244
page = 235
size = 235

result = subscriptions_controller.get_discounts(subscription_id, page, size)

Expand Down Expand Up @@ -1965,8 +1968,8 @@ def get_orders(page = nil,
#### Example Usage
```ruby
page = 81
size = 81
page = 235
size = 235
code = 'code'
status = 'status'
created_since = DateTime.now
Expand Down Expand Up @@ -2420,8 +2423,8 @@ def get_plans(page = nil,
#### Example Usage
```ruby
page = 81
size = 81
page = 235
size = 235
name = 'name'
status = 'status'
billing_type = 'billing_type'
Expand Down Expand Up @@ -2956,8 +2959,8 @@ def get_invoices(page = nil,
#### Example Usage
```ruby
page = 81
size = 81
page = 71
size = 71
code = 'code'
customer_id = 'customer_id'
subscription_id = 'subscription_id'
Expand Down Expand Up @@ -3065,8 +3068,8 @@ def get_access_tokens(customer_id,
```ruby
customer_id = 'customer_id'
page = 172
size = 172
page = 71
size = 71

result = customers_controller.get_access_tokens(customer_id, page, size)

Expand Down Expand Up @@ -3229,8 +3232,8 @@ def get_addresses(customer_id,
```ruby
customer_id = 'customer_id'
page = 172
size = 172
page = 71
size = 71

result = customers_controller.get_addresses(customer_id, page, size)

Expand Down Expand Up @@ -3578,8 +3581,8 @@ def get_cards(customer_id,
```ruby
customer_id = 'customer_id'
page = 172
size = 172
page = 71
size = 71

result = customers_controller.get_cards(customer_id, page, size)

Expand Down Expand Up @@ -4129,8 +4132,8 @@ def get_charges(page = nil,
#### Example Usage
```ruby
page = 130
size = 130
page = 71
size = 71
code = 'code'
status = 'status'
payment_method = 'payment_method'
Expand Down Expand Up @@ -4438,8 +4441,8 @@ def get_charge_transactions(charge_id,
```ruby
charge_id = 'charge_id'
page = 130
size = 130
page = 30
size = 30

result = charges_controller.get_charge_transactions(charge_id, page, size)

Expand Down Expand Up @@ -4664,8 +4667,8 @@ def get_recipients(page = nil,
#### Example Usage
```ruby
page = 130
size = 130
page = 30
size = 30

result = recipients_controller.get_recipients(page, size)

Expand Down Expand Up @@ -4799,8 +4802,8 @@ def get_anticipations(recipient_id,
```ruby
recipient_id = 'recipient_id'
page = 130
size = 130
page = 30
size = 30
status = 'status'
timeframe = 'timeframe'
payment_date_since = DateTime.now
Expand Down Expand Up @@ -5066,8 +5069,8 @@ def get_transfers(recipient_id,
```ruby
recipient_id = 'recipient_id'
page = 222
size = 222
page = 30
size = 30
status = 'status'
created_since = DateTime.now
created_until = DateTime.now
Expand Down Expand Up @@ -5248,8 +5251,8 @@ def get_withdrawals(recipient_id,
```ruby
recipient_id = 'recipient_id'
page = 222
size = 222
page = 30
size = 30
status = 'status'
created_since = DateTime.now
created_until = DateTime.now
Expand Down
3 changes: 3 additions & 0 deletions lib/mundi_api/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Configuration
# The base Uri for API calls
@base_uri = 'https://api.mundipagg.com/core/v1'

@service_referer_name = 'TODO: Replace'

# The username to use with basic authentication
@basic_auth_user_name = 'TODO: Replace'

Expand All @@ -21,6 +23,7 @@ class Configuration
class << self
attr_accessor :array_serialization
attr_accessor :base_uri
attr_accessor :service_referer_name
attr_accessor :basic_auth_user_name
attr_accessor :basic_auth_password
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mundi_api/controllers/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(http_client: nil, http_call_back: nil)
@http_call_back = http_call_back

@global_headers = {
'user-agent' => 'MundiSDK - Ruby 2.4.4'
'user-agent' => 'MundiSDK - Ruby 2.4.5'
}
end

Expand Down
Loading

0 comments on commit f5ae6e4

Please sign in to comment.