genial 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c440e329e0688b49b74fe0217c118fc24fbecaf
4
- data.tar.gz: 13ebe732e56b4a8c499bb659c49439dc2a142fe2
3
+ metadata.gz: fbf590e7313081649c87e6299bd224ee696b6256
4
+ data.tar.gz: 08a7b0e4906f3a1edb7a637f2cb475eacf31c224
5
5
  SHA512:
6
- metadata.gz: 0551ac346f09c451afa1c3d3bf9103e0d49dd09da93a234954daeb317c1857711d02125149df7160a73d0f20ee2c65f908bf0e0621a2eb517690e44a90013ba6
7
- data.tar.gz: 9e623db1777bcd570e38674bac0528ebbbb2cbbc84c134edd3ccaea4e1565cf140d2b80736b01d0b1f4ea5b2638dcf2752bc7145cf52895e809b8e738d80c7b1
6
+ metadata.gz: e851bc7b74c92f622bc5817aa3f13d8e30f7db27fa5a0f4860c1c2a6171f98246858c09e4c86f0eab802f6e8f545e51d184d46d67087c46795bbb8a7030b0ab3
7
+ data.tar.gz: 795f436c7f91f3e9bab484968da80e362048cf54c03dc271457e84e6be691f641c5c4431cb89275cb43b151b1859bc4920fb05f33c038fd7db4ce0af9d725b03
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Renan Gurgel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Genial
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/genial`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Genial, is a simples gem that allows you to check the current value of a currency in [Brazilian Real](https://en.wikipedia.org/wiki/Brazilian_real). This gem has also a way to convert values.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ All this data is based on a API provided by [xgeek](http://xgeek.com.br/rest-api-cotacao-conversao-moedas/) that gets data from [Central Bank of Brazil](https://en.wikipedia.org/wiki/Central_Bank_of_Brazil) and this data is updated during the week (working days) at 2:00 p.m (GMT -3).
6
6
 
7
7
  ## Installation
8
8
 
@@ -22,7 +22,31 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ The usage is pretty simple. To know the value of $1 in R$
26
+ ```ruby
27
+ Genial::Currency.dollar
28
+ # => 3.79
29
+ ```
30
+
31
+ Main currencies:
32
+
33
+ ```ruby
34
+ Genial::Currency.dollar
35
+
36
+ Genial::Currency.euro
37
+
38
+ Genial::Currency.pound
39
+ ```
40
+
41
+
42
+ We can get the value of any currency in the world. Based on [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217), we just need to pass the country code to method `find` and we are done. Ex: to get `Canadian dollar` value:
43
+
44
+ ```ruby
45
+ Genial::Currency.find("CAD")
46
+ # => 2.97
47
+ ```
48
+
49
+ To see a list with all currency codes access this [link](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
26
50
 
27
51
  ## Development
28
52
 
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ desc "Open an irb session preloaded with this library"
4
+ task :console do
5
+ sh "irb -rubygems -I lib -r genial.rb"
6
+ end
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.9"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "pry-byebug"
25
+ spec.add_development_dependency "rspec"
24
26
 
25
27
  spec.add_dependency "httparty", "~> 0.13.7"
26
28
  end
@@ -6,9 +6,26 @@ module Genial
6
6
  include HTTParty
7
7
  base_uri "http://api.xgeek.com.br/taxa-cambio"
8
8
 
9
- def self.dolar
10
- get("/currency?code=USD").parsed_response["buying_rate"]
9
+ def self.find(code)
10
+ parse_response(get("/currency?code=#{code}"))
11
+ end
12
+
13
+ def self.dollar
14
+ parse_response(get("/currency?code=USD"))
15
+ end
16
+
17
+ def self.euro
18
+ parse_response(get("/currency?code=EUR"))
11
19
  end
12
- end
13
20
 
21
+ def self.pound
22
+ parse_response(get("/currency?code=GBP"))
23
+ end
24
+
25
+ private
26
+
27
+ def self.parse_response(response)
28
+ response.parsed_response["buying_rate"].to_f.round(2)
29
+ end
30
+ end
14
31
  end
@@ -1,3 +1,3 @@
1
1
  module Genial
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renan Gurgel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-15 00:00:00.000000000 Z
11
+ date: 2015-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: httparty
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -63,7 +91,9 @@ files:
63
91
  - ".gitignore"
64
92
  - ".rspec"
65
93
  - ".travis.yml"
94
+ - CODE_OF_CONDUCT.md
66
95
  - Gemfile
96
+ - LICENSE.txt
67
97
  - README.md
68
98
  - Rakefile
69
99
  - bin/console