bcn_ni 0.1.2 → 0.1.3

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
- SHA1:
3
- metadata.gz: 46ce55ab1e75e9aa52d55b74b5c362b82b87c17f
4
- data.tar.gz: b7f1c6ba5b6fc11a9fe20246675e0ff6d69ff3d0
2
+ SHA256:
3
+ metadata.gz: a1c4b383d91f4ad21fc044cdb93170c13cd097cf04f47d0eb973ad49cbb20030
4
+ data.tar.gz: a265fce14d08e714a372ba1f049f4fa5cb3c4b871c8cc83228c90a39f6b2de38
5
5
  SHA512:
6
- metadata.gz: 2a7378ec8532ea0232279ab86dfe13ba8dd50339cc978837170b22e4e350cd051aa5d4b35d4d1efa5074ea795bcb2c66a558c51798ed8c5f72037fe5b1947ae8
7
- data.tar.gz: 3e7368292e565c6d3a7c5ed7dc87183520da1256f698014de46bd6ae8d36873108e2031079bfb7f32732fc04ae18d7559ff6f50387c29d656003c1429e8353c4
6
+ metadata.gz: bcefbc683faa59247e875254834a524fc100797610e38c4d02052226953eb670376467cb02bf18dcc2015ff2275dcab9bc76bac435f2dc58fb71e04005c3c0fc
7
+ data.tar.gz: b9c7ef36a12e8072f01de2c024f31e0d98c5ebe80387c7ef13535fc7a2e3ecc7fb6a45af7b52b583fe390cea86e836e371710df474eebcf04e53134343c29089
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at TODO: Write your email address. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/MIT-LICENSE CHANGED
File without changes
data/README.md CHANGED
@@ -1,72 +1,85 @@
1
- # BcnNi
2
- This gem provides NIO (Córdoba oro Nicaragüense) versus USD (United States dollar) money exchange rates consuming the official Central Bank of Nicaragüa (BCN) SOAP Service
3
-
4
- ## Usage
5
- ```ruby
6
- # Returns the exchange rate for September 15th, 2017
7
- rate = BcnNi.exchange_day(2017,9,15)
8
- #
9
- # => 30.3537
10
-
11
- # Returns the exchange rate table for September, 2017
12
- table = BcnNi.exchange_month(2017,9)
13
- #
14
- # => [
15
- # {:date=>Fri, 01 Sep 2017, :value=>30.2969},
16
- # {:date=>Sat, 02 Sep 2017, :value=>30.301},
17
- # {:date=>Sun, 03 Sep 2017, :value=>30.305},
18
- # {:date=>Mon, 04 Sep 2017, :value=>30.3091},
19
- # {:date=>Tue, 05 Sep 2017, :value=>30.3131},
20
- # {:date=>Wed, 06 Sep 2017, :value=>30.3172},
21
- # {:date=>Thu, 07 Sep 2017, :value=>30.3212},
22
- # {:date=>Fri, 08 Sep 2017, :value=>30.3253},
23
- # {:date=>Sat, 09 Sep 2017, :value=>30.3293},
24
- # {:date=>Sun, 10 Sep 2017, :value=>30.3334},
25
- # {:date=>Mon, 11 Sep 2017, :value=>30.3374},
26
- # {:date=>Tue, 12 Sep 2017, :value=>30.3415},
27
- # {:date=>Wed, 13 Sep 2017, :value=>30.3455},
28
- # {:date=>Thu, 14 Sep 2017, :value=>30.3496},
29
- # {:date=>Fri, 15 Sep 2017, :value=>30.3537},
30
- # {:date=>Sat, 16 Sep 2017, :value=>30.3577},
31
- # {:date=>Sun, 17 Sep 2017, :value=>30.3618},
32
- # {:date=>Mon, 18 Sep 2017, :value=>30.3658},
33
- # {:date=>Tue, 19 Sep 2017, :value=>30.3699},
34
- # {:date=>Wed, 20 Sep 2017, :value=>30.374},
35
- # {:date=>Thu, 21 Sep 2017, :value=>30.378},
36
- # {:date=>Fri, 22 Sep 2017, :value=>30.3821},
37
- # {:date=>Sat, 23 Sep 2017, :value=>30.3861},
38
- # {:date=>Sun, 24 Sep 2017, :value=>30.3902},
39
- # {:date=>Mon, 25 Sep 2017, :value=>30.3943},
40
- # {:date=>Tue, 26 Sep 2017, :value=>30.3983},
41
- # {:date=>Wed, 27 Sep 2017, :value=>30.4024},
42
- # {:date=>Thu, 28 Sep 2017, :value=>30.4065},
43
- # {:date=>Fri, 29 Sep 2017, :value=>30.4105},
44
- # {:date=>Sat, 30 Sep 2017, :value=>30.4146}
45
- # ]
46
-
47
- ```
48
-
49
- ## Installation
50
- Add this line to your application's Gemfile:
51
-
52
- ```ruby
53
- # From git repository
54
- gem 'bcn_ni', git: 'https://github.com/mldoscar/bcn_ni', branch: 'master'
55
-
56
- # From ruby gems
57
- gem 'bcn_ni', '~> 0.1.2'
58
-
59
- # Using gem install
60
- gem install bcn_ni
61
- ```
62
-
63
- And then execute:
64
- ```bash
65
- $ bundle
66
- ```
67
-
68
- ## Contributing
69
- You guys are free to send your pull requests for contributing. Thanks in advance!
70
-
71
- ## License
72
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
1
+ # BcnNi
2
+ This gem provides NIO (Córdoba oro Nicaragüense) versus USD (United States dollar) money exchange rates consuming the official Central Bank of Nicaragüa (BCN) SOAP Service
3
+
4
+ ## Basic usage
5
+ ```ruby
6
+ # Returns the exchange rate for September 15th, 2017
7
+ day_rate = BcnNi.exchange_day(2017, 9, 15)
8
+ #
9
+ # => 30.3537
10
+
11
+ # Returns the exchange rate table for September, 2017
12
+ month_rate = BcnNi.exchange_month(2017, 9)
13
+ #
14
+ # => [
15
+ # {:date=>Fri, 01 Sep 2017, :value=>30.2969},
16
+ # {:date=>Sat, 02 Sep 2017, :value=>30.301},
17
+ # {:date=>Sun, 03 Sep 2017, :value=>30.305},
18
+ # {:date=>Mon, 04 Sep 2017, :value=>30.3091},
19
+ # {:date=>Tue, 05 Sep 2017, :value=>30.3131},
20
+ # {:date=>Wed, 06 Sep 2017, :value=>30.3172},
21
+ # {:date=>Thu, 07 Sep 2017, :value=>30.3212},
22
+ # {:date=>Fri, 08 Sep 2017, :value=>30.3253},
23
+ # {:date=>Sat, 09 Sep 2017, :value=>30.3293},
24
+ # {:date=>Sun, 10 Sep 2017, :value=>30.3334},
25
+ # {:date=>Mon, 11 Sep 2017, :value=>30.3374},
26
+ # {:date=>Tue, 12 Sep 2017, :value=>30.3415},
27
+ # {:date=>Wed, 13 Sep 2017, :value=>30.3455},
28
+ # {:date=>Thu, 14 Sep 2017, :value=>30.3496},
29
+ # {:date=>Fri, 15 Sep 2017, :value=>30.3537},
30
+ # {:date=>Sat, 16 Sep 2017, :value=>30.3577},
31
+ # {:date=>Sun, 17 Sep 2017, :value=>30.3618},
32
+ # {:date=>Mon, 18 Sep 2017, :value=>30.3658},
33
+ # {:date=>Tue, 19 Sep 2017, :value=>30.3699},
34
+ # {:date=>Wed, 20 Sep 2017, :value=>30.374},
35
+ # {:date=>Thu, 21 Sep 2017, :value=>30.378},
36
+ # {:date=>Fri, 22 Sep 2017, :value=>30.3821},
37
+ # {:date=>Sat, 23 Sep 2017, :value=>30.3861},
38
+ # {:date=>Sun, 24 Sep 2017, :value=>30.3902},
39
+ # {:date=>Mon, 25 Sep 2017, :value=>30.3943},
40
+ # {:date=>Tue, 26 Sep 2017, :value=>30.3983},
41
+ # {:date=>Wed, 27 Sep 2017, :value=>30.4024},
42
+ # {:date=>Thu, 28 Sep 2017, :value=>30.4065},
43
+ # {:date=>Fri, 29 Sep 2017, :value=>30.4105},
44
+ # {:date=>Sat, 30 Sep 2017, :value=>30.4146}
45
+ # ]
46
+
47
+ ```
48
+
49
+ ## Changing the request mode
50
+ For changing the request mode simply add `request_mode` argument at the end of the method args. **The default request mode is scrapping** (which incredibly resulted to be faster than SOAP and with 24/7 availability). You can change this like the example given below:
51
+
52
+ ```ruby
53
+ # Scrapping mode
54
+ day_rate = BcnNi.exchange_day(2017, 9, 15, request_mode: :scrapping)
55
+ month_rate = BcnNi.exchange_month(2017, 9, request_mode: :scrapping)
56
+ # SOAP request mode
57
+ day_rate = BcnNi.exchange_day(2017, 9, 15, request_mode: :soap)
58
+ month_rate = BcnNi.exchange_month(2017, 9, request_mode: :soap)
59
+ ```
60
+
61
+
62
+ ## Installation
63
+ Add this line to your application's Gemfile:
64
+
65
+ ```ruby
66
+ # From git repository
67
+ gem 'bcn_ni', git: 'https://github.com/mldoscar/bcn_ni', branch: 'master'
68
+
69
+ # From ruby gems
70
+ gem 'bcn_ni', '>= 0.1.3'
71
+
72
+ # Using gem install
73
+ gem install bcn_ni
74
+ ```
75
+
76
+ And then execute:
77
+ ```bash
78
+ $ bundle
79
+ ```
80
+
81
+ ## Contributing
82
+ You guys are free to send your pull requests for contributing. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
83
+
84
+ ## License
85
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -31,3 +31,8 @@ end
31
31
 
