openapi_client

OpenapiClient - the Ruby gem for the Golden Service API

An API that conforms to the standards and best practices that should be adhered to in all Mastercard owned APIs. Can be used to create subscriptions to reports that are generated twice daily (6am & 6pm) that deliver e-commerce spending across multiple sectors and locations.


* All requests must be signed using oauth 1.0a. Please refer to: https://developer.mastercard.com/platform/documentation/using-oauth-1a-to-access-mastercard-apis/

  • The user must provide their card details when creating a subscription. These details must be encrypted before entering transit. Please refer to Mastercard security ---

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.1.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://developer.mastercard.com/

Installation

Build a gem

To build the Ruby code into a gem:

gem build openapi_client.gemspec

Then either install the gem locally:

gem install ./openapi_client-1.0.0.gem

(for development, run gem install --dev ./openapi_client-1.0.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'openapi_client', '~> 1.0.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'openapi_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'openapi_client'

api_instance = OpenapiClient::ReportsApi.new
date = Date.parse('29/02/2019') # Date | The date for the requested data
location = 'New York' # String | The location for which you wish to receive the top-sectors report.
spending_type = 'ATV' # String | Used to distinguish between gross spending (GS) & average transaction value (ATV)
opts = {
  sector: 0 # Integer | The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call
}

begin
  #Retrieves e-commerce spending for a particular location, sector and date range or single date
  result = api_instance.get_spending(date, location, spending_type, opts)
  p result
rescue OpenapiClient::ApiError => e
  puts "Exception when calling ReportsApi->get_spending: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://stage.api.mastercard.com/golden-service

Class Method HTTP request Description
OpenapiClient::ReportsApi get_spending GET /spending-reports Retrieves e-commerce spending for a particular location, sector and date range or single date
OpenapiClient::ReportsApi get_top_locations GET /top-locations Retrieves the top grossing locations for the specified date/sector/spending type
OpenapiClient::ReportsApi get_top_sectors GET /top-sectors Retrieves the top grossing sectors for the specified date & location
OpenapiClient::SectorApi get_sectors GET /sectors Returns the valid sectors which can be passed to various other endpoints in the sector field
OpenapiClient::SectorApi get_top_sectors GET /top-sectors Retrieves the top grossing sectors for the specified date & location
OpenapiClient::SubscribeApi get_subscription GET /subscriptions/subscription_id Gets a specific subscription using a subscription Id passed as in the path
OpenapiClient::SubscribeApi list_subscriptions GET /subscriptions gets all active subscriptions for a particular user. Returned list size can be limited using the limit parameter
OpenapiClient::SubscribeApi subscribe POST /subscriptions Allows the user to subscribe to a particular location and receive updates on e-commerce spending in their chosen area. The user can pay for the subscription on a daily basis. The user is charged for every report they receive until their subscription is cancelled
OpenapiClient::SubscribeApi unsubscribe DELETE /subscriptions Un-subscribes from a specified subcription
OpenapiClient::SubscribeApi update_subscription PUT /subscriptions Updates an active subscription

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.