linx_microvix 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +5 -0
- data/README.md +0 -0
- data/lib/linx_microvix.rb +15 -0
- data/lib/linx_microvix/config.rb +10 -0
- data/lib/linx_microvix/errors.rb +6 -0
- data/lib/linx_microvix/errors/linx_microvix_error.rb +7 -0
- data/lib/linx_microvix/request.rb +41 -0
- data/lib/linx_microvix/version.rb +4 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5fa32495852c358306368f4d278a59ec02ce3d61
|
4
|
+
data.tar.gz: a9620562786ccb294db72a91eca523d62954755d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9c9f0caa7735b4e9100fcc23a283c99135c257bb56187c0cbbace2fb4d92fd737a06b22b50b290d9ffaec53561a68c3b1342e2c91f1d215af9d8308b556c3162
|
7
|
+
data.tar.gz: a06963abd23282ea2d9fc55fa8f13a03e9291900fbfa4356cbbf31c197c017191db95002cf2d108624e6d6c030f76a76fcd1dc0beb608effae44dba32a138291
|
data/Gemfile
ADDED
data/README.md
ADDED
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'typhoeus'
|
4
|
+
|
5
|
+
require 'linx_microvix/config'
|
6
|
+
require 'linx_microvix/errors'
|
7
|
+
require 'linx_microvix/request'
|
8
|
+
require 'linx_microvix/version'
|
9
|
+
|
10
|
+
# lib/linx_microvix
|
11
|
+
module LinxMicrovix
|
12
|
+
def self.configure
|
13
|
+
yield Config
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module LinxMicrovix
|
4
|
+
# lib/linx_microvix/request.rb
|
5
|
+
class Request
|
6
|
+
def initialize(command_name, parameters, response_format = 'csv')
|
7
|
+
@command_name = command_name
|
8
|
+
@parameters = parameters
|
9
|
+
@response_format = response_format
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
url = 'http://webapi.microvix.com.br/1.0/api/integracao'
|
14
|
+
Typhoeus::Request.new(url, method: :post, body: body_request).run
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def authenticate
|
20
|
+
config = LinxMicrovix::Config
|
21
|
+
"<Authentication user=\"#{config.user}\" password=\"#{config.pass}\"/>"
|
22
|
+
end
|
23
|
+
|
24
|
+
def build_parameters(parameters)
|
25
|
+
parameters.each_with_object('') do |(key, value), parameters_string|
|
26
|
+
parameters_string << "<Parameter id=\"#{key}\">#{value}</Parameter>"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def body_request
|
31
|
+
'<LinxMicrovix>'\
|
32
|
+
"#{authenticate}"\
|
33
|
+
"<ResponseFormat>#{@response_format}</ResponseFormat>"\
|
34
|
+
'<Command>'\
|
35
|
+
"<Name>#{@command_name}</Name>"\
|
36
|
+
"<Parameters>#{build_parameters(@parameters)}</Parameters>"\
|
37
|
+
'</Command>'\
|
38
|
+
'</LinxMicrovix>'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: linx_microvix
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paulo Henrique Bruce
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: typhoeus
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
description: This gem is prepared to integrate with Linx Microvix
|
42
|
+
email:
|
43
|
+
- brucepaulohenrique@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- Gemfile
|
49
|
+
- README.md
|
50
|
+
- lib/linx_microvix.rb
|
51
|
+
- lib/linx_microvix/config.rb
|
52
|
+
- lib/linx_microvix/errors.rb
|
53
|
+
- lib/linx_microvix/errors/linx_microvix_error.rb
|
54
|
+
- lib/linx_microvix/request.rb
|
55
|
+
- lib/linx_microvix/version.rb
|
56
|
+
homepage: https://github.com/phbruce/linx_microvix
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 1.3.6
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.4.8
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Ruby interface for the Linx Microvix API
|
80
|
+
test_files: []
|