affirm-ruby-api 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0df8ada7075ef3babd97d1c61ab3995f4a0a3de3c4ac11d5829ed59d5881105
4
- data.tar.gz: 8e1b68e21079f052125da6c5d668b06e8c616450181fb460990932fa60bab71a
3
+ metadata.gz: 76fe80cc1544c26c94e3bda13c840793345aff3bb26e59ab13c5d549a3fa45fa
4
+ data.tar.gz: 8510da3a8c4a55382d869486b976e2ea8a534a65052663427a00c6440d4473f2
5
5
  SHA512:
6
- metadata.gz: dfa097ad10c557a8a32644d0364d7337a9db4e9713cc4acadc2b6354007f5db3d07b089f396f62442b95b28fd4b634bdcce7c14b1ff2b13e4a2832cf177b510a
7
- data.tar.gz: 493edcb74fd37a736ec6ce4a9b4b1e392aa9191c6ca482735b8c64a94955613c0c9f810092b3dc0d0ae4756c535301450e4c5b48c031e3bca4b1555f46c45c2a
6
+ metadata.gz: 5cf6a35705ff3056ff2c1a17959be61c1052a50b2462183801ef09e1c35edb80617739b8ed717625e844e26eb4e105957f57e4dbea64eb425ba0a8ca572560a2
7
+ data.tar.gz: 7e2f0d5a70749accf09f4b38129515dfe48250f06e447739ab236c9de11e743c8d7db07e8433916d6fd0767dcc961782e34296dfb02dbace35ff027bd0a790d1
@@ -0,0 +1,5 @@
1
+ root: ./docs/
2
+
3
+ structure:
4
+ readme: README.md
5
+ summary: SUMMARY.md
@@ -0,0 +1 @@
1
+ github: peterberkenbosch
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ ---
5
+
6
+ # Bug Report
7
+
8
+ _Please help us help you by filling out any applicable information in this template and removing the rest!_
9
+
10
+ ## Describe the bug
11
+
12
+ A clear and concise description of what the bug is.
13
+
14
+ ## To Reproduce
15
+
16
+ Steps to reproduce the behavior
17
+
18
+ ## Expected behavior
19
+
20
+ A clear and concise description of what you expected to happen.
21
+
22
+ ## Screenshots or reproduction
23
+
24
+ If applicable, add screenshots (errors, example of the behavior, etc.) to help explain your problem or post a link to a repository that replicates the issue.
25
+
26
+ ## Versions
27
+
28
+ ### Affirm
29
+
30
+ - Gem: [e.g. 2.0.1]
31
+
32
+ ### External tools
33
+
34
+ - Ruby: [e.g. 2.6.4]
35
+ - Rails: [e.g. 6.0.0]
36
+ - Integration platform (Solidus, Spree etc) [e.g. Solidus master]
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ ---
5
+
6
+ # Feature Request
7
+
8
+ _Please help us help you by filling out any applicable information in this template and removing the rest!_
9
+
10
+ ## Is your feature request related to a problem?
11
+
12
+ A clear and concise description of what the problem is. If this is a bug, please open a bug report instead of a feature request!
13
+
14
+ ## Describe the solution you'd like
15
+
16
+ A clear and concise description of what you want to happen. Please also include alternative solutions or features you've considered.
17
+
18
+ ## Additional context
19
+
20
+ Add any other context or screenshots about the feature request here.
21
+
22
+ ## PR link
23
+
24
+ If you have opened a pull request to address the issue, please link it here.
@@ -0,0 +1,16 @@
1
+ # Type of PR (feature, enhancement, bug fix, etc.)
2
+
3
+ ## Description
4
+
5
+ Please include a summary of the change and which issue is fixed.
6
+
7
+ Fixes # (issue)
8
+
9
+ ## Why should this be added
10
+
11
+ Explain value.
12
+
13
+ ## Checklist
14
+
15
+ - [ ] My code follows the style guidelines of this project
16
+ - [ ] Checks (StandardRB, RSpec) are passing
@@ -0,0 +1,37 @@
1
+ name: Changelog
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ timeout-minutes: 4
12
+ if: "!contains(github.event.head_commit.message, '[nodoc]')"
13
+ steps:
14
+ - uses: actions/checkout@master
15
+ - name: Set up Ruby 2.6
16
+ uses: actions/setup-ruby@v1
17
+ with:
18
+ ruby-version: 2.6.x
19
+ - uses: actions/cache@v1.1.2
20
+ with:
21
+ path: vendor/bundle
22
+ key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
23
+ restore-keys: |
24
+ ${{ runner.os }}-gem-
25
+ - name: Create local changes
26
+ run: |
27
+ gem install github_changelog_generator
28
+ github_changelog_generator -u peterberkenbosch -p affirm-ruby-api --token ${{ secrets.CHANGELOG_GITHUB_TOKEN }} --exclude-labels duplicate,question,invalid,wontfix,nodoc
29
+ - name: Commit files
30
+ run: |
31
+ git config --local user.email "github-actions@example.com"
32
+ git config --local user.name "GitHub Actions"
33
+ git commit -m "[nodoc] update changelog" -a
34
+ - name: Push changes
35
+ uses: ad-m/github-push-action@master
36
+ with:
37
+ github_token: ${{ secrets.CHANGELOG_GITHUB_TOKEN }}
@@ -0,0 +1,33 @@
1
+ name: StandardRB
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - '*'
7
+ push:
8
+ branches:
9
+ - master
10
+
11
+ jobs:
12
+ standard:
13
+ name: StandardRB Check Action
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@master
17
+ - name: Set up Ruby 2.6
18
+ uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.6.x
21
+ - uses: actions/cache@v1
22
+ with:
23
+ path: vendor/bundle
24
+ key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
25
+ restore-keys: |
26
+ ${{ runner.os }}-gems-
27
+ - name: Bundle install
28
+ run: |
29
+ gem install bundler
30
+ bundle config path vendor/bundle
31
+ bundle install --jobs 4 --retry 3
32
+ - name: Run StandardRB
33
+ run: bundle exec standardrb --format progress
@@ -1,34 +1,33 @@
1
- name: Run Tests
1
+ name: Tests
2
2
 
