dev

New Version of the Object Mapper v1.0.6 Has Been Released

A new version Object Mapper for Python has been released.object_mapper_logo

 

Get it on Pypi via

pip install object-mapper

Now it supports possibility to specify list of fields that should be excluded from the mapping, i.e.:

result = mapper.map(FromTestClass(), ToTestClass, excluded=['date'])

will map fromTestClass to ToTestClass except property date in source class.

 

You can clone it from GitHub too. Enjoy!

Advertisements
dev

New Version of the GPWebpayNet v1.3.3 Has Been Released

logoA new version of the GPWebpayNet v1.3.3 has been released. It contains following changes regarding to version v1.2.0.:

v1.3.0

Possibility to set X509KeyStorageFlags arguments to be able to change them while creating X509Certificate2 instance. The change is not a breaking one because arguments are optional. For more details check IClientService.PostRequestAsyncIClientService.GenerateGPWebPayRedirectUrl.

v1.3.1

This version update data type of property PaymentRequest.Amount from decimal to int. This decision was make to because specification does not require a concrete type, just an amount in cents, i.e. value $4.99 will be converted to 499. The next reason is to prevent misunderstanding of users, which happened twice.

v1.3.2

Properties PaymentRequest.Description and PaymentRequest.MD are validated to fulfill specification requirements – an ASCII string with maximal length 255 characters. If such conditions are not satisfied, an exception InvalidPaymentRequestDataException is raised in PaymentRequestTransformer.GetParametersForDigestCalculation during request object transformation.

v1.3.3

To have better overview of validation errors on GP server returned in properties PaymentResponse.PRCode and PaymentResponse.SRCode, a better error description is provided, while a PaymentResponseException is raised in ClientService.ProcessGPWebPayResponse. Exception message contains returned codes with particular description from official documentation. This feature was added because of SDK users for easier debugging.

Install it from NuGet via

Install-Package GPWebpayNet.Sdk -Version 1.3.3

Clone it on GitHub here.

Enjoy!

 

dev

Strava Upload – A Library For Synchronization of Strava Activities and Other Services (Suunto Movescount, etc.)

Overview

Strava Upload is s simple library that  synchronizes moves (activities) with Strava. In the first version it supports moves from Suunto Movescount (a generic move/activity class is planned to support other services). If the activity is found on Strava, it tries to update its description. If not, a new activity is being created.

Library Description

The library is written in .NetCore (.Net Standard 2.0). The code is available  GitHub and you can find it in NuGet too.

PM > Install-Package StravaUpload

It consists of the following projects:

StravaUpload.Lib

The main project with the following important classes.

Uploader.cs

The main class for uploading. Nothing complicated :).

StravaUpload.StravaUploadFunction

Azure function that periodically downloads data from Suunto Movescount, store them in Azure Blob Storage and synchronize them with Strava periodically.

StravaUpload.Console

Just a test project for the library created before Azure function project.

Requirements

To be able to connect to Movescount API, you have to have following keys that are required to be able to get data:

  • MovescountAppKey – App key to be able to query Movescount API.
  • MovescountUserKey – User key to be able to query Movescount API.
  • MovescountUserEmail – User email to be able to query Movescount API.
  • MovescountMemberName – Name of the member whose data we want to get.
  • CookieValue – A cookie value that is needed to export GPX, TCX and other move files. This value can be get by the following steps:
    1. Open console in your browser to se network requests.
    2. Login into Movescount.
    3. Select a request to http://www.movescount.com/api/members/private/messages.
    4. Copy value of Cookie key in request header. It should start with ASP.NET ….

Other Configuration for Strava and Azure function:

  • BackupDir – Backup directory. Used as a root directory in Azure Blob Storage.
  • StorageConnectionString – Connection string to Azure Blob Storage.
  • ContainerName – Name of the Azure Blob Storage container.
  • StravaAccessToken – Readwrite access token to Strava.
  • SendGridApiKey – ApiKey to Sendgrid for email notification (optional).
  • EmailFrom – Sender email address (optional).
  • EmailTo – Recipient email address (optional).

Deployment

Just deploy StravaUpload.StravaUploadFunction to Azure and set required configuration. Thats all :).

Contributing

Contributing is welcomed.

dev

Movescount Backup – A Library For Full Backup of Moves From Suunto Movescount

Overview

Movescount Backup is s simple library that can download move records from Suunto Movescount. I created is just because there is no official way how to create a backup of all your moves and a optional possibility yo migrate them to other service such as Garmin or Strava.

With this library you can periodically call it and download all data about move that is available on Movescount – description, details, GPS data, media files, etc. Next you can you these downloaded data and upload them to other services. In my case I’m using these data to update activities on Strava. Because move -> activity synchronization between these services does not copy all data. And manual update is boring and time consuming.

Library Description

The library is written in .NetCore (.Net Standard 2.0). The code is available  GitHub and you can find it in NuGet too.

PM > Install-Package MovescountBackup

 

It consists of the following projects:

MovescountBackup.Lib

The main project with the following important classes.

Client.cs

Client is the class responsible for downloading data from Movescount. Because there is only need to get list of moves and one particular move with details, there are no other calls, such as crate new move, update move, etc. But, it can be extended to a full Movescount API client. The only problem is that the API spec is not public, so some inspection is required (e.g., searching on GitHub).

Downloader.cs

A class that uses Client to download single or multiple moves and store them to local disk (FileSystemStorage) or Azure Blob Store (CloudStorage). A sample Downloader usage can be found on GitHub.

Requirements

To be able to connect to Movescount API, you have to have following keys that are required to be able to get data:

  • MovescountAppKey – App key to be able to query Movescount API.
  • MovescountUserKey – User key to be able to query Movescount API.
  • MovescountUserEmail – User email to be able to query Movescount API.
  • MovescountMemberName – Name of the member whose data we want to get.
  • CookieValue – A cookie value that is needed to export GPX, TCX and other move files. This value can be get by the following steps:
    1. Open console in your browser to se network requests.
    2. Login into Movescount.
    3. Select a request to http://www.movescount.com/api/members/private/messages.
    4. Copy value of Cookie key in request header. It should start with ASP.NET ….

Deployment

You can use this lib to be run manually (MovescountBackup.Console.Program.cs) or you can create, e.g., a Azure function Lambda function on AWS, that can run periodically, as described in overview. As mentioned before, it is available in NuGet.

Contributing

Contributing is welcomed. The Client implements just two calls to Movescount API because it is enough for the backup. But implementation of the full API can be useful in other cases. So if you want such ability, feel free to extend the Client class.