Code Monkey home page Code Monkey logo

conekta-ruby's Introduction

README Cover Image

Conekta Ruby v.2.4.0

Made with Ruby By Conekta

This is a Ruby library that allows interaction with Conekta's API.

Requeriments

Add them!

Installation

Add this line to your application's Gemfile:

gem 'conekta'

And then execute:

bundle

Or install it yourself as:

gem install conekta

Usage

# Set your configuration variables

# This changes the Accept-Language Header to the locale specified
Conekta.locale = :es

Conekta.api_key = '1tv5yJp3xnVZ7eK67m4h'

# Or via an initializer in config/initializers/conekta.rb
Conekta.config do |c|
  c.locale = :es
  c.api_key = '1tv5yJp3xnVZ7eK67m4h'
  c.api_version = '2.0.0'
end

begin
  order = Conekta::Order.create(order_data_with_charges.
          merge(customer_info: customer_info))
rescue Conekta::Error => error
  for error_detail in error.details do
    puts error_detail.message
  end
end

{
  "livemode": false,
  "amount": 35000,
  "payment_status": "pending_payment",
  "currency": "MXN",
  "customer_info": {
    "email": "[email protected]",
    "phone": "+5213353319758",
    "name": "John Constantine",
    "first_paid_at": 0
  },
  "object": "order",
  "id": "ord_2ftyJuymR9FZczvPg",
  "metadata": {
    "test": true
  },
  "created_at": 1485272874,
  "updated_at": 1485272874,
  "line_items": {
    "0": {
      "name": "Box of Cohiba S1s",
      "description": "Imported From Mex.",
      "unit_price": 35000,
      "quantity": 1,
      "tags": ["food", "mexican food"],
      "type": "physical",
      "object": "line_item",
      "id": "line_item_2ftyJuymR9FZczvPe",
      "parent_id": "ord_2ftyJuymR9FZczvPg",
      "metadata": {}
    }
  },
  "charges": {
    "0": {
      "id": "5887772aedbb6ea3a30056c5",
      "livemode": false,
      "created_at": 1485272874,
      "currency": "MXN",
      "payment_method": {
        "barcode_url": "https://s3.amazonaws.com/cash_payment_barcodes/sandbox_reference.png",
        "service_name": "OxxoPay",
        "object": "cash_payment",
        "type": "oxxo",
        "expires_at": 1485276473,
        "store_name": "OXXO",
        "reference": "93345678901234"
      },
      "object": "charge",
      "status": "pending_payment",
      "amount": 35000,
      "fee": 1421,
      "customer_id": "",
      "order_id": "ord_2ftyJuymR9FZczvPg"
    }
  }
}

Documentation

Please visit the official API reference for an up-to-date documentation.

Development and Testing

Feel free to play with our library and make pull requests if you find any bugs. You can run the test suite with rspec from the library's root directory:

bundle exec rspec

To facilitate the development and testing process you can use one of our Docker containers that come with RVM and Ruby versions 1.9.3, 2.1.9, 2.2.4 and 2.3.0:

docker pull conekta/conekta-ruby

docker run -ti conekta/conekta-ruby /bin/bash --login

How to contribute to the project

  1. Fork the repository

  2. Clone the repository

    git clone [email protected]:yourUserName/conekta-ruby.git
  1. Create a branch
    git checkout develop
    git pull origin develop
    # You should choose the name of your branch
    git checkout -b <feature/my_branch>
  1. Make necessary changes and commit those changes
    git add .
    git commit -m "my changes"
  1. Push changes to GitHub
    git push origin <feature/my_branch>
  1. Submit your changes for review, create a pull request

    To create a pull request, you need to have made your code changes on a separate branch. This branch should be named like this: feature/my_feature or fix/my_fix.

    Make sure that, if you add new features to our library, be sure that corresponding unit tests are added.

    If you go to your repository on GitHub, you’ll see a Compare & pull request button. Click on that button.


We are always hiring!

If you are a comfortable working with a range of backend languages (Java, Python, Ruby, PHP, etc) and frameworks, you have solid foundation in data structures, algorithms and software design with strong analytical and debugging skills, check our open positions: https://www.conekta.com/careers

License

Developed in 🇲🇽 Mexico by Conekta. Available with MIT License.

conekta-ruby's People

Contributors

acolin avatar andreasantillana avatar antillas21 avatar edenriquez avatar emilianork avatar gerardoacuna avatar hectorgool avatar javiermurillo avatar jovalo avatar karlarobinson avatar leofischer avatar lu1s avatar luiscarlos-gonzalez avatar mackaber avatar mariochavez avatar mauriciomurga avatar nicklloyd avatar richpeniche avatar robertomiranda avatar vicentemendoza avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.