3
3
  on:
4
- push:
5
- branches: [ master ]
6
4
  pull_request:
7
- branches: [ master ]
5
+ branches:
6
+ - '*'
7
+ push:
8
+ branches:
9
+ - master
8
10
 
9
11
  jobs:
10
- build:
11
-
12
+ ruby_test:
13
+ name: Ruby Test Action
12
14
  runs-on: ubuntu-latest
13
-
14
15
  steps:
15
- - uses: actions/checkout@v2
16
+ - uses: actions/checkout@master
16
17
  - name: Set up Ruby 2.6
17
18
  uses: actions/setup-ruby@v1
18
19
  with:
19
20
  ruby-version: 2.6.x
20
- - name: Build and test with Rake
21
+ - uses: actions/cache@v1
22
+ with:
23
+ path: vendor/bundle
24
+ key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
25
+ restore-keys: |
26
+ ${{ runner.os }}-gems-
27
+ - name: Bundle install
21
28
  run: |
22
29
  gem install bundler
30
+ bundle config path vendor/bundle
23
31
  bundle install --jobs 4 --retry 3
24
- bundle exec rake
25
- - uses: devmasx/coverage-check-action@v1.1.0
26
- with:
27
- type: simplecov
28
- result_path: coverage/.last_run.json
29
- min_coverage: 100
30
- token: ${{secrets.GITHUB_TOKEN}}
31
- - name: StandardRB Linter
32
- uses: andrewmcodes/standardrb-action@v0.0.2
33
- env:
34
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32
+ - name: Run ruby tests
33
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ Gemfile.lock
@@ -1,24 +1,44 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
3
+ ## [Unreleased](https://github.com/peterberkenbosch/affirm-ruby-api/tree/HEAD)
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
6
- adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+ [Full Changelog](https://github.com/peterberkenbosch/affirm-ruby-api/compare/v1.0.2...HEAD)
7
6
 
8
- ## [Unreleased]
7
+ **Implemented enhancements:**
9
8
 
10
- ## [1.0.2] - 2020-04-21
9
+ - Use gitbook.io for official documentation [\#8](https://github.com/peterberkenbosch/affirm-ruby-api/pull/8) ([peterberkenbosch](https://github.com/peterberkenbosch))
11
10
 
12
- ### Changed
13
- - Fix Gemfile.lock missing version bump
14
- - Support Ruby >= 2.5 (https://www.ruby-lang.org/en/news/2020/04/05/support-of-ruby-2-4-has-ended/)
11
+ **Merged pull requests:**
15
12
 
16
- ## [1.0.1] - 2020-04-13
13
+ - Add provider to transaction [\#10](https://github.com/peterberkenbosch/affirm-ruby-api/pull/10) ([peterberkenbosch](https://github.com/peterberkenbosch))
14
+ - Bump standard from 0.2.4 to 0.2.5 [\#7](https://github.com/peterberkenbosch/affirm-ruby-api/pull/7) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
17
15
 
18
- ### Added
19
- - Introduce `TestingSupport::HttpResponses` for sharing the http and JSON fixtures
20
- so we can share these in environments that use this gem.
16
+ ## [v1.0.2](https://github.com/peterberkenbosch/affirm-ruby-api/tree/v1.0.2) (2020-04-21)
21
17
 
22
- ## [1.0.0] - 2020-04-13
18
+ [Full Changelog](https://github.com/peterberkenbosch/affirm-ruby-api/compare/v1.0.1...v1.0.2)
23
19
 
24
- Initial release.
20
+ **Merged pull requests:**
21
+
22
+ - Bump pry from 0.12.2 to 0.13.1 [\#6](https://github.com/peterberkenbosch/affirm-ruby-api/pull/6) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
23
+ - Bump rake from 12.3.3 to 13.0.1 [\#5](https://github.com/peterberkenbosch/affirm-ruby-api/pull/5) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
24
+ - Bump standard from 0.2.2 to 0.2.4 [\#4](https://github.com/peterberkenbosch/affirm-ruby-api/pull/4) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
25
+
26
+ ## [v1.0.1](https://github.com/peterberkenbosch/affirm-ruby-api/tree/v1.0.1) (2020-04-13)
27
+
28
+ [Full Changelog](https://github.com/peterberkenbosch/affirm-ruby-api/compare/v1.0.0...v1.0.1)
29
+
30
+ **Merged pull requests:**
31
+
32
+ - Add testing support for http and json stub [\#2](https://github.com/peterberkenbosch/affirm-ruby-api/pull/2) ([peterberkenbosch](https://github.com/peterberkenbosch))
33
+
34
+ ## [v1.0.0](https://github.com/peterberkenbosch/affirm-ruby-api/tree/v1.0.0) (2020-04-13)
35
+
36
+ [Full Changelog](https://github.com/peterberkenbosch/affirm-ruby-api/compare/8d00e6ca963436d032e476614422cdd55790ef6a...v1.0.0)
37
+
38
+ **Merged pull requests:**
39
+
40
+ - add gem-release and config [\#1](https://github.com/peterberkenbosch/affirm-ruby-api/pull/1) ([peterberkenbosch](https://github.com/peterberkenbosch))
41
+
42
+
43
+
44
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Affirm Ruby API
2
2
 
3
- ![Run Tests](https://github.com/peterberkenbosch/affirm-ruby-api/workflows/Run%20Tests/badge.svg)
4
- [![Gem Version](https://badge.fury.io/rb/affirm-ruby-api.svg)](https://badge.fury.io/rb/affirm-ruby-api)
5
-
6
3
  Clean, fast and pure Ruby implementation for the [Affirm API](https://docs.affirm.com/affirm-developers/reference)
7
4
 
8
- This is using the new Transaction API and is not compatible with the Charge API.
9
- Also see the [Affirm Changelog](https://docs.affirm.com/affirm-developers/changelog/transactions-api)
5
+ This is using the new Transaction API and is not compatible with the Charge API. Also see the [Affirm Changelog](https://docs.affirm.com/affirm-developers/changelog/transactions-api)
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/affirm-ruby-api.svg)](https://badge.fury.io/rb/affirm-ruby-api)
8
+ ![Tests](https://github.com/peterberkenbosch/affirm-ruby-api/workflows/Tests/badge.svg)
9
+ ![StandardRB](https://github.com/peterberkenbosch/affirm-ruby-api/workflows/StandardRB/badge.svg)
10
10
 
11
11
  ## Installation
12
12
 
@@ -24,12 +24,9 @@ Or install it yourself as:
24
24
 
25
25
  $ gem install affirm-ruby-api
26
26
 
27
- ## Usage
28
-
29
-
30
- ## Sponsorship
27
+ ## Documentation
31
28
 
32
- If you use this extension and like to support this work, please consider [being a sponsor](https://github.com/sponsors/peterberkenbosch).
29
+ * [Official documentation](https://peterberkenbosch.gitbook.io/affirm-ruby-api)
33
30
 
34
31
  ## Development
35
32
 
@@ -0,0 +1,14 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | ------------------ |
7
+ | 1.0.x | :white_check_mark: |
8
+ | < 0.1 | :x: |
9
+
10
+ ## Reporting a Vulnerability
11
+
12
+ Please send an email to security@peterberkenbosch.nl with the vulnerability you have found so we can patch this library and send out a security advisory so people using this library have time to upgrade.
13
+
14
+ Thanks!
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: Affirm Ruby API for enabling Affirm Financing in your Ruby based projects.
3
+ ---
4
+
5
+ # Welcome
6
+
7
+ Clean, fast and pure Ruby implementation for the [Affirm API](https://docs.affirm.com/affirm-developers/reference)
8
+
9
+ This is using the new Transaction API and is not compatible with the Charge API. Also see the [Affirm Changelog](https://docs.affirm.com/affirm-developers/changelog/transactions-api)
10
+
11
+ [![Gem Version](https://badge.fury.io/rb/affirm-ruby-api.svg)](https://badge.fury.io/rb/affirm-ruby-api)
12
+ ![Tests](https://github.com/peterberkenbosch/affirm-ruby-api/workflows/Tests/badge.svg)
13
+ ![StandardRB](https://github.com/peterberkenbosch/affirm-ruby-api/workflows/StandardRB/badge.svg)
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'affirm-ruby-api'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ ```bash
26
+ $ bundle install
27
+ ```
28
+
29
+ Or install it yourself as:
30
+
31
+ ```bash
32
+ $ gem install affirm-ruby-api
33
+ ```
@@ -0,0 +1,3 @@
1
+ # Table of contents
2
+
3
+ * [Welcome](README.md)
@@ -82,7 +82,7 @@ module Affirm
82
82
  #
83
83
  # @param [String] transaction_id
84
84
  # @param [String] expand
85
- # @return <Struct::Transaction::Event>
85
+ # @return <Struct::Transaction>
86
86
  #
87
87
  # @raise Affirm::RequestError
88
88
  def read_transaction(transaction_id, expand = nil)
@@ -168,7 +168,7 @@ module Affirm
168
168
  begin
169
169
  response = http.request(request)
170
170
  rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
171
- Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
171
+ Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
172
172
  raise RequestError, e.message
173
173
  end
174
174
 
@@ -187,7 +187,7 @@ module Affirm
187
187
  raise NotFoundError, response
188
188
  when 500, 502, 503, 504
189
189
  # 500, 502, 503, 504 - Server Errors
190
- raise Error
190
+ raise Error, response
191
191
  end
192
192
  end
193
193
 
@@ -12,6 +12,15 @@ module Affirm
12
12
  attr_accessor :order_id
13
13
  attr_accessor :provider_id
14
14
  attr_accessor :status
15
+
16
+ def provider
17
+ case provider_id
18
+ when 1
19
+ :affirm
20
+ when 2
21
+ :katapult
22
+ end
23
+ end
15
24
  end
16
25
  end
17
26
  end
@@ -1,3 +1,5 @@
1
+ require_relative "../version"
2
+
1
3
  module Affirm
2
4
  module TestingSupport
3
5
  module HttpResponses
@@ -1,3 +1,3 @@
1
1
  module Affirm
2
- VERSION = "1.0.2".freeze
2
+ VERSION = "1.0.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: affirm-ruby-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Berkenbosch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-21 00:00:00.000000000 Z
11
+ date: 2020-05-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Affirm Ruby API for enabling Affirm Financing in your Ruby based projects.
14
14
  email:
@@ -18,19 +18,28 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - ".gem-release.yml"
21
+ - ".gitbook.yaml"
22
+ - ".github/FUNDING.yml"
23
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
24
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
25
+ - ".github/PULL_REQUEST_TEMPLATE.md"
26
+ - ".github/workflows/changelog.yml"
27
+ - ".github/workflows/standardrb.yml"
21
28
  - ".github/workflows/test.yml"
22
29
  - ".gitignore"
23
30
  - ".rspec"
24
31
  - CHANGELOG.md
25
32
  - CODE_OF_CONDUCT.md
26
33
  - Gemfile
27
- - Gemfile.lock
28
34
  - LICENSE.txt
29
35
  - README.md
30
36
  - Rakefile
37
+ - SECURITY.md
31
38
  - affirm-ruby-api.gemspec
32
39
  - bin/console
33
40
  - bin/setup
41
+ - docs/README.md
42
+ - docs/SUMMARY.md
34
43
  - lib/affirm-ruby-api.rb
35
44
  - lib/affirm.rb
36
45
  - lib/affirm/client.rb
@@ -1,83 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- affirm-ruby-api (1.0.1)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- addressable (2.7.0)
10
- public_suffix (>= 2.0.2, < 5.0)
11
- ast (2.4.0)
12
- coderay (1.1.2)
13
- crack (0.4.3)
14
- safe_yaml (~> 1.0.0)
15
- diff-lcs (1.3)
16
- docile (1.3.2)
17
- gem-release (2.1.1)
18
- hashdiff (1.0.1)
19
- jaro_winkler (1.5.4)
20
- method_source (1.0.0)
21
- parallel (1.19.1)
22
- parser (2.7.1.1)
23
- ast (~> 2.4.0)
24
- pry (0.13.1)
25
- coderay (~> 1.1)
26
- method_source (~> 1.0)
27
- public_suffix (4.0.3)
28
- rainbow (3.0.0)
29
- rake (13.0.1)
30
- rexml (3.2.4)
31
- rspec (3.9.0)
32
- rspec-core (~> 3.9.0)
33
- rspec-expectations (~> 3.9.0)
34
- rspec-mocks (~> 3.9.0)
35
- rspec-core (3.9.1)
36
- rspec-support (~> 3.9.1)
37
- rspec-expectations (3.9.1)
38
- diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.9.0)
40
- rspec-mocks (3.9.1)
41
- diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.9.0)
43
- rspec-support (3.9.2)
44
- rubocop (0.80.1)
45
- jaro_winkler (~> 1.5.1)
46
- parallel (~> 1.10)
47
- parser (>= 2.7.0.1)
48
- rainbow (>= 2.2.2, < 4.0)
49
- rexml
50
- ruby-progressbar (~> 1.7)
51
- unicode-display_width (>= 1.4.0, < 1.7)
52
- rubocop-performance (1.5.2)
53
- rubocop (>= 0.71.0)
54
- ruby-progressbar (1.10.1)
55
- safe_yaml (1.0.5)
56
- simplecov (0.18.5)
57
- docile (~> 1.1)
58
- simplecov-html (~> 0.11)
59
- simplecov-html (0.12.2)
60
- standard (0.2.4)
61
- rubocop (~> 0.80.1)
62
- rubocop-performance (~> 1.5.2)
63
- unicode-display_width (1.6.1)
64
- webmock (3.8.3)
65
- addressable (>= 2.3.6)
66
- crack (>= 0.3.2)
67
- hashdiff (>= 0.4.0, < 2.0.0)
68
-
69
- PLATFORMS
70
- ruby
71
-
72
- DEPENDENCIES
73
- affirm-ruby-api!
74
- gem-release
75
- pry
76
- rake (~> 13.0)
77
- rspec (~> 3.0)
78
- simplecov
79
- standard
80
- webmock (~> 3.8)
81
-
82
- BUNDLED WITH
83
- 2.1.4