apilayer 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +9 -1
  3. data/lib/apilayer/currency.rb +15 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f751df7c6d98bc85da716312177f4a7ab6eb4336
4
- data.tar.gz: bd01cf1ae3de71292d21fe1010741215d0b654d3
3
+ metadata.gz: 383eeb146f71eb3228479e26a5ebf2822215bb31
4
+ data.tar.gz: 02b6171cecc55a1aad163ac06ef9a01ad14334fe
5
5
  SHA512:
6
- metadata.gz: 64980240ef6a80e0d31d103956eff1c1d5c2b2d161521e2ea7c783916ae62532ea271d88280898c572af27d879f95a63ed7a384dc055fc51ea1fa4253d1302c1
7
- data.tar.gz: e49ab2c049641a8e10452debd5413fc25ac980f8f82997b017bb4343288b6b93687bb55f9b0fe4e5335fc350438e7efc8ed56b8eaf5753286e40cff95e9cc3b5
6
+ metadata.gz: d3cc153cc6767b38b63e41fa64b203b9f2919b327b88916441b59335f62299479e6064e8f26859d256861ced50ce7822b333d1640cd3d2080886bf6d7ba3dde8
7
+ data.tar.gz: fd7d9d9cbdd9fa20551c9e813b80a4a1cef581f2564966a8977358be5bff05ee4f2d87513fbe9be4405386e980efea4f4773b6f834e57003ab8eacd3402dd502
data/README.rdoc CHANGED
@@ -3,6 +3,9 @@
3
3
  Ruby wrapper for various services of apilayer.
4
4
  See http://apilayer.com for more details.
5
5
 
6
+ === Version 1.3
7
+ Added .timeframe to Apilayer::Currency
8
+
6
9
  === Version 1.2
7
10
  Added .convert to Apilayer::Currency
8
11
 
@@ -52,7 +55,12 @@ After setting the access_key for *currencylayer*, you can use Apilayer::Currency
52
55
  Apilayer::Currency.historical("2016-01-01", :currencies => %w[GBP CHF], :source => "EUR")
53
56
 
54
57
  Apilayer::Currency.convert("EUR", "CHF", 100) # convert 100 EUR to CHF
55
- Apilayer::Currency.convert("EUR", "CHF", 100, "2015-06-01") # conversion based on specific date
58
+ Apilayer::Currency.convert("EUR", "CHF", 100, "2015-06-01") # based on specific date
59
+
60
+ Apilayer::Currency.timeframe("2016-01-01", "2016-06-01")
61
+ Apilayer::Currency.timeframe("2016-01-01", "2016-06-01", :currencies => %w[GBP CHF])
62
+ Apilayer::Currency.timeframe("2016-01-01", "2016-06-01", :source => "EUR")
63
+ Apilayer::Currency.timeframe("2016-01-01", "2016-06-01", :currencies => %w[GBP CHF], :source => "EUR")
56
64
  ==== vatlayer
57
65
  After setting the access_key for *vatlayer*, you can use Apilayer::Vat to call *vatlayer*'s API
58
66
 
@@ -12,6 +12,7 @@ module Apilayer
12
12
  LIVE_SLUG = "live"
13
13
  HISTORICAL_SLUG = "historical"
14
14
  CONVERT_SLUG = "convert"
15
+ TIMEFRAME_SLUG = "timeframe"
15
16
 
16
17
  ## Validations
17
18
  #
@@ -75,7 +76,20 @@ module Apilayer
75
76
  get_and_parse(CONVERT_SLUG, params)
76
77
  end
77
78
 
78
-
79
+ ##
80
+ # Api-Method: Calls the /timeframe endpoint. Requires :start_date and :end_date
81
+ # If :currencies hasn't been provided as an option, it will return all exchange-rates for that period of your source-currency
82
+ # :source can be provided as option to change the source-currency, which is USD by default
83
+ # The difference between start_date and end_date can be maximum 365 days
84
+ # Example:
85
+ # Apilayer::Currency.timeframe("2016-01-01", "2016-06-01")
86
+ # Apilayer::Currency.timeframe("2016-01-01", "2016-06-01", :currencies => %w[GBP CHF])
87
+ # Apilayer::Currency.timeframe("2016-01-01", "2016-06-01", :currencies => %w[GBP CHF], :source => "EUR")
88
+ def self.timeframe(start_date, end_date, opts={})
89
+ validate_options(opts)
90
+ params = {:start_date => start_date, :end_date => end_date}
91
+ get_and_parse_with_options(TIMEFRAME_SLUG, opts, params)
92
+ end
79
93
 
80
94
  ## Internal Methods
81
95
  def self.get_and_parse_with_options(slug, opts, params={})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apilayer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Fong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-21 00:00:00.000000000 Z
11
+ date: 2016-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json