credigy 0.1.0 → 0.1.1

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: 8b8f333acad2906f210ab492a6d4a7957270c051
4
- data.tar.gz: 230622d4ac9ea9da97469a2cfe9c828da9883152
3
+ metadata.gz: 7ba7f66fbfadca72a2d40367d7cdbe100f37b762
4
+ data.tar.gz: 3643efc803a52c6691d45ee50e879dc9992d01f7
5
5
  SHA512:
6
- metadata.gz: fd312378cab085db1910c92273827c3b491bce24a646f29176f74202287e3eee45e1ad1dbfedfc7ebaed68fae00bfd178b7d3aaeb93dcd58daefa166f7d5bd10
7
- data.tar.gz: b6210e21cdb419820480a44c7a544077bb2cfbb59718ee459005e696f4afaf359ccb61d58c056e54d784e7d59c7fc88bc3b66476b8dbead051bc15a9965db221
6
+ metadata.gz: 7b196f7d956022a8b0546f56ba5e5169a6c7ccb8eb002033494f5f41630edd3d4f04289f50364bab0f4f4a8542f2689b093c20ad039f514a7d6ab18ca48ced58
7
+ data.tar.gz: c238cb68004c1c4f298cbd8167afe1a7005962d1681de6672653c3752684ce19ab17c9da6b1608d86a8f4031ad446b6952c29439c3e6260c0157a7802a6a7a51
@@ -1,3 +1,10 @@
1
+ ### 0.1.1 (17/10/2018)
2
+
3
+ * Levanta exception se o token gerado não estiver preenchido em `Login`
4
+ * Adiciona separador `;` nos parametros do tipo array em `GeneratePromise` e `GetCampaignNegotiation`
5
+ * Implementa `GetBoleto`
6
+ * Implementa `GetCampaignNegotiation`
7
+
1
8
  ### 0.1.0 (09/10/2018)
2
9
 
3
10
  * Cria a gem
data/README.md CHANGED
@@ -30,6 +30,8 @@ Ou instale você mesmo:
30
30
  - [AcceptLegalTerms](#acceptlegalterms)
31
31
  - [GeneratePromise](#generatepromise)
32
32
  - [GetAccounts](#getaccounts)
33
+ - [GetBoleto](#getboleto)
34
+ - [GetCampaignNegotiation](#getcampaignnegotiation)
33
35
  - [GetEmails](#getemails)
34
36
  - [GetProviders](#getproviders)
35
37
  - [SaveEmail](#saveemail)
@@ -63,6 +65,20 @@ response = Credigy::Account.new(authorization_token).call
63
65
  response.all # array de contas
64
66
  ```
65
67
 
68
+ ### GetBoleto
69
+
70
+ ```ruby
71
+ response = Credigy::Boleto.new(authorization_token, debtor_agreement_id: '123', installment_number: '2').call
72
+ response.pdf # pdf stream
73
+ ```
74
+
75
+ ### GetCampaignNegotiation
76
+
77
+ ```ruby
78
+ response = Credigy::CampaignNegotiation.new(authorization_token, owner_id: 'z', accounts: ['y'], provider_ids: ['x']).call
79
+ response.all # array de negociações possíveis
80
+ ```
81
+
66
82
  ### GetEmails
67
83
 
68
84
  ```ruby
@@ -97,11 +113,21 @@ end
97
113
 
98
114
  Se estiver no Rails, esse arquivo pode ser colocado em `config/initializers/credigy.rb`.
99
115
 
100
- ## Development
116
+ ## Desenvolvimento
117
+
118
+ ### Testes
119
+
120
+ `rake spec`
121
+
122
+ ### Console
123
+
124
+ `bundle console`
125
+
126
+ ### Release
101
127
 
102
- 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.
128
+ Atualize o número da versão em `version.rb` e rode:
103
129
 
104
- 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).
130
+ `bundle exec rake release`
105
131
 
106
132
  ## License
107
133
 
@@ -2,6 +2,8 @@ require "credigy/version"
2
2
 
3
3
  require "credigy/config"
4
4
  require "credigy/account"
5
+ require "credigy/boleto"
6
+ require "credigy/campaign_negotiation"
5
7
  require "credigy/email"
6
8
  require "credigy/email_creation"
7
9
  require "credigy/login"
@@ -0,0 +1,23 @@
1
+ require_relative './authorized'
2
+ require_relative './boleto_response'
3
+
4
+ module Credigy
5
+ class Boleto < Authorized
6
+ attr_reader :params
7
+
8
+ def initialize(authorization_token, **params)
9
+ @params = params
10
+ end
11
+
12
+ def operation
13
+ :get_boleto
14
+ end
15
+
16
+ def message
17
+ {
18
+ 'cred:debtorAgreementID' => params[:debtor_agreement_id],
19
+ 'cred:installmentNumber' => params[:installment_number]
20
+ }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,9 @@
1
+ require_relative './response'
2
+
3
+ module Credigy
4
+ class BoletoResponse < Response
5
+ def pdf
6
+ body[:boleto]
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ require_relative './authorized'
2
+ require_relative './campaign_negotiation_response'
3
+
4
+ module Credigy
5
+ class CampaignNegotiation < Authorized
6
+ attr_reader :params
7
+
8
+ def initialize(authorization_token, **params)
9
+ @authorization_token, @params = authorization_token, params
10
+ end
11
+
12
+ def operation
13
+ :get_campaign_negotiation
14
+ end
15
+
16
+ def message
17
+ {
18
+ 'cred:Ownerid' => params[:owner_id],
19
+ 'cred:Accounts' => Array(params[:accounts]).join(';'),
20
+ 'cred:Providers' => Array(params[:provider_ids]).join(';')
21
+ }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ require_relative './response'
2
+
3
+ module Credigy
4
+ class CampaignNegotiationResponse < Response
5
+ def all
6
+ Array(body[:campaign_negotiations][:campaign_negotiation])
7
+ end
8
+ end
9
+ end
@@ -7,7 +7,9 @@ module Credigy
7
7
  end
8
8
 
9
9
  def authorization_token
10
- body[:authorization_token]
10
+ return body[:authorization_token] if body[:authorization_token]
11
+
12
+ raise "Token não gerado: #{raw_response.body}"
11
13
  end
12
14
  end
13
15
  end
@@ -23,7 +23,7 @@ module Credigy
23
23
 
24
24
  def message
25
25
  {
26
- 'cred:Accounts' => params[:accounts],
26
+ 'cred:Accounts' => Array(params[:accounts]).join(';'),
27
27
  'cred:TotalInstallments' => params[:installments],
28
28
  'cred:FirstInstallmentDate' => params[:first_installment_date],
29
29
  'cred:TotalAgreementAmount' => params[:agreement_value]
@@ -1,3 +1,3 @@
1
1
  module Credigy
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credigy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glauco Custódio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-09 00:00:00.000000000 Z
11
+ date: 2018-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -103,6 +103,10 @@ files:
103
103
  - lib/credigy/account.rb
104
104
  - lib/credigy/account_response.rb
105
105
  - lib/credigy/authorized.rb
106
+ - lib/credigy/boleto.rb
107
+ - lib/credigy/boleto_response.rb
108
+ - lib/credigy/campaign_negotiation.rb
109
+ - lib/credigy/campaign_negotiation_response.rb
106
110
  - lib/credigy/config.rb
107
111
  - lib/credigy/email.rb
108
112
  - lib/credigy/email_creation.rb