touggsl 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require 'touggsl'
2
3
  require 'json'
3
4
  require 'touggsl/request_helpers'
@@ -53,7 +54,7 @@ class Touggsl::Customer
53
54
 
54
55
  status = json["status"]
55
56
  if status == "206"
56
- return "Plano ja contratado para o cliente informado."
57
+ return "Plano ja contratado ou ID do plano informado nao existe."
57
58
  else
58
59
  json["data"].each do |d|
59
60
  return d["data"]["link_boleto"]
@@ -3,8 +3,8 @@ require 'httparty'
3
3
  module Touggsl
4
4
  module RequestHelper
5
5
  extend self
6
-
7
- attr_reader :auth
6
+
7
+ attr_reader :auth
8
8
  ##
9
9
  # Authenticate user in superlogica.
10
10
  #
@@ -17,7 +17,7 @@ module Touggsl
17
17
  # * A valid json with response
18
18
  #
19
19
  # ==== Example
20
- # In order to authenticate you shoulid call
20
+ # In order to authenticate you should call
21
21
  # this method with following params:
22
22
  #
23
23
  # do_request("email@email.com", "password")
@@ -27,17 +27,16 @@ module Touggsl
27
27
  response = HTTParty.post("#{Touggsl.get_uri}auth/post",
28
28
  body: {username: "#{username}",
29
29
  password: "#{password}"},
30
-
31
30
  :headers => {'Cookie' => r.headers['Set-Cookie']})
32
31
  response
33
32
  end
34
33
 
35
34
  def create_client(id, nome, nome_fantasia, email = nil, endereco = nil, numero = nil, bairro = nil, cidade = nil, estado = nil, cep = nil, dia_vencimento_sac =0)