32
32
 
33
33
  task default: :test
34
+
35
+ desc "Open an irb session preloaded with this library"
36
+ task :console do
37
+ sh "irb -r rubygems -I lib -r bcn_ni.rb"
38
+ end
@@ -0,0 +1,15 @@
1
+ module BcnNi
2
+ require File.expand_path(File.dirname(__FILE__)) + '/helpers/request'
3
+
4
+ def self.exchange_month(year, month, args = {})
5
+ request = BcnNi::Request.new(args)
6
+
7
+ return request.exchange_month(year, month)
8
+ end
9
+
10
+ def self.exchange_day(year, month, day, args = {})
11
+ request = BcnNi::Request.new(args)
12
+
13
+ return request.exchange_day(year, month, day)
14
+ end
15
+ end
@@ -0,0 +1,192 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+ require 'net/https'
4
+ require 'nokogiri'
5
+ require 'open-uri'
6
+ require 'active_support/core_ext/hash'
7
+ require 'json'
8
+
9
+ module BcnNi
10
+ class Request
11
+ @request_url = ""
12
+ @request_mode = nil
13
+
14
+ def initialize(args = {})
15
+ @request_mode = (args[:request_mode] || :scrapping).to_sym
16
+
17
+ case @request_mode
18
+ when :scrapping
19
+ @request_url = "https://www.bcn.gob.ni/estadisticas/mercados_cambiarios/tipo_cambio/cordoba_dolar/mes.php"
20
+ when :soap
21
+ # See 'https://servicios.bcn.gob.ni/Tc_Servicio/ServicioTC.asmx' for more info about how to build a RAW SOAP request
22
+ @request_url = "https://servicios.bcn.gob.ni/Tc_Servicio/ServicioTC.asmx?WSDL"
23
+ else
24
+ raise Exception.new('Request mode not implemented')
25
+ end
26
+ end
27
+
28
+ def request_url
29
+ return @request_url
30
+ end
31
+
32
+ def request_mode
33
+ return @request_mode
34
+ end
35
+
36
+ def exchange_month(year, month)
37
+ case request_mode
38
+ when :scrapping
39
+ return scra__exchange_month(year, month)
40
+ when :soap
41
+ return soap__exchange_month(year, month)
42
+ else
43
+ raise Exception.new('Request mode not implemented')
44
+ end
45
+ end
46
+
47
+ def exchange_day(year, month, day)
48
+ case request_mode
49
+ when :scrapping
50
+ return scra__exchange_day(year, month, day)
51
+ when :soap
52
+ return soap__exchange_day(year, month, day)
53
+ else
54
+ raise Exception.new('Request mode not implemented')
55
+ end
56
+ end
57
+
58
+ private
59
+ def scra__exchange_month(year, month)
60
+ # Parse the date
61
+ start_date = Date.new(year, month, 1)
62
+ end_date = start_date.end_of_month
63
+
64
+ # Create the arg hash
65
+ args = {
66
+ Fecha_inicial: start_date,
67
+ Fecha_final: end_date
68
+ }
69
+
70
+ # Generate the full url
71
+ full_url = request_url + '?' + args.to_param
72
+
73
+ # Fetch and parse HTML document
74
+ doc = Nokogiri::HTML(open(full_url, { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }))
75
+
76
+ result = []
77
+ # Iterate table
78
+ doc.css('table tr').each_with_index do |row, i|
79
+ next if i.zero?
80
+
81
+ # Parse the value
82
+ # (Date is not parsed because it's not given in a correct format, giving the month it in spanish)
83
+ # so, we must assume that dates are given in ascendent sort order
84
+ value = row.css('td')[1].content
85
+
86
+ # Push the result into the array
87
+ result.push({ date: start_date + (i - 1).day, value: value.strip.to_f })
88
+ end
89
+
90
+ return result
91
+ end
92
+
93
+ def scra__exchange_day(year, month, day)
94
+ # Parse the date
95
+ start_date = Date.new(year, month, day)
96
+
97
+ # Find the result into the month table
98
+ found_result = scra__exchange_month(year, month).find { |x| x[:date] == start_date }
99
+
100
+ # Return the result value
101
+ return (found_result || {})[:value]
102
+ end
103
+
104
+ def soap__exchange_day(year, month, day)
105
+ # Build body through a XML envelope
106
+ body = soap__envelope(soap__letter_exchange_day(year, month, day))
107
+ json_response = soap__request(body)
108
+
109
+ # Get the result value
110
+ value_result = json_response['Envelope']['Body']['RecuperaTC_DiaResponse']['RecuperaTC_DiaResult']
111
+ # Parse the result value and finally return it
112
+ return value_result.to_f
113
+ end
114
+
115
+ def soap__exchange_month(year, month)
116
+ # Build body through a XML envelope
117
+ body = soap__envelope(soap__letter_exchange_month(year, month))
118
+ json_response = soap__request(body)
119
+
120
+ # Get the result array
121
+ exchange_table = json_response['Envelope']['Body']['RecuperaTC_MesResponse']['RecuperaTC_MesResult']['Detalle_TC']['Tc']
122
+
123
+ if exchange_table.present?
124
+ # Parse the table to a custom and better JSON
125
+ # The format example will be: {date: as Date, value: as Float}
126
+ parsed_table = exchange_table.map{ |x| { date: Date.parse(x['Fecha']), value: x['Valor'].to_f } }
127
+ # Sort the parsed table and finally return it
128
+ return parsed_table.sort_by { |x| x[:date] }
129
+ else
130
+ return []
131
+ end
132
+ end
133
+
134
+ def soap__request(body)
135
+ # Parse the URI
136
+ uri = URI.parse(request_url)
137
+ # Create protocol to the URI
138
+ request_engine = Net::HTTP.new(uri.host, uri.port)
139
+ request_engine.use_ssl = true
140
+ request_engine.verify_mode = OpenSSL::SSL::VERIFY_NONE
141
+ request_engine.open_timeout = 15.seconds
142
+
143
+ # Create a new POST request as XML content type
144
+ req = Net::HTTP::Post.new(uri.path)
145
+ req['Content-Type'] = 'text/xml'
146
+
147
+ # Set the request body as a RAW SOAP XML request
148
+ req.body = body
149
+ # Process the request
150
+ res = request_engine.request(req)
151
+ # Get the XML response
152
+ xml_response = res.body
153
+
154
+ # Parse to a JSON hash
155
+ return Hash.from_xml(xml_response)
156
+ end
157
+
158
+ def soap__envelope(letter)
159
+ envelope = <<EOF
160
+ <?xml version="1.0" encoding="utf-8"?>
161
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
162
+ <soap:Body>
163
+ #{letter}
164
+ </soap:Body>
165
+ </soap:Envelope>
166
+ EOF
167
+ return envelope
168
+ end
169
+
170
+ def soap__letter_exchange_day(year, month, day)
171
+ letter = <<EOF
172
+ <RecuperaTC_Dia xmlns="http://servicios.bcn.gob.ni/">
173
+ <Ano>#{year}</Ano>
174
+ <Mes>#{month}</Mes>
175
+ <Dia>#{day}</Dia>
176
+ </RecuperaTC_Dia>
177
+ EOF
178
+ return letter
179
+ end
180
+
181
+ def soap__letter_exchange_month(year, month)
182
+ letter = <<EOF
183
+ <RecuperaTC_Mes xmlns="http://servicios.bcn.gob.ni/">
184
+ <Ano>#{year}</Ano>
185
+ <Mes>#{month}</Mes>
186
+ </RecuperaTC_Mes>
187
+ EOF
188
+ return letter
189
+ end
190
+
191
+ end
192
+ end
@@ -1,3 +1,3 @@
1
1
  module BcnNi
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
data/lib/bcn_ni.rb CHANGED
@@ -1,107 +1,4 @@
1
- require 'uri'
2
- require 'net/http'
3
- require 'net/https'
4
- require 'active_support/core_ext/hash'
5
- require 'json'
6
-
7
- module BcnNi
8
-
9
- def self.exchange_day(year, month, day)
10
- # Build body through a XML envelope
11
- body = self.bcn_envelope(self.exchange_day_letter(year, month, day))
12
-
13
- json_response = self.do_request(body)
14
-
15
- # Get the result value
16
- value_result = json_response['Envelope']['Body']['RecuperaTC_DiaResponse']['RecuperaTC_DiaResult']
17
-
18
- # Parse the result value and finally return it
19
- return value_result.to_f
20
-
21
- end
22
-
23
- def self.exchange_month(year, month)
24
- # Build body through a XML envelope
25
- body = self.bcn_envelope(self.exchange_month_letter(year, month))
26
-
27
- json_response = self.do_request(body)
28
-
29
- # Get the result array
30
- exchange_table = json_response['Envelope']['Body']['RecuperaTC_MesResponse']['RecuperaTC_MesResult']['Detalle_TC']['Tc']
31
-
32
- unless exchange_table.nil?
33
- # Parse the table to a custom and better JSON
34
- # The format example will be: {date: as Date, value: as Float}
35
- parsed_table = exchange_table.map{|x| {date: Date.parse(x['Fecha']), value: x['Valor'].to_f} }
36
-
37
- # Sort the parsed table and finally return it
38
- return parsed_table.sort_by {|x| x[:date]}
39
- else
40
- return []
41
- end
42
-
43
- end
44
-
45
- private
46
- def self.do_request(body)
47
- # see 'https://servicios.bcn.gob.ni/Tc_Servicio/ServicioTC.asmx'
48
- # for more info about how to build a RAW SOAP request
49
-
50
- # Parse the URI
51
- uri = URI.parse('https://servicios.bcn.gob.ni/Tc_Servicio/ServicioTC.asmx?WSDL')
52
-
53
- # Create protocol to the URI
54
- https = Net::HTTP.new(uri.host, uri.port)
55
-
56
- https.use_ssl = true
57
-
58
- # Create a new POST request as XML content type
59
- req = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' => 'text/xml'})
60
-
61
- # Set the request body as a RAW SOAP XML request
62
- req.body = body
63
-
64
- # Process the request
65
- res = https.request(req)
66
-
67
- # Get the XML response
68
- xml_response = res.body
69
-
70
- # Parse to a JSON hash
71
- return Hash.from_xml(xml_response)
72
- end
73
-
74
- def self.bcn_envelope(letter)
75
- envelope = <<EOF
76
- <?xml version="1.0" encoding="utf-8"?>
77
- <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
78
- <soap:Body>
79
- #{letter}
80
- </soap:Body>
81
- </soap:Envelope>
82
- EOF
83
- return envelope
84
- end
85
-
86
- def self.exchange_day_letter(year, month, day)
87
- letter = <<EOF
88
- <RecuperaTC_Dia xmlns="http://servicios.bcn.gob.ni/">
89
- <Ano>#{year}</Ano>
90
- <Mes>#{month}</Mes>
91
- <Dia>#{day}</Dia>
92
- </RecuperaTC_Dia>
93
- EOF
94
- return letter
95
- end
96
-
97
- def self.exchange_month_letter(year, month)
98
- letter = <<EOF
99
- <RecuperaTC_Mes xmlns="http://servicios.bcn.gob.ni/">
100
- <Ano>#{year}</Ano>
101
- <Mes>#{month}</Mes>
102
- </RecuperaTC_Mes>
103
- EOF
104
- return letter
105
- end
106
-
107
- end
1
+ module BcnNi
2
+ require 'bcn_ni/version'
3
+ require 'bcn_ni/core'
4
+ end
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcn_ni
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Rodriguez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-04 00:00:00.000000000 Z
11
+ date: 2019-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -31,58 +31,62 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: 5.1.3
33
33
  - !ruby/object:Gem::Dependency
