Skip to content

Commit

Permalink
Merge pull request #60 from voucherifyio/v5.0.0
Browse files Browse the repository at this point in the history
V5.0.0
  • Loading branch information
marcin-slezak authored May 7, 2024
2 parents 2ed1cc2 + 1a9879f commit 6e9e4e7
Show file tree
Hide file tree
Showing 1,453 changed files with 216,582 additions and 4,057 deletions.
49 changes: 49 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by: https://openapi-generator.tech
#

*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

## Specific to RubyMotion:
.dat*
.repl_history
build/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc


/.openapi-generator/
/spec/
/.gitlab-ci.yml
/.openapi-generator-ignore
/.travis.yml
/git_push.sh
/test-requirements.txt
/.idea/
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VOUCHERIFY_HOST=https://api.voucherify.io
X_APP_ID=
X_APP_TOKEN=
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve
title: '[BUG] '
labels: bug
assignees: ''

---

**Note** Please remember that this repository is primarily for reporting bugs related to the Ruby SDK.
If you encounter bugs within the product or its documentation,
please consider reporting them to [our support team](https://www.voucherify.io/contact-support)

**Describe the bug**
A clear and concise description of what the bug is.

**Steps To Reproduce**
List of steps to reproduce the bug:
1.
2.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish SDK

on:
push:
tags:
- v*

jobs:
publish:
environment: prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7

- name: Install dependencies
run: bundle install

- name: Build GEM
run: gem build *.gemspec

- name: Push GEM
run: gem push *.gem --debug
env:
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test Workflow

on:
pull_request:

jobs:
build-and-test:
runs-on: ubuntu-latest
environment: dev

steps:
- uses: actions/checkout@v2

- name: Build Docker image
run: docker build -t ruby .

- name: Run tests using Docker
run: |
docker run \
-e VOUCHERIFY_HOST=${{ vars.VOUCHERIFY_HOST }} \
-e X_APP_ID=${{ secrets.X_APP_ID }} \
-e X_APP_TOKEN=${{ secrets.X_APP_TOKEN }} \
ruby
19 changes: 13 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Generated by: https://openapi-generator.tech
#

*.gem
*.rbc
/.config
Expand Down Expand Up @@ -28,16 +31,20 @@ build/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset
Gemfile.lock

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Jetbrains temp
.idea
*.iml

.ruby-version
.vscode/
/.openapi-generator/
/spec/
/.gitlab-ci.yml
/.openapi-generator-ignore
/.travis.yml
/git_push.sh
/test-requirements.txt
/.env
/.idea/
2 changes: 1 addition & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--color
--format documentation
--require spec_helper
148 changes: 148 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license)
# Automatically generated by OpenAPI Generator (https://openapi-generator.tech)
AllCops:
TargetRubyVersion: 2.4
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
Exclude:
- '**/templates/**/*'
- '**/vendor/**/*'
- 'actionpack/lib/action_dispatch/journey/parser.rb'

# Prefer &&/|| over and/or.
Style/AndOr:
Enabled: true

# Align `when` with `case`.
Layout/CaseIndentation:
Enabled: true

# Align comments with method definitions.
Layout/CommentIndentation:
Enabled: true

Layout/ElseAlignment:
Enabled: true

Layout/EmptyLineAfterMagicComment:
Enabled: true

# In a regular class definition, no empty lines around the body.
Layout/EmptyLinesAroundClassBody:
Enabled: true

# In a regular method definition, no empty lines around the body.
Layout/EmptyLinesAroundMethodBody:
Enabled: true

# In a regular module definition, no empty lines around the body.
Layout/EmptyLinesAroundModuleBody:
Enabled: true

Layout/FirstArgumentIndentation:
Enabled: true

# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
Style/HashSyntax:
Enabled: false

# Method definitions after `private` or `protected` isolated calls need one
# extra level of indentation.
Layout/IndentationConsistency:
Enabled: true
EnforcedStyle: indented_internal_methods

# Two spaces, no tabs (for indentation).
Layout/IndentationWidth:
Enabled: true

Layout/LeadingCommentSpace:
Enabled: true

Layout/SpaceAfterColon:
Enabled: true

Layout/SpaceAfterComma:
Enabled: true

Layout/SpaceAroundEqualsInParameterDefault:
Enabled: true

Layout/SpaceAroundKeyword:
Enabled: true

Layout/SpaceAroundOperators:
Enabled: true

Layout/SpaceBeforeComma:
Enabled: true

Layout/SpaceBeforeFirstArg:
Enabled: true

Style/DefWithParentheses:
Enabled: true