36
- HTTParty.post("#{Touggsl.get_uri}sacados/put",
35
+ HTTParty.post("#{Touggsl.get_uri}sacados/put",
37
36
  :body => {'ST_SINCRO_SAC' => id,
38
- 'ST_NOME_SAC' => nome,
39
- 'ST_NOMEREF_SAC' => nome_fantasia,
40
- 'ST_EMAIL_SAC' => email,
37
+ 'ST_NOME_SAC' => nome,
38
+ 'ST_NOMEREF_SAC' => nome_fantasia,
39
+ 'ST_EMAIL_SAC' => email,
41
40
  'ST_DIAVENCIMENTO_SAC' => dia_vencimento_sac,
42
41
  'ST_ENDERECO_SAC' => endereco,
43
42
  'ST_ESTADO_SAC' => estado,
@@ -47,11 +46,11 @@ module Touggsl
47
46
  'ST_BAIRRO_SAC' => bairro},
48
47
  :headers => {'Cookie' => auth.get_cookie})
49
48
  end
50
-
49
+
51
50
  ##
52
51
  # Hiring a plan.
53
52
  #
54
- # This method expect that you create the plan in Superlogica plataform.
53
+ # This method expect that you create the plan in Superlogica plataform.
55
54
  #
56
55
  # === Params
57
56
  # * <tt>plan_id</tt> - the id of the plan in Superlogica
@@ -64,17 +63,18 @@ module Touggsl
64
63
  #
65
64
  def hiring_plan_for_client(plan_id, client_id, id_contrato, notification=0, quantidade_parcelas_adesao=1, forma_pagamento)
66
65
  hiring_at = Time.now.strftime('%m/%d/%Y')
67
- HTTParty.post("#{Touggsl.get_uri}planosclientes/put",
68
- :body => {'PLANOS' => {1 => {'identificador' => client_id,
69
- 'ID_PLANO_PLA' => plan_id,
66
+ HTTParty.post("#{Touggsl.get_uri}planosclientes/put",
67
+ :body => {'PLANOS' => {1 => {'identificador' => client_id,
68
+ 'ID_PLANO_PLA' => plan_id,
70
69
  'DT_CONTRATO_PLC' => hiring_at,
71
- 'ST_IDENTIFICADOR_PLC' => id_contrato,
72
- 'FL_NOTIFICARCLIENTE' => notification,
70
+ 'ST_IDENTIFICADOR_PLC' => id_contrato,
71
+ 'FL_NOTIFICARCLIENTE' => notification,
73
72
  'QUANT_PARCELAS_ADESAO' => quantidade_parcelas_adesao,
74
- 'ID_FORMAPAGAMENTO_RECB' => forma_pagamento}}},
73
+ 'ID_FORMAPAGAMENTO_RECB' => forma_pagamento}}},
75
74
  :headers => {'Cookie' => auth.get_cookie })
76
-
75
+
77
76
  end
77
+
78
78
  ##
79
79
  # include the authenticator in order to use in future requests
80
80
  #
@@ -84,41 +84,41 @@ module Touggsl
84
84
  #
85
85
  #
86
86
  def include_auth_to_requests(auth)
87
- @auth = auth
87
+ @auth = auth
88
88
  end
89
89
 
90
90
  def get_clients_inadimplementes
91
91
  today = Time.now.strftime('%m/%d/%Y')
92
92
  HTTParty.get("#{Touggsl.get_uri}inadimplencia/index",
93
93
  :body => {'posicaoEm' => today}, :headers => {'Cookie' => auth.get_cookie})
94
-
94
+
95
95
  end
96
-
96
+
97
97
  def checks_if_client_is_inadimplente(client_id)
98
98
  today = Time.now.strftime("%m/%d/%Y")
99
- HTTParty.post("#{Touggsl.get_uri}inadimplencia/index",
99
+ HTTParty.post("#{Touggsl.get_uri}inadimplencia/index",
100
100
  :body => {'identificador' => client_id, 'posicaoEm' => today}, :headers => {'Cookie' => auth.get_cookie})
101
101
  end
102
-
102
+
103
103
  def get_2via_link(client_id)
104
104
  today = Time.now.strftime("%m/%d/%Y")
105
- HTTParty.post("#{Touggsl.get_uri}inadimplencia/index",
105
+ HTTParty.post("#{Touggsl.get_uri}inadimplencia/index",
106
106
  :body => {'identificador' => client_id, 'posicaoEm' => today}, :headers => {'Cookie' => auth.get_cookie})
107
107
  end
108
-
108
+
109
109
  def get_2via_link_normal_client(client_id)
110
110
  HTTParty.post("#{Touggsl.get_uri}cobranca/index", :body => {'identificador' => client_id}, :headers => {'Cookie' => auth.get_cookie})
111
111
  end
112
-
112
+
113
113
  def billings_request(client_id, status)
114
- HTTParty.post("#{Touggsl.get_uri}cobranca/index",
114
+ HTTParty.post("#{Touggsl.get_uri}cobranca/index",
115
115
  :body => {'identificador' => client_id, 'status' => status},
116
116
  :headers => {'Cookie' => auth.get_cookie})
117
117
  end
118
-
118
+
119
119
  def pay_request(pay_id, value)
120
120
  date = Time.now.strftime('%m/%d/%Y')
121
- HTTParty.post("#{Touggsl.get_uri}cobranca/liquidar",
121
+ HTTParty.post("#{Touggsl.get_uri}cobranca/liquidar",
122
122
  :body => {'ID_RECEBIMENTO_RECB' => pay_id,
123
123
  'VL_EMITIDO_RECB' => value,
124
124
  'VL_DEVIDO' => value,
@@ -134,9 +134,9 @@ module Touggsl
134
134
  'ID_CONTA_CB' => 1},
135
135
  :headers => {'Cookie' => auth.get_cookie})
136
136
  end
137
-
137
+
138
138
  def new_billing_request(client_id, data_vencimento, product_id, value, account_id)
139
- HTTParty.post("#{Touggsl.get_uri}cobranca/put",
139
+ HTTParty.post("#{Touggsl.get_uri}cobranca/put",
140
140
  :body => {'COMPO_RECEBIMENTO' => {0 => {'ID_PRODUTO_PRD' => product_id, 'ST_DESCRICAO_PRD' => product_id, 'NM_QUANTIDADE_PRD' => '1', 'VL_UNITARIO_PRD' => value, 'ST_VALOR_COMP' => value}},
141
141
  'identificador' => client_id,
142
142
  'DT_VENCIMENTO_RECB' => data_vencimento,
@@ -144,4 +144,4 @@ module Touggsl
144
144
  :headers => {'Cookie' => auth.get_cookie})
145
145
  end
146
146
  end
147
- end
147
+ end
@@ -1,3 +1,3 @@
1
1
  module Touggsl
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
@@ -64,7 +64,7 @@ Time.stubs(:now).returns(Time.mktime(2013,11,03))
64
64
  contract_id = 1000
65
65
  forma_pagamento = 0
66
66
  plan = @client.hiring_plan(plan_id, client_id, contract_id, forma_pagamento)
67
- assert_equal "Plano ja contratado para o cliente informado.", plan
67
+ assert_equal "Plano ja contratado ou ID do plano informado nao existe", plan
68
68
  end
69
69
 
70
70
  def test_get_inadimplmentes
@@ -2,15 +2,14 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: touggsl 0.8.1 ruby lib
6
5
 
7
6
  Gem::Specification.new do |s|
8
7
  s.name = "touggsl"
9
- s.version = "0.8.1"
8
+ s.version = "0.8.2"
10
9
 
11
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
11
  s.authors = ["Edipo Luis Federle", "Dyan Carlos Carra"]
13
- s.date = "2013-12-30"
12
+ s.date = "2014-05-14"
14
13
  s.description = "Ruby code to access superlogica API"
15
14
  s.email = ["edipofederle@gmail.com", "dyancarra@gmail.com"]
16
15
  s.executables = ["touggsl"]
@@ -45,11 +44,11 @@ Gem::Specification.new do |s|
45
44
  s.homepage = "http://github.com/tougg/touggsl"
46
45
  s.licenses = ["MIT"]
47
46
  s.require_paths = ["lib"]
48
- s.rubygems_version = "2.1.11"
47
+ s.rubygems_version = "1.8.23"
49
48
  s.summary = "Ruby code to access superlogica API"
50
49
 
51
50
  if s.respond_to? :specification_version then
52
- s.specification_version = 4
51
+ s.specification_version = 3
53
52
 
54
53
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
54
  s.add_development_dependency(%q<shoulda>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: touggsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Edipo Luis Federle
@@ -9,11 +10,12 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-12-30 00:00:00.000000000 Z
13
+ date: 2014-05-14 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: shoulda
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - ! '>='
19
21
  - !ruby/object:Gem::Version
@@ -21,6 +23,7 @@ dependencies:
21
23
  type: :development
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - ! '>='
26
29
  - !ruby/object:Gem::Version
@@ -28,6 +31,7 @@ dependencies:
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: rdoc
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
36
  - - ~>
33
37
  - !ruby/object:Gem::Version
@@ -35,6 +39,7 @@ dependencies:
35
39
  type: :development
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
44
  - - ~>
40
45
  - !ruby/object:Gem::Version
@@ -42,6 +47,7 @@ dependencies:
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: httparty
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
52
  - - ! '>='
47
53
  - !ruby/object:Gem::Version
@@ -49,6 +55,7 @@ dependencies:
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
60
  - - ! '>='
54
61
  - !ruby/object:Gem::Version
@@ -56,6 +63,7 @@ dependencies:
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: mocha
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
68
  - - ! '>='
61
69
  - !ruby/object:Gem::Version
@@ -63,6 +71,7 @@ dependencies:
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
76
  - - ! '>='
68
77
  - !ruby/object:Gem::Version
@@ -70,6 +79,7 @@ dependencies:
70
79
  - !ruby/object:Gem::Dependency
71
80
  name: json
72
81
  requirement: !ruby/object:Gem::Requirement
82
+ none: false
73
83
  requirements:
74
84
  - - ! '>='
75
85
  - !ruby/object:Gem::Version
@@ -77,6 +87,7 @@ dependencies:
77
87
  type: :development
78
88
  prerelease: false
79
89
  version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
80
91
  requirements:
81
92
  - - ! '>='
82
93
  - !ruby/object:Gem::Version
@@ -84,6 +95,7 @@ dependencies:
84
95
  - !ruby/object:Gem::Dependency
85
96
  name: bundler
86
97
  requirement: !ruby/object:Gem::Requirement
98
+ none: false
87
99
  requirements:
88
100
  - - ~>
89
101
  - !ruby/object:Gem::Version
@@ -91,6 +103,7 @@ dependencies:
91
103
  type: :development
92
104
  prerelease: false
93
105
  version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
94
107
  requirements:
95
108
  - - ~>
96
109
  - !ruby/object:Gem::Version
@@ -98,6 +111,7 @@ dependencies:
98
111
  - !ruby/object:Gem::Dependency
99
112
  name: webmock
100
113
  requirement: !ruby/object:Gem::Requirement
114
+ none: false
101
115
  requirements:
102
116
  - - ! '>='
103
117
  - !ruby/object:Gem::Version
@@ -105,6 +119,7 @@ dependencies:
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
108
123
  requirements:
109
124
  - - ! '>='
110
125
  - !ruby/object:Gem::Version
@@ -112,6 +127,7 @@ dependencies:
112
127
  - !ruby/object:Gem::Dependency
113
128
  name: jeweler
114
129
  requirement: !ruby/object:Gem::Requirement
130
+ none: false
115
131
  requirements:
116
132
  - - ~>
117
133
  - !ruby/object:Gem::Version
@@ -119,6 +135,7 @@ dependencies:
119
135
  type: :development
120
136
  prerelease: false
121
137
  version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
122
139
  requirements:
123
140
  - - ~>
124
141
  - !ruby/object:Gem::Version
@@ -159,25 +176,29 @@ files:
159
176
  homepage: http://github.com/tougg/touggsl
160
177
  licenses:
161
178
  - MIT
162
- metadata: {}
163
179
  post_install_message:
164
180
  rdoc_options: []
165
181
  require_paths:
166
182
  - lib
167
183
  required_ruby_version: !ruby/object:Gem::Requirement
184
+ none: false
168
185
  requirements:
169
186
  - - ! '>='
170
187
  - !ruby/object:Gem::Version
171
188
  version: '0'
189
+ segments:
190
+ - 0
191
+ hash: 3780037907386466645
172
192
  required_rubygems_version: !ruby/object:Gem::Requirement
193
+ none: false
173
194
  requirements:
174
195
  - - ! '>='
175
196
  - !ruby/object:Gem::Version
176
197
  version: '0'
177
198
  requirements: []
178
199
  rubyforge_project:
179
- rubygems_version: 2.1.11
200
+ rubygems_version: 1.8.23
180
201
  signing_key:
181
- specification_version: 4
202
+ specification_version: 3
182
203
  summary: Ruby code to access superlogica API
183
204
  test_files: []
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- N2QzNTJmMjg4YmU1ZTU2MThkZGU5NDEzN2ZlN2U4NmFhZDE2OTY1ZA==
5
- data.tar.gz: !binary |-
6
- OTYyZWQ0MjQ0ZTlhMDc4N2EzYjNmMmQxMGZlYWRiYWZjMTliMDhjNg==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- ZDJlNDZkMTJkNGQwM2IxYzFjNTA0NWMxNzUyYmUzMDRhOWZjODc2N2NjOTc2
10
- MWYzYzkzYjc1ZTRmYzlmNzlkZmU4ZTY2OGQ4MWM4N2ExNmVkOTMwMmNkNTY1
11
- NGQxM2EzNmMyMTBkYzM2MGFhNzE5NjEzZjJlNDAyM2QyYzUxMzE=
12
- data.tar.gz: !binary |-
13
- OTU3MGYxNzMyZTNlNWEyNDE2NzA5ZDVkNDU2OGEwMzNlNDJkOWIxODhlMGE4
14
- YjRiN2QyM2RkODc4MDhmMzMzNWExNTU1MmE4OWIwNWQ0YjA5NDBmMjgxYTky
15
- MzVjY2E2MDExMzQyZjY4YTc5MDczNmJjYzkxZjUyZjFhNGMyNjY=