exrt 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: b4e0da6a5973102f16e32cedcefa9be304fdf77f6e52a54bab2571193ab698ec
4
- data.tar.gz: c04f71cc24357655f9da2d623e6951dc28222ebe091a342cc86ee7d7a9de2719
3
+ metadata.gz: 007bee7c3c946e8d6d80e97c4caaf7fb7a5c22198b409ea1f073c6484b8efa08
4
+ data.tar.gz: fba712eb6c422cbe1c8b250c107e3cf34cdae752a67f321c4fc38b773bab8ce4
5
5
  SHA512:
6
- metadata.gz: 960de8be31dfa54c5084045d83e9530ea42eb8b7e71257eb010b314cbf93fc192d3c1a0aa8808cef81f9f4ec06d933a81043bdb198a4d3d31815458929780e73
7
- data.tar.gz: d383ded426a61bf02069e777d107aef820a43e333996dbc67251ce4d518be4b256caa7ca02a4202c00e77205b95e881263a667687aaca62f01e8c0ae71de4711
6
+ metadata.gz: 8a93425d499945ca878b61a88a2dc958f4edee779097f9f801334064644906a8ecc14c0ddb748a8fc824721c19e65ccdf83605b700b43056e6b6b7bc573cc013
7
+ data.tar.gz: de192a0e8fe93e6c810719ab734445e2a7fc9fe7a365ad03b61f71f19a0976df1aa0d4d340b1058a74bd4965ed49d1ba4d8b731427c8c923d8d780239a95d26d
data/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # Exrt
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/exrt`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
3
  ## Installation
8
4
 
9
5
  Add this line to your application's Gemfile:
@@ -16,20 +12,14 @@ And then execute:
16
12
 
17
13
  $ bundle
18
14
 
19
- Or install it yourself as:
15
+ Or just:
20
16
 
21
17
  $ gem install exrt
22
18
 
23
19
  ## Usage
24
20
 
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- 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.
30
-
31
- 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).
21
+ check [exrt-cli](https://github.com/al002/exrt-cli/) for usage example.
32
22
 
33
23
  ## Contributing
34
24
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/exrt.
25
+ Bug reports and pull requests are welcome on GitHub at https://github.com/al002/exrt.
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  end
20
20
  spec.bindir = "exe"
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib", "~/workspace/exrt/lib"]
22
+ spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_dependency "faraday", "~> 0.15"
25
25
 
@@ -1,25 +1,31 @@
1
+ require 'json'
1
2
  require "exrt/version"
2
- require "exrt/http"
3
+ require 'exrt/http'
3
4
 
4
5
  module Exrt
5
6
  class Rate
6
7
  def self.latest(base: "USD", symbols: [])
7
- response = Http.get("/latest", { base: base, symbols: symbols_str(symbols) })
8
- response.body
8
+ response = Exrt::Http.get("/latest", { base: base, symbols: symbols_str(symbols) })
9
+ to_json(response.body)
9
10
  end
10
11
 
11
12
  def self.history(base: "USD", symbols: [], start_at:, end_at:)
12
- response = Http.get("/history", {
13
+ response = Exrt::Http.get("/history", {
13
14
  base: base,
14
15
  symbols: symbols_str(symbols),
15
16
  start_at: start_at,
16
17
  end_at: end_at,
17
18
  })
18
- response.body
19
+ to_json(response.body)
19
20
  end
20
21
 
22
+ private
21
23
  def self.symbols_str(symbols)
22
24
  symbols.join(",")
23
25
  end
26
+
27
+ def self.to_json(resp)
28
+ JSON.parse(resp)
29
+ end
24
30
  end
25
31
  end
@@ -1,11 +1,14 @@
1
1
  require "faraday"
2
2
 
3
- class Http
4
- @@api_base = "https://api.exchangeratesapi.io"
5
- @@conn = Faraday.new(:url => @@api_base)
3
+ module Exrt
4
+ class Http
5
+ @@api_base = "https://api.exchangeratesapi.io"
6
+ @@conn = Faraday.new(:url => @@api_base)
6
7
 
7
- public
8
- def self.get(url, params ={})
9
- @@conn.get(url, params)
8
+ public
9
+ def self.get(url, params ={})
10
+ @@conn.get(url, params)
11
+ end
10
12
  end
11
13
  end
14
+
@@ -1,3 +1,3 @@
1
1
  module Exrt
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: exrt
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
  - al002
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-27 00:00:00.000000000 Z
11
+ date: 2019-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -94,7 +94,6 @@ post_install_message:
94
94
  rdoc_options: []
95
95
  require_paths:
96
96
  - lib
97
- - "~/workspace/exrt/lib"
98
97
  required_ruby_version: !ruby/object:Gem::Requirement
99
98
  requirements:
100
99
  - - ">="
@@ -106,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
105
  - !ruby/object:Gem::Version
107
106
  version: '0'
108
107
  requirements: []
109
- rubygems_version: 3.0.1
108
+ rubygems_version: 3.0.2
110
109
  signing_key:
111
110
  specification_version: 4
112
111
  summary: exchange rate library