Skip to content

Commit

Permalink
Init yookassa
Browse files Browse the repository at this point in the history
  • Loading branch information
paderinandrey committed Dec 7, 2020
1 parent 55dbde6 commit b40b9a3
Show file tree
Hide file tree
Showing 29 changed files with 133 additions and 184 deletions.
28 changes: 28 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2.1
orbs:
ruby: circleci/[email protected]

jobs:
build:
docker:
- image: circleci/ruby:2.6.3-stretch-node
executor: ruby/default
steps:
- checkout
- restore_cache:
keys:
- yookassa-bundle-{{ checksum "Gemfile.lock" }}
- yookassa-bundle-
- run:
name: Install dependencies
command: |
bundle check || bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: yookassa-bundle-{{ checksum "Gemfile.lock" }}

- run:
name: Run tests
command: |
bundle exec rspec --profile 10 --format progress
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

74 changes: 0 additions & 74 deletions CODE_OF_CONDUCT.md

This file was deleted.

8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
source "https://rubygems.org"
# frozen_string_literal: true

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
source 'https://rubygems.org'

# Specify your gem's dependencies in yandex-checkout.gemspec
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in yookassa.gemspec
gemspec

group :development, :test do
Expand Down
22 changes: 11 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
yandex-checkout (0.1.1)
yookassa (0.1.0)
evil-client (~> 3.0)

GEM
Expand All @@ -12,26 +12,26 @@ GEM
ast (2.4.0)
byebug (11.0.1)
coderay (1.1.2)
concurrent-ruby (1.1.5)
concurrent-ruby (1.1.7)
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.3)
docile (1.3.1)
dry-initializer (3.0.1)
evil-client (3.0.3)
dry-initializer (3.0.4)
evil-client (3.0.4)
dry-initializer (>= 2.1, < 4)
mime-types (~> 3.1)
rack (~> 2)
tram-policy (>= 0.3.1, < 2)
tram-policy (>= 0.3.1, < 3)
hashdiff (0.4.0)
i18n (1.6.0)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.2)
json (2.2.0)
method_source (0.9.2)
mime-types (3.2.2)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mime-types-data (3.2020.1104)
parallel (1.17.0)
parser (2.6.3.0)
ast (~> 2.4.0)
Expand All @@ -42,7 +42,7 @@ GEM
byebug (~> 11.0)
pry (~> 0.10)
public_suffix (3.1.0)
rack (2.0.7)
rack (2.2.3)
rainbow (3.0.0)
rake (12.3.2)
rspec (3.8.0)
Expand Down Expand Up @@ -72,7 +72,7 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
tram-policy (1.0.1)
tram-policy (2.0.1)
dry-initializer (> 2, < 4)
i18n (~> 1.0)
unicode-display_width (1.6.0)
Expand All @@ -92,7 +92,7 @@ DEPENDENCIES
rubocop (~> 0.71)
simplecov (~> 0.16)
webmock (~> 3.5)
yandex-checkout!
yookassa!

BUNDLED WITH
1.17.3
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Yandex::Checkout
# YooKassa API Ruby Client

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yandex/checkout`. To experiment with that code, run `bin/console` for an interactive prompt.
[![Gem Version][gem-badger]][gem]
[![Yookassa](https://circleci.com/gh/paderinandrey/yookassa.svg?style=svg)](https://circleci.com/gh/paderinandrey/yookassa)

TODO: Delete this and the text above, and describe your gem
[gem-badger]: https://img.shields.io/gem/v/yookassa.svg?style=flat&color=blue
[gem]: https://rubygems.org/gems/yookassa

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'yandex-checkout'
gem 'yookassa'
```

And then execute:
Expand All @@ -18,26 +20,21 @@ And then execute:

Or install it yourself as:

$ gem install yandex-checkout
$ gem install yookassa

## Usage

TODO: Write usage instructions here

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yandex-checkout. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Everyone is encouraged to help improve this project. Here are a few ways you can help:

- [Report bugs](https://github.com/paderinandrey/yookassa/issues)
- Fix bugs and [submit pull requests](https://github.com/paderinandrey/yookassa/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the Yandex::Checkout project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/yandex-checkout/blob/master/CODE_OF_CONDUCT.md).
13 changes: 0 additions & 13 deletions lib/yandex-checkout.rb

This file was deleted.

5 changes: 0 additions & 5 deletions lib/yandex-checkout/version.rb

This file was deleted.

13 changes: 13 additions & 0 deletions lib/yookassa.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'evil/client'

require 'yookassa/version'
require 'yookassa/payment'
require 'yookassa/refund'
require 'yookassa/response'
require 'yookassa/callable'
require 'yookassa/optional'
require 'yookassa/entity/payment'
require 'yookassa/entity/refund'
require 'yookassa/error'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module YandexCheckout
module Yookassa
module Callable
def call(*args)
new(*args)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

module YandexCheckout
module Yookassa
module Entity
class Amount
extend Dry::Initializer
extend YandexCheckout::Callable
include YandexCheckout::Optional
extend Yookassa::Callable
include Yookassa::Optional

option :value, proc(&:to_f), optional: true
option :currency, proc(&:to_s), optional: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

module YandexCheckout
module Yookassa
module Entity
class Card
extend Dry::Initializer
extend YandexCheckout::Callable
include YandexCheckout::Optional
extend Yookassa::Callable
include Yookassa::Optional

option :first6
option :last4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

module YandexCheckout
module Yookassa
module Entity
class Confirmation
extend Dry::Initializer
extend YandexCheckout::Callable
include YandexCheckout::Optional
extend Yookassa::Callable
include Yookassa::Optional

option :type, proc(&:to_s), optional: true
option :confirmation_url, proc(&:to_s), optional: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
require_relative './payment_method'
require_relative './confirmation'

module YandexCheckout
module Yookassa
module Entity
class Payment < YandexCheckout::Response
class Payment < Yookassa::Response
option :paid
option :amount, Entity::Amount
option :created_at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

require_relative './card'

module YandexCheckout
module Yookassa
module Entity
class PaymentMethod
extend Dry::Initializer
extend YandexCheckout::Callable
include YandexCheckout::Optional
extend Yookassa::Callable
include Yookassa::Optional

option :type, proc(&:to_s)
option :id, proc(&:to_s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

require_relative './amount'

module YandexCheckout
module Yookassa
module Entity
class Refund < YandexCheckout::Response
class Refund < Yookassa::Response
option :payment_id
option :created_at, proc(&:to_s)
option :amount, Entity::Amount
Expand Down
6 changes: 3 additions & 3 deletions lib/yandex-checkout/error.rb → lib/yookassa/error.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

module YandexCheckout
module Yookassa
class Error
extend Dry::Initializer
extend YandexCheckout::Callable
include YandexCheckout::Optional
extend Yookassa::Callable
include Yookassa::Optional

option :type, proc(&:to_s)
option :id, proc(&:to_s), optional: true
Expand Down
Loading

0 comments on commit b40b9a3

Please sign in to comment.