smartcoin 0.2.4 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31f72832894149fc78f99702aa3a4f81194c8132
4
- data.tar.gz: bd039af97a4ffb1140b7c3da97bf6c10974f9c87
3
+ metadata.gz: b5a57f2b1525121ddbebd33bfcb47160f9a1f9a0
4
+ data.tar.gz: f21b2a558162ce7f3a54e04a89167922b519bc36
5
5
  SHA512:
6
- metadata.gz: f6a77869308812991abb7f33d858a8b786ccc3e3f9644adce903d52a1fba8166705a4b44ad46a0405d06ac1bd14e43d3771245ea378391cbbf11002d99ba3384
7
- data.tar.gz: 9bce5d19ccb87ddf2b9914e1730ab1c7890c71ce0f9f2b721d532d9c5000f69633448fc2906ebc0bafc0c5b8c94b099ab8937138d1ddfea6180c8fba233dc685
6
+ metadata.gz: 7e8b3b180b108e63d2b3b5a469922e1a44f651d57f1e90f1ddb05712b238cb63f735c79682d84282971d1becda2e7de231dd0f53945ee1cfd1095a1c5bb0f4f1
7
+ data.tar.gz: 07f6235dfb30ca6d662415217547957f12e522d841357b4d773e69e95357d4f57914eccdcb6846b4fcacd1724598f810294afa2fac299c2ed85c28515340bc63
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
data/README.md CHANGED
@@ -1,37 +1,79 @@
1
- Visit [Smartcoin](https://smartcoin.com.br/) to request an account.
1
+ [![Build Status](https://travis-ci.org/smartcoinpayments/smartcoin-ruby.svg?branch=master)](https://travis-ci.org/smartcoinpayments/smartcoin-ruby) [![Dependency Status](https://gemnasium.com/smartcoinpayments/smartcoin-ruby.svg)](https://gemnasium.com/smartcoinpayments/smartcoin-ruby)
2
2
 
3
- Getting Started
3
+ Visite <a href="https://smartcoin.com.br/" target="_blank">Smartcoin</a> para cadastrar uma conta.
4
+
5
+ #Vamos fazer
4
6
  ===============
5
7
 
6
- Sample usage:
8
+ Exemplos de uso:
7
9
 
8
10
  ```ruby
9
- SmartCoin.api_key('pk_live_e73e1d46a263fe')
10
- SmartCoin.api_secret('sk_live_6bef1b7867ecbf')
11
-
12
- #Credit Card Charge
13
- card_params = {number: 4242424242424242,
14
- exp_month: 11,
15
- exp_year: 2017,
16
- cvc: '111',
17
- name: 'Arthur Granado'
18
- }
19
-
20
- token = SmartCoin::Token.create(token_params)
21
- charge_params = { amount: 100, currency: 'brl', card: token.id, }
22
- charge = SmartCoin::Charge.create(charge_params)
23
- puts charge.to_json
11
+ Smartcoin.api_key('pk_test_407d1f51a61756') #Troque as chaves do demo para as suas de test ou live
12
+ Smartcoin.api_secret('sk_test_86e4486a0078b2') #Troque as chaves do demo para as suas de test ou live
24
13
 
25
- #Bank Slip Charge
26
- charge_params = {amount: 1000, currency: 'brl', type: 'bank_slip'}
27
- charge = SmartCoin::Charge.create(charge_params)
14
+ #Create Charge with card information
15
+ begin
16
+ charge = Smartcoin::Charge.create({
17
+ amount: 100,
18
+ currency: 'brl',
19
+ card: {
20
+ number: 4242424242424242,
21
+ exp_month: 11,
22
+ exp_year: 2017,
23
+ cvc: '041'
24
+ }
25
+ })
28
26
  puts charge.to_json
27
+ rescue Smartcoin::SmartcoinError => e
28
+ puts e.json_message
29
+ end
30
+
31
+ #Create Charge with token as card param
32
+ begin
33
+ charge = Smartcoin::Charge.create({
34
+ amount: 100,
35
+ currency: 'brl',
36
+ card: 'tok_123344555666'
37
+ })
38
+ puts charge.to_json
39
+ rescue Smartcoin::SmartcoinError => e
40
+ puts e.json_message
41
+ end
42
+
43
+ #Create Bank Slip Charge
44
+ begin
45
+ charge = Smartcoin::Charge.create({
46
+ amount: 1000,
47
+ currency: 'brl',
48
+ type: 'bank_slip'
49
+ })
50
+ puts charge.to_json
51
+ rescue Smartcoin::SmartcoinError => e
52
+ puts e.json_message
53
+ end
54
+
55
+ #Create Subscription
56
+ begin
57
+ card = {number: 4242424242424242, exp_month: 5, exp_year: 2017, cvc: '011', name: 'Doctor Who'}
58
+ customer = Smartcoin::Customer.create({
59
+ email: 'test@example.com',
60
+ card: card
61
+ })
62
+
63
+ sub = customer.subscriptions.create(plan: 'silver')
64
+
65
+ puts sub.to_json
66
+ rescue Smartcoin::SmartcoinError => e
67
+ puts e.json_message
68
+ end
29
69
  ```
30
70
 
31
- Test
71
+ Veja os <a href="https://github.com/smartcoinpayments/smartcoin-ruby/blob/master/test/smartcoin/charge_spec.rb" target="_blank">testes</a> para mais opções.
72
+
73
+ #Teste
32
74
  ====
33
75
 
34
- To run test the suite:
76
+ Para executar a suite de teste:
35
77
 
36
78
  ```
37
79
  rspec ./test
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ task :default => [:spec]
2
+ desc 'run Rspec specs'
3
+ task :spec do
4
+ sh 'rspec test/'
5
+ end
2
6
 
@@ -2,11 +2,12 @@ require "rest-client"
2
2
  require "json"
3
3
 
4
4
  require "smartcoin/version"
5
- require "smartcoin/smart_coin_object"
5
+ require "smartcoin/smartcoin_object"
6
6
  require "smartcoin/api_resource"
7
7
  require "smartcoin/api_operations/create"
8
8
  require "smartcoin/api_operations/retrieve"
9
9
  require "smartcoin/api_operations/update"
10
+ require "smartcoin/api_operations/delete"
10
11
  require "smartcoin/api_operations/list"
11
12
  require "smartcoin/card"
12
13
  require "smartcoin/token"
@@ -15,10 +16,13 @@ require "smartcoin/fee"
15
16
  require "smartcoin/installment"
16
17
  require "smartcoin/charge"
17
18
  require "smartcoin/util"
18
- require "smartcoin/errors/smart_coin_error"
19
+ require "smartcoin/errors/smartcoin_error"
19
20
  require "smartcoin/shipping"
21
+ require "smartcoin/plan"
22
+ require "smartcoin/customer"
23
+ require "smartcoin/subscription"
20
24
 
21
- module SmartCoin
25
+ module Smartcoin
22
26
  @@api_key = ''
23
27
  @@api_secret = ''
24
28
 
@@ -1,8 +1,7 @@
1
- module SmartCoin
1
+ module Smartcoin
2
2
  module ApiOperations
3
3
  module Create
4
4
  def create(params)
5
- url = get_url
6
5
  method = :post
7
6
  response = api_request(url,method,params)
8
7
  create_from(response)
@@ -0,0 +1,12 @@
1
+ module Smartcoin
2
+ module ApiOperations
3
+ module Delete
4
+ def delete
5
+ method = :delete
6
+ response = api_request(url,method)
7
+ reflesh_object(response)
8
+ response
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,8 +1,7 @@
1
- module SmartCoin
1
+ module Smartcoin
2
2
  module ApiOperations
3
3
  module List
4
- def list_all(params)
5
- url = get_url
4
+ def list_all(params=nil)
6
5
  method = :get
7
6
  response = api_request(url, method, params)
8
7
  create_from(response)
@@ -1,10 +1,10 @@
1
- module SmartCoin
1
+ module Smartcoin
2
2
  module ApiOperations
3
3
  module Retrieve
4
- def retrieve(charge_id)
5
- url = get_url
4
+ def retrieve(obj_id)
5
+ obj_id = "?email=#{obj_id}" if obj_id.include? '@'
6
6
  method = :get
7
- response = api_request("#{url}/#{charge_id}",method)
7
+ response = api_request("#{url}/#{obj_id}",method)
8
8
  create_from(response)
9
9
  end
10
10
 
@@ -1,10 +1,19 @@
1
- module SmartCoin
1
+ module Smartcoin
2
2
  module ApiOperations
3
3
  module Update
4
- def update(smartcoin_object_id, url_sufix, params=nil)
5
- url = "#{self.class.get_url()}/#{smartcoin_object_id}#{url_sufix}"
4
+ def save
5
+ params_to_update = {}
6
+ self.serialize_params.each do |key|
7
+ return if key.to_sym == :plan && ((@values[key] || @values[key.to_s]).is_a? Smartcoin::SmartcoinObject)
8
+ params_to_update[key] = (@values[key] || @values[key.to_s]) if @values
9
+ end
10
+
11
+ update(params_to_update)
12
+ end
13
+
14
+ def update(params=nil, url_sufix=nil)
6
15
  method = :post
7
- response = api_request(url,method,params)
16
+ response = api_request("#{url}/#{url_sufix}",method,params)
8
17
  reflesh_object(response)
9
18
  end
10
19
  end
@@ -1,4 +1,4 @@
1
- module SmartCoin
1
+ module Smartcoin
2
2
  module ApiResource
3
3
  BASE_URL = 'https://api.smartcoin.com.br'
4
4
  SSL_BUNDLE_PATH = File.dirname(__FILE__) + '/../data/ssl-bundle.crt'
@@ -19,7 +19,7 @@ module SmartCoin
19
19
  params = nil
20
20
  end
21
21
 
22
- access_keys = SmartCoin.access_keys.split(':')
22
+ access_keys = Smartcoin.access_keys.split(':')
23
23
  api_key = access_keys[0]
24
24
  api_secret = access_keys[1]
25
25
  begin
@@ -39,7 +39,7 @@ module SmartCoin
39
39
  rbody = JSON.parse(rbody)
40
40
  rbody = Util.symbolize_names(rbody)
41
41
 
42
- raise SmartCoinError.new(rcode, rbody, rbody[:error], rbody[:error][:message])
42
+ raise SmartcoinError.new(rcode, rbody, rbody[:error], rbody[:error][:message])
43
43
  else
44
44
  raise e
45
45
  end
@@ -1,4 +1,4 @@
1
- module SmartCoin
2
- class Card < SmartCoinObject
1
+ module Smartcoin
2
+ class Card < SmartcoinObject
3
3
  end
4
4
  end
@@ -1,5 +1,5 @@
1
- module SmartCoin
2
- class Charge < SmartCoinObject
1
+ module Smartcoin
2
+ class Charge < SmartcoinObject
3
3
  include ApiResource
4
4
  include ApiOperations::Create
5
5
  include ApiOperations::Retrieve
@@ -7,15 +7,13 @@ module SmartCoin
7
7
  include ApiOperations::List
8
8
 
9
9
  def capture(amount=nil)
10
- url_sufix = '/capture'
11
10
  params = {amount: amount} if amount
12
- update(self.id, url_sufix, params)
11
+ update(params, '/capture')
13
12
  end
14
13
 
15
14
  def refund(amount=nil)
16
- url_sufix = '/refund'
17
15
  params = {amount: amount} if amount
18
- update(self.id, url_sufix, params)
16
+ update(params, '/refund')
19
17
  end
20
18
  end
21
19
  end
@@ -0,0 +1,14 @@
1
+ module Smartcoin
2
+ class Customer < SmartcoinObject
3
+ include ApiResource
4
+ include ApiOperations::Create
5
+ include ApiOperations::Retrieve
6
+ include ApiOperations::Update
7
+ include ApiOperations::Delete
8
+ include ApiOperations::List
9
+
10
+ def subscriptions
11
+ Smartcoin::Subscription.create_from({customer: self.id})
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
- module SmartCoin
2
- class SmartCoinError < StandardError
1
+ module Smartcoin
2
+ class SmartcoinError < StandardError
3
3
  attr_reader :http_status, :json_message, :http_message, :message
4
4
 
5
5
  def initialize(http_status=nil, json_message=nil, http_message=nil, message=nil)
@@ -1,4 +1,4 @@
1
- module SmartCoin
2
- class Fee < SmartCoinObject
1
+ module Smartcoin
2
+ class Fee < SmartcoinObject
3
3
  end
4
4
  end
@@ -1,4 +1,4 @@
1
- module SmartCoin
2
- class Installment < SmartCoinObject
1
+ module Smartcoin
2
+ class Installment < SmartcoinObject
3
3
  end
4
4
  end
@@ -0,0 +1,14 @@
1
+ module Smartcoin
2
+ class Plan < SmartcoinObject
3
+ include ApiResource
4
+ include ApiOperations::Create
5
+ include ApiOperations::Retrieve
6
+ include ApiOperations::Update
7
+ include ApiOperations::Delete
8
+ include ApiOperations::List
9
+
10
+ def serialize_params
11
+ [:name]
12
+ end
13
+ end
14
+ end
@@ -1,4 +1,4 @@
1
- module SmartCoin
2
- class Refund < SmartCoinObject
1
+ module Smartcoin
2
+ class Refund < SmartcoinObject
3
3
  end
4
4
  end
@@ -1,4 +1,4 @@
1
- module SmartCoin
1
+ module Smartcoin
2
2
  class Shipping
3
3
  BASE_SHIPPING_URL = 'https://shipping.smartcoin.com.br'
4
4
  SSL_BUNDLE_PATH = File.dirname(__FILE__) + '/../data/shipping-ssl-bundle.crt'
@@ -22,7 +22,7 @@ module SmartCoin
22
22
  rbody = JSON.parse(rbody)
23
23
  rbody = Util.symbolize_names(rbody)
24
24
 
25
- raise SmartCoinError.new(rcode, rbody, rbody[:error], rbody[:error][:message])
25
+ raise SmartcoinError.new(rcode, rbody, rbody[:error], rbody[:error][:message])
26
26
  else
27
27
  raise e
28
28
  end
@@ -1,5 +1,5 @@
1
- module SmartCoin
2
- class SmartCoinObject
1
+ module Smartcoin
2
+ class SmartcoinObject
3
3
  @values
4
4
  def metaclass
5
5
  class << self; self; end
@@ -44,18 +44,38 @@ module SmartCoin
44
44
  end
45
45
  end
46
46
 
47
- def self.get_url
47
+ def self.url
48
48
  "/v1/#{CGI.escape(class_name.downcase)}s"
49
49
  end
50
50
 
51
+ def url
52
+ "#{self.class.url}/#{self.id}"
53
+ end
54
+
51
55
  def self.class_name
52
56
  self.name.split('::')[-1]
53
57
  end
54
58
 
59
+ def serialize_params
60
+ [:card]
61
+ end
62
+
55
63
  def initialize()
56
64
  @values = {}
57
65
  end
58
66
 
67
+ def method_missing(name, *args)
68
+ if name.to_s.end_with? '='
69
+ name = name.to_s[0...-1].to_sym
70
+ end
71
+
72
+ if serialize_params.include? name
73
+ @values[name] = args[0]
74
+ else
75
+ raise NoMemoryError.new ("Cannot set #{name} on this object")
76
+ end
77
+ end
78
+
59
79
  def to_hash
60
80
  @values.inject({}) do |result, (key,value)|
61
81
  if value.is_a? Array
@@ -0,0 +1,39 @@
1
+ module Smartcoin
2
+ class Subscription < SmartcoinObject
3
+ include ApiResource
4
+ include ApiOperations::Create
5
+ include ApiOperations::Retrieve
6
+ include ApiOperations::Update
7
+ include ApiOperations::Delete
8
+ include ApiOperations::List
9
+
10
+ def class_name
11
+ Smartcoin::Subscription.class_name
12
+ end
13
+
14
+ def create_from(params)
15
+ Smartcoin::Subscription.create_from(params)
16
+ end
17
+
18
+ def serialize_params
19
+ [:plan, :quantity]
20
+ end
21
+
22
+ def url
23
+ "#{Smartcoin::Customer.url}/#{CGI.escape(self.customer)}/#{CGI.escape(class_name.downcase)}s"
24
+ end
25
+
26
+ def self.list_all
27
+ method = :get
28
+ response = api_request(url, method)
29
+ create_from(response)
30
+ end
31
+
32
+ def delete
33
+ method = :delete
34
+ response = api_request("#{url}/#{self.id}",method)
35
+ reflesh_object(response)
36
+ response
37
+ end
38
+ end
39
+ end
@@ -1,5 +1,5 @@
1
- module SmartCoin
2
- class Token < SmartCoinObject
1
+ module Smartcoin
2
+ class Token < SmartcoinObject
3
3
  include ApiResource
4
4
 
5
5
  include ApiOperations::Create
@@ -1,16 +1,16 @@
1
- module SmartCoin
1
+ module Smartcoin
2
2
  class Util
3
3
  OBJECT_TYPES = {
4
- 'card' => SmartCoin::Card,
5
- 'charge' => SmartCoin::Charge,
6
- 'refund' => SmartCoin::Refund,
7
- 'fee' => SmartCoin::Fee,
8
- 'installment' => SmartCoin::Installment,
9
- 'Token' => SmartCoin::Token,
4
+ 'card' => Smartcoin::Card,
5
+ 'charge' => Smartcoin::Charge,
6
+ 'refund' => Smartcoin::Refund,
7
+ 'fee' => Smartcoin::Fee,
8
+ 'installment' => Smartcoin::Installment,
9
+ 'Token' => Smartcoin::Token,
10
10
  }
11
11
 
12
12
  def self.get_object_type(type)
13
- object_type = SmartCoin::SmartCoinObject
13
+ object_type = Smartcoin::SmartcoinObject
14
14
  object_type = OBJECT_TYPES[type] if OBJECT_TYPES[type]
15
15
  object_type
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module Smartcoin
2
- VERSION = "0.2.4"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency 'rest-client', '~> 1.6', '>= 1.6.7'
21
+ spec.add_runtime_dependency 'rest-client', '~> 1.7', '>= 1.7'
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.6"
24
- spec.add_development_dependency "rake", '~> 10.3', '>= 10.3.0'
25
- spec.add_development_dependency "rspec", '~> 2.14', '>= 2.14.0'
24
+ spec.add_development_dependency "rake", '~> 10.4', '>= 10.4'
25
+ spec.add_development_dependency "rspec", '~> 3.1', '>= 3.1'
26
26
  end
@@ -1,2 +1,3 @@
1
1
  require 'rspec'
2
- require_relative '../lib/smartcoin'
2
+ require_relative '../lib/smartcoin'
3
+ require 'securerandom'
@@ -1,8 +1,8 @@
1
1
  require_relative '../rspec_helper'
2
2
 
3
- describe SmartCoin::ApiResource do
3
+ describe Smartcoin::ApiResource do
4
4
  before(:each) do
5
- SmartCoin.api_key('pk_test_3ac0794848c339')
5
+ Smartcoin.api_key('pk_test_3ac0794848c339')
6
6
  end
7
7
 
8
8
  it 'call SmartCoin API' do
@@ -10,31 +10,31 @@ describe SmartCoin::ApiResource do
10
10
  method = :post
11
11
 
12
12
  params = {number: 4242424242424242,
13
- exp_month: 11,
13
+ exp_month: 5,
14
14
  exp_year: 2017,
15
15
  cvc: 111,
16
- name: 'Arthur Granado'
16
+ name: 'Doctor Who'
17
17
  }
18
- response = SmartCoin::Token.api_request(url, method, params)
18
+ response = Smartcoin::Token.api_request(url, method, params)
19
19
  expect(response['id']).to match(/tok_(.*)/)
20
20
  expect(response['object']).to eq('token')
21
21
  expect(response['card']['last4']).to eq('4242')
22
- expect(response['card']['exp_month']).to eq(11)
22
+ expect(response['card']['exp_month']).to eq(5)
23
23
  expect(response['card']['exp_year']).to eq(2017)
24
- expect(response['card']['name']).to eq('Arthur Granado')
24
+ expect(response['card']['name']).to eq('Doctor Who')
25
25
  end
26
26
 
27
27
  it 'should throw error' do
28
28
  url = "/v1/tokens"
29
29
  method = :post
30
30
 
31
- params = {exp_month: 11,
31
+ params = {exp_month: 5,
32
32
  exp_year: 2017,
33
- cvc: 111,
34
- name: 'Arthur Granado'
33
+ cvc: '021',
34
+ name: 'Doctor Who'
35
35
  }
36
36
 
37
- expect{ SmartCoin::Token.api_request(url, method, params) }.to raise_error SmartCoin::SmartCoinError
37
+ expect{ Smartcoin::Token.api_request(url, method, params) }.to raise_error Smartcoin::SmartcoinError
38
38
 
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ describe SmartCoin::ApiResource do
43
43
  json_message = {error: {type: '', message: ''}}
44
44
  http_message = ''
45
45
  message = ''
46
- smartcoin_error = SmartCoin::SmartCoinError.new(http_code, json_message, http_message, message)
46
+ smartcoin_error = Smartcoin::SmartcoinError.new(http_code, json_message, http_message, message)
47
47
  expect(smartcoin_error.http_status).to eq(http_code)
48
48
  expect(smartcoin_error.json_message).to eq(json_message)
49
49
  expect(smartcoin_error.http_message).to eq(http_message)
@@ -1,6 +1,6 @@
1
1
  require_relative '../rspec_helper'
2
2
 
3
- describe SmartCoin::Card do
3
+ describe Smartcoin::Card do
4
4
 
5
5
  it 'should create a card object from hash' do
6
6
  card_json = {
@@ -12,7 +12,7 @@ describe SmartCoin::Card do
12
12
  exp_year: 2017,
13
13
  fingerprint: "8535531490d032bf2268c1b4e708655c0287e07017ea19ae79e704c831b27fa6",
14
14
  country: "BR",
15
- name: "Arthur Granado",
15
+ name: "Doctor Who",
16
16
  address_line1: nil,
17
17
  address_line2: nil,
18
18
  address_city: nil,
@@ -21,7 +21,7 @@ describe SmartCoin::Card do
21
21
  address_country: nil
22
22
  }
23
23
 
24
- card = SmartCoin::Card.create_from(card_json)
24
+ card = Smartcoin::Card.create_from(card_json)
25
25
  expect(card.id).to eq(card_json[:id])
26
26
  expect(card.object).to eq(card_json[:object])
27
27
  expect(card.last4).to eq(card_json[:last4])
@@ -1,9 +1,9 @@
1
- require 'rspec'
1
+ require_relative '../rspec_helper'
2
2
 
3
- describe SmartCoin::Charge do
3
+ describe Smartcoin::Charge do
4
4
  before(:each) do
5
- SmartCoin.api_key('pk_test_3ac0794848c339')
6
- SmartCoin.api_secret('sk_test_8bec997b7a0ea1')
5
+ Smartcoin.api_key('pk_test_3ac0794848c339')
6
+ Smartcoin.api_secret('sk_test_8bec997b7a0ea1')
7
7
  end
8
8
 
9
9
  it 'should create a charge' do
@@ -11,16 +11,16 @@ describe SmartCoin::Charge do
11
11
  exp_month: 11,
12
12
  exp_year: 2017,
13
13
  cvc: '111',
14
- name: 'Arthur Granado'
14
+ name: 'Doctor Who'
15
15
  }
16
- token = SmartCoin::Token.create(token_params)
16
+ token = Smartcoin::Token.create(token_params)
17
17
  charge_params = {
18
18
  amount: 1000,
19
19
  currency: 'brl',
20
20
  card: token.id,
21
21
  }
22
22
 
23
- charge = SmartCoin::Charge.create(charge_params)
23
+ charge = Smartcoin::Charge.create(charge_params)
24
24
  expect(charge.id).to match(/ch_(.*)/)
25
25
  expect(charge.amount).to eq(charge_params[:amount])
26
26
  expect(charge.paid).to be_truthy
@@ -29,14 +29,14 @@ describe SmartCoin::Charge do
29
29
  expect(charge.card.type).to eq('Visa')
30
30
  expect(charge.fees.size).to be >= 2
31
31
  expect(charge.fees.first.type).to eq('Smartcoin fee: flat')
32
- expect(charge.fees.first.class).to eq(SmartCoin::Fee)
32
+ expect(charge.fees.first.class).to eq(Smartcoin::Fee)
33
33
  expect(charge.installments.size).to be >= 1
34
- expect(charge.installments.first.class).to eq(SmartCoin::Installment)
34
+ expect(charge.installments.first.class).to eq(Smartcoin::Installment)
35
35
  end
36
36
 
37
37
  it 'should create a bank_slip charge types' do
38
38
  charge_params = {amount: 1000, currency: 'brl', type: 'bank_slip'}
39
- charge = SmartCoin::Charge.create(charge_params)
39
+ charge = Smartcoin::Charge.create(charge_params)
40
40
  expect(charge.id).to match(/ch_(.*)/)
41
41
  expect(charge.amount).to eq(charge_params[:amount])
42
42
  expect(charge.paid).to be_falsey
@@ -50,17 +50,17 @@ describe SmartCoin::Charge do
50
50
  exp_month: 11,
51
51
  exp_year: 2017,
52
52
  cvc: '111',
53
- name: 'Arthur Granado'
53
+ name: 'Doctor Who'
54
54
  }
55
- token = SmartCoin::Token.create(token_params)
55
+ token = Smartcoin::Token.create(token_params)
56
56
  charge_params = {
57
57
  amount: 1000,
58
58
  currency: 'brl',
59
59
  card: token.id,
60
60
  }
61
61
 
62
- charge_created = SmartCoin::Charge.create(charge_params)
63
- charge_retrieved = SmartCoin::Charge.retrieve(charge_created.id)
62
+ charge_created = Smartcoin::Charge.create(charge_params)
63
+ charge_retrieved = Smartcoin::Charge.retrieve(charge_created.id)
64
64
  expect(charge_retrieved.id).to eq(charge_created.id)
65
65
  expect(charge_retrieved.amount).to eq(charge_created.amount)
66
66
  expect(charge_retrieved.card.fingerprint).to eq(charge_created.card.fingerprint)
@@ -71,9 +71,9 @@ describe SmartCoin::Charge do
71
71
  exp_month: 11,
72
72
  exp_year: 2017,
73
73
  cvc: '111',
74
- name: 'Arthur Granado'
74
+ name: 'Doctor Who'
75
75
  }
76
- token = SmartCoin::Token.create(token_params)
76
+ token = Smartcoin::Token.create(token_params)
77
77
  charge_params = {
78
78
  amount: 1000,
79
79
  currency: 'brl',
@@ -81,7 +81,7 @@ describe SmartCoin::Charge do
81
81
  capture: false
82
82
  }
83
83
 
84
- charge_created = SmartCoin::Charge.create(charge_params)
84
+ charge_created = Smartcoin::Charge.create(charge_params)
85
85
  expect(charge_created.captured).to be_falsey
86
86
  charge_created.capture()
87
87
  expect(charge_created.captured).to be_truthy
@@ -92,9 +92,9 @@ describe SmartCoin::Charge do
92
92
  exp_month: 11,
93
93
  exp_year: 2017,
94
94
  cvc: '111',
95
- name: 'Arthur Granado'
95
+ name: 'Doctor Who'
96
96
  }
97
- token = SmartCoin::Token.create(token_params)
97
+ token = Smartcoin::Token.create(token_params)
98
98
  charge_params = {
99
99
  amount: 1000,
100
100
  currency: 'brl',
@@ -102,7 +102,7 @@ describe SmartCoin::Charge do
102
102
  capture: false
103
103
  }
104
104
 
105
- charge_created = SmartCoin::Charge.create(charge_params)
105
+ charge_created = Smartcoin::Charge.create(charge_params)
106
106
  expect(charge_created.captured).to be_falsey
107
107
  amount_captured = 300
108
108
  charge_created.capture(amount_captured)
@@ -116,16 +116,16 @@ describe SmartCoin::Charge do
116
116
  exp_month: 11,
117
117
  exp_year: 2017,
118
118
  cvc: '111',
119
- name: 'Arthur Granado'
119
+ name: 'Doctor Who'
120
120
  }
121
- token = SmartCoin::Token.create(token_params)
121
+ token = Smartcoin::Token.create(token_params)
122
122
  charge_params = {
123
123
  amount: 1000,
124
124
  currency: 'brl',
125
125
  card: token.id
126
126
  }
127
127
 
128
- charge_created = SmartCoin::Charge.create(charge_params)
128
+ charge_created = Smartcoin::Charge.create(charge_params)
129
129
  expect(charge_created.refunded).to be_falsey
130
130
 
131
131
  charge_created.refund()
@@ -140,16 +140,16 @@ describe SmartCoin::Charge do
140
140
  exp_month: 11,
141
141
  exp_year: 2017,
142
142
  cvc: '111',
143
- name: 'Arthur Granado'
143
+ name: 'Doctor Who'
144
144
  }
145
- token = SmartCoin::Token.create(token_params)
145
+ token = Smartcoin::Token.create(token_params)
146
146
  charge_params = {
147
147
  amount: 1000,
148
148
  currency: 'brl',
149
149
  card: token.id
150
150
  }
151
151
 
152
- charge_created = SmartCoin::Charge.create(charge_params)
152
+ charge_created = Smartcoin::Charge.create(charge_params)
153
153
  expect(charge_created.refunded).to be_falsey
154
154
 
155
155
  amount_refunded = 600
@@ -163,10 +163,10 @@ describe SmartCoin::Charge do
163
163
 
164
164
  it 'should list charges that have already created' do
165
165
  params = {count: 3}
166
- charge_list = SmartCoin::Charge.list_all(params)
166
+ charge_list = Smartcoin::Charge.list_all(params)
167
167
  expect(charge_list.object).to eq('list')
168
168
  expect(charge_list.count).to eq(3)
169
169
  expect(charge_list.data.size).to eq(3)
170
- expect(charge_list.data[0].class).to eq(SmartCoin::Charge)
170
+ expect(charge_list.data[0].class).to eq(Smartcoin::Charge)
171
171
  end
172
172
  end
@@ -0,0 +1,62 @@
1
+ require_relative '../rspec_helper'
2
+
3
+ describe Smartcoin::Customer do
4
+ before(:each) do
5
+ Smartcoin.api_key('pk_test_3ac0794848c339')
6
+ Smartcoin.api_secret('sk_test_8bec997b7a0ea1')
7
+ end
8
+
9
+ it 'should create a customer' do
10
+ customer_params = {email: "test_#{SecureRandom.hex(5)}@domain.com"}
11
+ customer = Smartcoin::Customer.create(customer_params)
12
+ expect(customer.email).to eq(customer_params[:email])
13
+ expect(customer.default_card).to be_nil
14
+ end
15
+
16
+ it 'should retrieve a customer by id' do
17
+ customer_params = {email: "test_#{SecureRandom.hex(5)}@domain.com"}
18
+ customer = Smartcoin::Customer.create(customer_params)
19
+ retrieved_customer = Smartcoin::Customer.retrieve(customer.id)
20
+ expect(retrieved_customer.email).to eq(customer_params[:email])
21
+ expect(retrieved_customer.to_s).to eq(customer.to_s)
22
+ end
23
+
24
+ it 'should retrieve a customer by email' do
25
+ customer_params = {email: "test_#{SecureRandom.hex(5)}@domain.com"}
26
+ customer = Smartcoin::Customer.create(customer_params)
27
+ retrieved_customer = Smartcoin::Customer.retrieve(customer.email)
28
+ expect(retrieved_customer.email).to eq(customer_params[:email])
29
+ expect(retrieved_customer.to_s).to eq(customer.to_s)
30
+ end
31
+
32
+ it 'should update a customer' do
33
+ token_params = {number: 4242424242424242,
34
+ exp_month: 5,
35
+ exp_year: 2017,
36
+ cvc: '011',
37
+ name: 'Doctor Who'
38
+ }
39
+ token = Smartcoin::Token.create(token_params)
40
+
41
+ customer_params = {email: "test_#{SecureRandom.hex(5)}@domain.com"}
42
+ customer = Smartcoin::Customer.create(customer_params)
43
+ customer.card = token.id
44
+ customer.save()
45
+ expect(customer.default_card).to eq(token.card.id)
46
+ expect(customer.cards.data.size).to eq(1)
47
+ end
48
+
49
+ it 'should list existing customers' do
50
+ customer_list = Smartcoin::Customer.list_all
51
+ expect(customer_list.object).to eq('list')
52
+ expect(customer_list.data.size).to be >= 1
53
+ end
54
+
55
+ it 'should delete a customer' do
56
+ customer_params = {email: "test_#{SecureRandom.hex(5)}@domain.com"}
57
+ customer = Smartcoin::Customer.create(customer_params)
58
+ deleted_customer = customer.delete
59
+ expect(deleted_customer['id']).to eq(customer.id)
60
+ expect(deleted_customer['deleted']).to be_truthy
61
+ end
62
+ end
@@ -0,0 +1,55 @@
1
+ require_relative '../rspec_helper'
2
+
3
+ describe Smartcoin::Plan do
4
+ before(:each) do
5
+ Smartcoin.api_key('pk_test_407d1f51a61756')
6
+ Smartcoin.api_secret('sk_test_86e4486a0078b2')
7
+ end
8
+
9
+ let(:plan_params) {plan_params = { id: "plan_#{SecureRandom.hex(5)}", amount: 1000, currency: 'brl', interval:'month', name: "Smartcoin Plan" }}
10
+
11
+ it 'should create a plan' do
12
+ plan = Smartcoin::Plan.create(plan_params)
13
+ expect(plan.id).to eq(plan_params[:id])
14
+ expect(plan.amount).to eq(plan_params[:amount])
15
+ expect(plan.currency).to eq(plan_params[:currency])
16
+ expect(plan.interval).to eq(plan_params[:interval])
17
+ expect(plan.name).to eq(plan_params[:name])
18
+ end
19
+
20
+ it 'should retrieve an existing plan' do
21
+ Smartcoin::Plan.create(plan_params)
22
+ plan = Smartcoin::Plan.retrieve(plan_params[:id])
23
+ expect(plan.id).to eq(plan_params[:id])
24
+ expect(plan.amount).to eq(plan_params[:amount])
25
+ expect(plan.currency).to eq(plan_params[:currency])
26
+ expect(plan.interval).to eq(plan_params[:interval])
27
+ expect(plan.name).to eq(plan_params[:name])
28
+ end
29
+
30
+ it 'should update a existing plan' do
31
+ Smartcoin::Plan.create(plan_params)
32
+ expect(Smartcoin::Plan.new.serialize_params).to eq([:name])
33
+
34
+ plan = Smartcoin::Plan.retrieve(plan_params[:id])
35
+ plan.name = "New Smartcoin plan name"
36
+ plan.save
37
+ plan_updated = Smartcoin::Plan.retrieve(plan_params[:id])
38
+ expect(plan.name).to eq(plan_updated.name)
39
+ expect(plan.name).to eq("New Smartcoin plan name")
40
+ expect(plan_updated.name).to eq("New Smartcoin plan name")
41
+ end
42
+
43
+ it 'should list existing plans' do
44
+ plan_list = Smartcoin::Plan.list_all
45
+ expect(plan_list.object).to eq('list')
46
+ expect(plan_list.data.size).to be >= 1
47
+ end
48
+
49
+ it 'should delete existing plan' do
50
+ plan = Smartcoin::Plan.create(plan_params)
51
+ deleted_plan = plan.delete
52
+ expect(deleted_plan['id']).to eq(plan.id)
53
+ expect(deleted_plan['deleted']).to be_truthy
54
+ end
55
+ end
@@ -1,6 +1,6 @@
1
1
  require 'rspec'
2
2
 
3
- describe SmartCoin::Shipping do
3
+ describe Smartcoin::Shipping do
4
4
 
5
5
  it 'should calculate a shipping cost (destination_cep 36.600-000)' do
6
6
  weight = 0.2 # Kg
@@ -8,7 +8,7 @@ describe SmartCoin::Shipping do
8
8
  destination_cep = 36600000 #MG - Bicas
9
9
  expect_shipping_cost = 1650 #the current value that correios charge for PAC service without deal
10
10
 
11
- shipping_info = SmartCoin::Shipping.calculator(weight: weight, origin_cep: origin_cep, destination_cep: destination_cep)
11
+ shipping_info = Smartcoin::Shipping.calculator(weight: weight, origin_cep: origin_cep, destination_cep: destination_cep)
12
12
  expect(shipping_info[:amount]).to eq(expect_shipping_cost)
13
13
  end
14
14
 
@@ -18,7 +18,7 @@ describe SmartCoin::Shipping do
18
18
  destination_cep = 24230153 #RJ - Niterói - Icaraí
19
19
  expect_shipping_cost = 1370 #the current value that correios charge for PAC service without deal
20
20
 
21
- shipping_info = SmartCoin::Shipping.calculator(weight: weight, origin_cep: origin_cep, destination_cep: destination_cep)
21
+ shipping_info = Smartcoin::Shipping.calculator(weight: weight, origin_cep: origin_cep, destination_cep: destination_cep)
22
22
  expect(shipping_info[:amount]).to eq(expect_shipping_cost)
23
23
  end
24
24
  end
@@ -1,44 +1,44 @@
1
1
  require_relative '../rspec_helper'
2
2
 
3
- describe SmartCoin do
3
+ describe Smartcoin do
4
4
 
5
5
  it 'should set api key' do
6
- SmartCoin.api_key('pk_test_1234')
7
- SmartCoin.api_secret('')
8
- expect(SmartCoin.access_keys).to eq('pk_test_1234:')
6
+ Smartcoin.api_key('pk_test_1234')
7
+ Smartcoin.api_secret('')
8
+ expect(Smartcoin.access_keys).to eq('pk_test_1234:')
9
9
  end
10
10
 
11
11
  it 'should set api secret' do
12
- SmartCoin.api_key('')
13
- SmartCoin.api_secret('sk_test_1234')
14
- expect(SmartCoin.access_keys).to eq(':sk_test_1234')
12
+ Smartcoin.api_key('')
13
+ Smartcoin.api_secret('sk_test_1234')
14
+ expect(Smartcoin.access_keys).to eq(':sk_test_1234')
15
15
  end
16
16
 
17
17
  it 'should get empty access keys' do
18
- SmartCoin.api_key('')
19
- SmartCoin.api_secret('')
20
- expect(SmartCoin.access_keys).to eq(":")
18
+ Smartcoin.api_key('')
19
+ Smartcoin.api_secret('')
20
+ expect(Smartcoin.access_keys).to eq(":")
21
21
  end
22
22
 
23
- describe SmartCoin::SmartCoinObject do
23
+ describe Smartcoin::SmartcoinObject do
24
24
  it 'should convert to hash' do
25
25
  params_2 = {a: 1, b: 'b'}
26
- params = {a: 'a', b: 'b', c: 1, d: SmartCoin::SmartCoinObject.create_from(params_2), e:[a: 'a', b: 1, c: SmartCoin::SmartCoinObject.create_from(params_2)]}
27
- obj = SmartCoin::SmartCoinObject.create_from(params)
26
+ params = {a: 'a', b: 'b', c: 1, d: Smartcoin::SmartcoinObject.create_from(params_2), e:[a: 'a', b: 1, c: Smartcoin::SmartcoinObject.create_from(params_2)]}
27
+ obj = Smartcoin::SmartcoinObject.create_from(params)
28
28
  expect(obj.to_hash).to eq(params.merge({d: params_2, e: [a: 'a', b: 1, c: params_2]}))
29
29
  end
30
30
 
31
31
  it 'should convert to json' do
32
32
  params_2 = {a: 1, b: 'b'}
33
- params = {a: 'a', b: 'b', c: 1, d: SmartCoin::SmartCoinObject.create_from(params_2), e:[a: 'a', b: 1, c: SmartCoin::SmartCoinObject.create_from(params_2)]}
34
- obj = SmartCoin::SmartCoinObject.create_from(params)
33
+ params = {a: 'a', b: 'b', c: 1, d: Smartcoin::SmartcoinObject.create_from(params_2), e:[a: 'a', b: 1, c: Smartcoin::SmartcoinObject.create_from(params_2)]}
34
+ obj = Smartcoin::SmartcoinObject.create_from(params)
35
35
  expect(obj.to_json).to eq(params.to_json)
36
36
  end
37
37
 
38
38
  it 'should convert to stirng' do
39
39
  params_2 = {a: 1, b: 'b'}
40
- params = {a: 'a', b: 'b', c: 1, d: SmartCoin::SmartCoinObject.create_from(params_2), e:[a: 'a', b: 1, c: SmartCoin::SmartCoinObject.create_from(params_2)]}
41
- obj = SmartCoin::SmartCoinObject.create_from(params)
40
+ params = {a: 'a', b: 'b', c: 1, d: Smartcoin::SmartcoinObject.create_from(params_2), e:[a: 'a', b: 1, c: Smartcoin::SmartcoinObject.create_from(params_2)]}
41
+ obj = Smartcoin::SmartcoinObject.create_from(params)
42
42
  expect(obj.to_s).to eq(params.to_json.to_s)
43
43
  end
44
44
  end
@@ -0,0 +1,72 @@
1
+ require_relative '../rspec_helper'
2
+
3
+ describe Smartcoin::Subscription do
4
+ let(:plan_params) {plan_params = { id: "plan_#{SecureRandom.hex(5)}", amount: 1000, currency: 'brl', interval:'month', name: "Smartcoin Plan" }}
5
+ let(:plan_2_params) { { id: "plan_#{SecureRandom.hex(5)}", amount: 1000, currency: 'brl', interval:'week', name: "Smartcoin Week Plan" }}
6
+ let(:customer_params) { {email: "test_#{SecureRandom.hex(5)}@domain.com", card: {number: 4242424242424242, exp_month: 5, exp_year: 2017, cvc: '011', name: 'Doctor Who'} } }
7
+
8
+ before(:each) do
9
+ Smartcoin.api_key('pk_test_3ac0794848c339')
10
+ Smartcoin.api_secret('sk_test_8bec997b7a0ea1')
11
+
12
+ @plan = Smartcoin::Plan.create(plan_params)
13
+ @customer = Smartcoin::Customer.create(customer_params)
14
+ end
15
+
16
+ it 'should create a Subscription' do
17
+ customer = Smartcoin::Customer.retrieve(@customer.id)
18
+ sub = customer.subscriptions.create({plan: @plan.id})
19
+ expect(sub.plan.id).to eq(@plan.id)
20
+ expect(sub.customer).to eq(@customer.id)
21
+ expect(sub.status).to eq('active')
22
+ end
23
+
24
+ it 'should retrieve a subscription' do
25
+ customer = Smartcoin::Customer.retrieve(@customer.id)
26
+ sub = customer.subscriptions.create({plan: @plan.id})
27
+ retrieved_sub = customer.subscriptions.retrieve(sub.id)
28
+ expect(retrieved_sub.id).to eq(sub.id)
29
+ end
30
+
31
+ it 'should delete a subscription' do
32
+ customer = Smartcoin::Customer.retrieve(@customer.id)
33
+ sub = customer.subscriptions.create({plan: @plan.id})
34
+ sub.delete
35
+ expect(sub.status).to eq('canceled')
36
+ end
37
+
38
+ it 'should update a subscription plan' do
39
+ plan_2 = Smartcoin::Plan.create(plan_2_params)
40
+
41
+ customer = Smartcoin::Customer.retrieve(@customer.id)
42
+ sub = customer.subscriptions.create({plan: @plan.id})
43
+ sub.plan = plan_2.id
44
+ sub.save
45
+
46
+ expect(sub.plan.name).to eq(plan_2_params[:name])
47
+ expect(sub.plan.id).to eq(plan_2_params[:id])
48
+ end
49
+
50
+ it 'should update a subscription quantity' do
51
+ customer = Smartcoin::Customer.retrieve(@customer.id)
52
+ sub = customer.subscriptions.create({plan: @plan.id})
53
+ sub.quantity = 3
54
+ sub.save
55
+
56
+ expect(sub.quantity).to eq(3)
57
+ end
58
+
59
+ it 'should list customer subscriptions' do
60
+ customer = Smartcoin::Customer.retrieve(@customer.id)
61
+ customer.subscriptions.create({plan: @plan.id})
62
+ list = customer.subscriptions.list_all
63
+ expect(list.object).to eq('list')
64
+ expect(list.data.size).to eq(1)
65
+ end
66
+
67
+ it 'should list all account subscriptions' do
68
+ list = Smartcoin::Subscription.list_all
69
+ expect(list.object).to eq('list')
70
+ expect(list.data.size).to be >= 1
71
+ end
72
+ end
@@ -1,21 +1,21 @@
1
1
  require_relative '../rspec_helper'
2
2
 
3
- describe SmartCoin::Token do
3
+ describe Smartcoin::Token do
4
4
 
5
5
  it 'should call API to create a Token' do
6
- SmartCoin.api_key('pk_test_3ac0794848c339')
6
+ Smartcoin.api_key('pk_test_3ac0794848c339')
7
7
  token_params = {number: 4242424242424242,
8
- exp_month: 11,
8
+ exp_month: 5,
9
9
  exp_year: 2017,
10
- cvc: '111',
11
- name: 'Arthur Granado'
10
+ cvc: '011',
11
+ name: 'Doctor Who'
12
12
  }
13
13
 
14
- token = SmartCoin::Token.create(token_params)
14
+ token = Smartcoin::Token.create(token_params)
15
15
  expect(token.id).to match(/tok_(.)/)
16
16
  expect(token.object).to eq('token')
17
- expect(token.card.exp_month).to eq(11)
17
+ expect(token.card.exp_month).to eq(5)
18
18
  expect(token.card.exp_year).to eq(2017)
19
- expect(token.card.name).to eq('Arthur Granado')
19
+ expect(token.card.name).to eq('Doctor Who')
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartcoin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Granado
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-17 00:00:00.000000000 Z
11
+ date: 2015-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.7'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.6.7
22
+ version: '1.7'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.6'
29
+ version: '1.7'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.6.7
32
+ version: '1.7'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -50,40 +50,40 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '10.3'
53
+ version: '10.4'
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 10.3.0
56
+ version: '10.4'
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '10.3'
63
+ version: '10.4'
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
- version: 10.3.0
66
+ version: '10.4'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: rspec
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: '2.14'
73
+ version: '3.1'
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 2.14.0
76
+ version: '3.1'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '2.14'
83
+ version: '3.1'
84
84
  - - ">="
85
85
  - !ruby/object:Gem::Version
86
- version: 2.14.0
86
+ version: '3.1'
87
87
  description: Ruby library to SmartCoin API - https://smartcoin.com.br
88
88
  email:
89
89
  - agranado@smartcoin.com.br
@@ -94,6 +94,7 @@ files:
94
94
  - ".gitignore"
95
95
  - ".ruby-gemset"
96
96
  - ".ruby-version"
97
+ - ".travis.yml"
97
98
  - Gemfile
98
99
  - LICENSE.txt
99
100
  - README.md
@@ -102,18 +103,22 @@ files:
102
103
  - lib/data/ssl-bundle.crt
103
104
  - lib/smartcoin.rb
104
105
  - lib/smartcoin/api_operations/create.rb
106
+ - lib/smartcoin/api_operations/delete.rb
105
107
  - lib/smartcoin/api_operations/list.rb
106
108
  - lib/smartcoin/api_operations/retrieve.rb
107
109
  - lib/smartcoin/api_operations/update.rb
108
110
  - lib/smartcoin/api_resource.rb
109
111
  - lib/smartcoin/card.rb
110
112
  - lib/smartcoin/charge.rb
111
- - lib/smartcoin/errors/smart_coin_error.rb
113
+ - lib/smartcoin/customer.rb
114
+ - lib/smartcoin/errors/smartcoin_error.rb
112
115
  - lib/smartcoin/fee.rb
113
116
  - lib/smartcoin/installment.rb
117
+ - lib/smartcoin/plan.rb
114
118
  - lib/smartcoin/refund.rb
115
119
  - lib/smartcoin/shipping.rb
116
- - lib/smartcoin/smart_coin_object.rb
120
+ - lib/smartcoin/smartcoin_object.rb
121
+ - lib/smartcoin/subscription.rb
117
122
  - lib/smartcoin/token.rb
118
123
  - lib/smartcoin/util.rb
119
124
  - lib/smartcoin/version.rb
@@ -122,8 +127,11 @@ files:
122
127
  - test/smartcoin/api_resource_spec.rb
123
128
  - test/smartcoin/card_spec.rb
124
129
  - test/smartcoin/charge_spec.rb
130
+ - test/smartcoin/customer_spec.rb
131
+ - test/smartcoin/plan_spec.rb
125
132
  - test/smartcoin/shipping_calculator_spec.rb
126
133
  - test/smartcoin/smart_coin_spec.rb
134
+ - test/smartcoin/subscription_spec.rb
127
135
  - test/smartcoin/token_spec.rb
128
136
  homepage: https://smartcoin.com.br
129
137
  licenses:
@@ -154,6 +162,9 @@ test_files:
154
162
  - test/smartcoin/api_resource_spec.rb
155
163
  - test/smartcoin/card_spec.rb
156
164
  - test/smartcoin/charge_spec.rb
165
+ - test/smartcoin/customer_spec.rb
166
+ - test/smartcoin/plan_spec.rb
157
167
  - test/smartcoin/shipping_calculator_spec.rb
158
168
  - test/smartcoin/smart_coin_spec.rb
169
+ - test/smartcoin/subscription_spec.rb
159
170
  - test/smartcoin/token_spec.rb