# Defining a method with parameters needs parentheses.
Style/MethodDefParentheses:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: false
EnforcedStyle: always

# Use `foo {}` not `foo{}`.
Layout/SpaceBeforeBlockBraces:
Enabled: true

# Use `foo { bar }` not `foo {bar}`.
Layout/SpaceInsideBlockBraces:
Enabled: true

# Use `{ a: 1 }` not `{a:1}`.
Layout/SpaceInsideHashLiteralBraces:
Enabled: true

Layout/SpaceInsideParens:
Enabled: true

# Check quotes usage according to lint rule below.
#Style/StringLiterals:
# Enabled: true
# EnforcedStyle: single_quotes

# Detect hard tabs, no hard tabs.
Layout/IndentationStyle:
Enabled: true

# Blank lines should not have any spaces.
Layout/TrailingEmptyLines:
Enabled: true

# No trailing whitespace.
Layout/TrailingWhitespace:
Enabled: false

# Use quotes for string literals when they are enough.
Style/RedundantPercentQ:
Enabled: true

# Align `end` with the matching keyword or starting expression except for
# assignments, where it should be aligned with the LHS.
Layout/EndAlignment:
Enabled: true
EnforcedStyleAlignWith: variable
AutoCorrect: true

# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
Lint/RequireParentheses:
Enabled: true

Style/RedundantReturn:
Enabled: true
AllowMultipleReturnValues: true

Style/Semicolon:
Enabled: true
AllowAsExpressionSeparator: true
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- **2022-01-18** - `4.1.0` - Async Actions support.
- **2021-06-14** - `4.0.0` - Bumped required ruby version, bumped dependencies, added `Consents` API support, remove deprecated `URI.escape`.
- **2020-03-09** - `3.0.0` - Bumped required ruby version, bumped dependencies, added `list` method in Customers module.
- **2019-06-19** - `2.4.0` - Added support for custom API endpoint, that allows to connect to projects created in specific Voucherify region.
- **2019-05-09** - `2.3.0` - Added `create_publication` method in Distributions module.
- **2019-04-23** - `2.2.0` - Loyalties API, Rewards API, Orders API.
- **2019-02-19** - `2.1.1` - Treat `referral` as optional in custom events. Added new method for custom event tracking.
- **2019-02-19** - `2.1.0` - Handle `referral` in custom events tracking.
- **2018-12-27** - `2.0.0` - Business validation rules.
- **2018-09-05** - `1.6.1` - Request timeout settings
- **2017-11-16** - `1.6.0` - Expose promotion API, Redemptions and Validations namespace update
- **2017-11-16** - `1.5.0` - Expose events API
- **2017-05-07** - `1.4.0` - Segments, Validation rules, API Versioning
- **2017-03-22** - `1.3.0` - improved error handling
- **2017-01-04** - `1.2.0` - added [import vouchers](#import-vouchers) method.
- **2016-12-29** - `1.1.0` - introduced [campaigns api](#campaigns-api) and [products api](#products-api).
- **2016-12-15** - `1.0.0` - introduced namespaces, unified method names, updated README. Migration from versions 0.x required [migration from version 0.x](#migration-from-0x)
- **2016-12-02** - `0.8.2` - support gift vouchers in utils, fix price and discount calculations for amount discounts
- **2016-10-03** - `0.8.1` - publish update
- **2016-08-02** - `0.8.0` - validate voucher
- **2016-07-18** - `0.7.0` - voucher udpate
- **2016-07-05** - `0.6.0` - new utils module
- **2016-06-16** - `0.5.0` - unified naming convention
- **2016-06-12** - `0.4.0` - new customer sdk methods
- **2016-05-24** - `0.3.0` - new publish structure
- **2016-04-27** - `0.2.0` - rollback redemption
- **2016-04-13** - `0.1.3` - bugfix in redeem()
- **2016-04-13** - `0.1.2` - removed dependency to `pry`
- **2016-04-12** - `0.1.1` - minor gemspec changes
- **2016-04-12** - `0.1.0` - First version:
- Authentication
- Voucher information: *retrieve voucher*, *list vouchers*, *retrieve redemptions*, *list redemptions*
- Voucher operations: *redeem voucher*, *publish voucher*, *create voucher*, *enable/disable voucher*
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ruby:3.3

WORKDIR /app

COPY . .

RUN gem build VoucherifySdk.gemspec
RUN gem install voucherify-5.0.0.gem
RUN gem install dotenv
RUN gem install rspec

WORKDIR /app/__tests__

CMD ["rspec", "./spec"]
Loading

0 comments on commit 6e9e4e7

Please sign in to comment.