34
- name: rails
34
+ name: nokogiri
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '5.1'
40
- - - ">="
39
+ version: '1.10'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
41
45
  - !ruby/object:Gem::Version
42
- version: 5.1.3
46
+ version: '1.10'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '12.3'
43
54
  type: :development
44
55
  prerelease: false
45
56
  version_requirements: !ruby/object:Gem::Requirement
46
57
  requirements:
47
58
  - - "~>"
48
59
  - !ruby/object:Gem::Version
49
- version: '5.1'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 5.1.3
60
+ version: '12.3'
53
61
  - !ruby/object:Gem::Dependency
54
- name: sqlite3
62
+ name: rspec
55
63
  requirement: !ruby/object:Gem::Requirement
56
64
  requirements:
57
65
  - - "~>"
58
66
  - !ruby/object:Gem::Version
59
- version: '1.3'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 1.3.12
67
+ version: '3.8'
63
68
  type: :development
64
69
  prerelease: false
65
70
  version_requirements: !ruby/object:Gem::Requirement
66
71
  requirements:
67
72
  - - "~>"
68
73
  - !ruby/object:Gem::Version
69
- version: '1.3'
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 1.3.12
73
- description: This gem provides NIO (Córdoba oro Nicaragüense) versus USD (United States
74
- dollar) money exchange rates consuming the official Central Bank of Nicaragüa (BCN)
75
- SOAP Service
74
+ version: '3.8'
75
+ description: This tool pretends to be helpful for developers who can request exchange
76
+ rates in a easier way
76
77
  email:
77
78
  - mld.oscar@yahoo.com
78
79
  executables: []
79
80
  extensions: []
80
81
  extra_rdoc_files: []
81
82
  files:
83
+ - CODE_OF_CONDUCT.md
82
84
  - MIT-LICENSE
83
85
  - README.md
84
86
  - Rakefile
85
87
  - lib/bcn_ni.rb
88
+ - lib/bcn_ni/core.rb
89
+ - lib/bcn_ni/helpers/request.rb
86
90
  - lib/bcn_ni/version.rb
87
91
  - lib/tasks/bcn_ni_tasks.rake
88
92
  homepage: https://github.com/mldoscar/bcn_ni
@@ -105,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
109
  version: '0'
106
110
  requirements: []
107
111
  rubyforge_project:
108
- rubygems_version: 2.6.8
112
+ rubygems_version: 2.7.7
109
113
  signing_key:
110
114
  specification_version: 4
111
115
  summary: This gem provides NIO (Córdoba oro Nicaragüense) versus USD (United States