cambio 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +57 -0
- data/Rakefile +10 -0
- data/cambio.gemspec +24 -0
- data/lib/cambio.rb +102 -0
- data/lib/cambio/configuration.rb +31 -0
- data/lib/cambio/error.rb +13 -0
- data/lib/cambio/version.rb +3 -0
- data/lib/faraday/raise_on_error.rb +32 -0
- data/spec/cambio/configuration_spec.rb +51 -0
- data/spec/cambio_spec.rb +195 -0
- data/spec/fixtures/currencies.yml +198 -0
- data/spec/fixtures/currencies_unauth.yml +40 -0
- data/spec/fixtures/historical_date.yml +205 -0
- data/spec/fixtures/historical_missing.yml +40 -0
- data/spec/fixtures/historical_string.yml +205 -0
- data/spec/fixtures/historical_unauth.yml +40 -0
- data/spec/fixtures/latest.yml +205 -0
- data/spec/fixtures/latest_unauth.yml +40 -0
- data/spec/spec_helper.rb +12 -0
- metadata +133 -0
@@ -0,0 +1,205 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://openexchangerates.org/api/historical/2011-02-01.json?app_id=bcc1d1ad9f4d4dd69b12a64c913857fe
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ""
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Fri, 17 Aug 2012 01:01:44 GMT
|
23
|
+
Server:
|
24
|
+
- Apache/2
|
25
|
+
X-Powered-By:
|
26
|
+
- PHP/5.3.10
|
27
|
+
Access-Control-Allow-Origin:
|
28
|
+
- "*"
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- application/json; charset=utf-8
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: |-
|
38
|
+
{
|
39
|
+
"disclaimer": "This data is collected from various providers and provided free of charge for informational purposes only, with no guarantee whatsoever of accuracy, validity, availability, or fitness for any purpose; use at your own risk. Other than that, have fun! Usage confirms acceptance of terms: http://openexchangerates.org/terms/",
|
40
|
+
"license": "Data collected from various providers with public-facing APIs; copyright may apply; not for resale; no warranties given. Usage confirms acceptance of license agreement: http://openexchangerates.org/license/",
|
41
|
+
"timestamp": 1296601200,
|
42
|
+
"base": "USD",
|
43
|
+
"rates": {
|
44
|
+
"AED": 3.67275,
|
45
|
+
"AFN": 43.032243,
|
46
|
+
"ALL": 101.268834,
|
47
|
+
"AMD": 363.823386,
|
48
|
+
"ANG": 1.79075,
|
49
|
+
"AOA": 92.975852,
|
50
|
+
"ARS": 4.007401,
|
51
|
+
"AUD": 0.990829,
|
52
|
+
"AWG": 1.79025,
|
53
|
+
"AZN": 0.795932,
|
54
|
+
"BAM": 1.420428,
|
55
|
+
"BBD": 2,
|
56
|
+
"BDT": 71.162407,
|
57
|
+
"BGN": 1.421905,
|
58
|
+
"BHD": 0.3763,
|
59
|
+
"BIF": 1139.156266,
|
60
|
+
"BMD": 1,
|
61
|
+
"BND": 1.277735,
|
62
|
+
"BOB": 7.011227,
|
63
|
+
"BRL": 1.665834,
|
64
|
+
"BSD": 1,
|
65
|
+
"BTN": 45.748232,
|
66
|
+
"BWP": 6.744265,
|
67
|
+
"BYR": 3012.51474,
|
68
|
+
"BZD": 1.9875,
|
69
|
+
"CAD": 0.993844,
|
70
|
+
"CDF": 912.481796,
|
71
|
+
"CHF": 0.938609,
|
72
|
+
"CLP": 480.253213,
|
73
|
+
"CNY": 6.592744,
|
74
|
+
"COP": 1859.990042,
|
75
|
+
"CRC": 499.980379,
|
76
|
+
"CUP": 1,
|
77
|
+
"CVE": 80.161396,
|
78
|
+
"CZK": 17.458135,
|
79
|
+
"DJF": 177.721,
|
80
|
+
"DKK": 5.406056,
|
81
|
+
"DOP": 37.515691,
|
82
|
+
"DZD": 72.795053,
|
83
|
+
"EGP": 5.857391,
|
84
|
+
"ETB": 12.743717,
|
85
|
+
"EUR": 0.725139,
|
86
|
+
"FJD": 1.851839,
|
87
|
+
"FKP": 0.620212,
|
88
|
+
"GBP": 0.620212,
|
89
|
+
"GEL": 1.799631,
|
90
|
+
"GHS": 1.560131,
|
91
|
+
"GIP": 0.620574,
|
92
|
+
"GMD": 28.261952,
|
93
|
+
"GNF": 7248.863643,
|
94
|
+
"GTQ": 7.865512,
|
95
|
+
"GYD": 205.88543,
|
96
|
+
"HKD": 7.791788,
|
97
|
+
"HNL": 18.92,
|
98
|
+
"HRK": 5.384874,
|
99
|
+
"HTG": 40.81861,
|
100
|
+
"HUF": 196.959561,
|
101
|
+
"IDR": 9018.753759,
|
102
|
+
"IEP": 0.685223,
|
103
|
+
"ILS": 3.698933,
|
104
|
+
"INR": 45.629983,
|
105
|
+
"IQD": 1178.316278,
|
106
|
+
"IRR": 10373.622374,
|
107
|
+
"ISK": 115.593956,
|
108
|
+
"JMD": 87.061724,
|
109
|
+
"JOD": 0.708625,
|
110
|
+
"JPY": 81.465019,
|
111
|
+
"KES": 81.16306,
|
112
|
+
"KGS": 47.294112,
|
113
|
+
"KHR": 4044.843795,
|
114
|
+
"KMF": 357.664849,
|
115
|
+
"KPW": 143.051064,
|
116
|
+
"KRW": 1108.563995,
|
117
|
+
"KWD": 0.279756,
|
118
|
+
"KZT": 146.829105,
|
119
|
+
"LAK": 8057.466303,
|
120
|
+
"LBP": 1505.265267,
|
121
|
+
"LKR": 110.770214,
|
122
|
+
"LRD": 72.477273,
|
123
|
+
"LSL": 7.157458,
|
124
|
+
"LTL": 2.510214,
|
125
|
+
"LVL": 0.510944,
|
126
|
+
"LYD": 1.233317,
|
127
|
+
"MAD": 8.173329,
|
128
|
+
"MDL": 12.015028,
|
129
|
+
"MGA": 2045.345205,
|
130
|
+
"MKD": 44.612432,
|
131
|
+
"MMK": 6.51,
|
132
|
+
"MNT": 1244.253726,
|
133
|
+
"MOP": 8.019169,
|
134
|
+
"MRO": 277.597095,
|
135
|
+
"MUR": 29.572073,
|
136
|
+
"MVR": 12.7975,
|
137
|
+
"MWK": 152.234832,
|
138
|
+
"MXN": 12.045735,
|
139
|
+
"MYR": 3.053241,
|
140
|
+
"MZN": 32.305484,
|
141
|
+
"NAD": 7.166097,
|
142
|
+
"NGN": 152.309907,
|
143
|
+
"NIO": 19.87442,
|
144
|
+
"NOK": 5.71689,
|
145
|
+
"NPR": 71.217662,
|
146
|
+
"NZD": 1.282678,
|
147
|
+
"OMR": 0.384497,
|
148
|
+
"PAB": 1,
|
149
|
+
"PEN": 2.769725,
|
150
|
+
"PGK": 2.619276,
|
151
|
+
"PHP": 44.082651,
|
152
|
+
"PKR": 85.622911,
|
153
|
+
"PLN": 2.845365,
|
154
|
+
"PYG": 4617.043039,
|
155
|
+
"QAR": 3.64,
|
156
|
+
"RON": 3.091451,
|
157
|
+
"RSD": 75.94233,
|
158
|
+
"RUB": 14.828615,
|
159
|
+
"RWF": 596.440975,
|
160
|
+
"SAR": 3.750225,
|
161
|
+
"SBD": 7.763903,
|
162
|
+
"SCR": 12.222021,
|
163
|
+
"SDG": 2.512924,
|
164
|
+
"SEK": 6.38486,
|
165
|
+
"SGD": 1.273175,
|
166
|
+
"SHP": 0.620212,
|
167
|
+
"SLL": 4237.503541,
|
168
|
+
"SOS": 1600.002901,
|
169
|
+
"SRD": 3.275552,
|
170
|
+
"STD": 17843.229444,
|
171
|
+
"SVC": 8.748582,
|
172
|
+
"SYP": 46.700046,
|
173
|
+
"SZL": 7.158784,
|
174
|
+
"THB": 30.882442,
|
175
|
+
"TJS": 4.402504,
|
176
|
+
"TMT": 2.74579,
|
177
|
+
"TND": 1.410701,
|
178
|
+
"TOP": 1.85709,
|
179
|
+
"TRY": 1.586093,
|
180
|
+
"TTD": 6.31525,
|
181
|
+
"TWD": 29.05261,
|
182
|
+
"TZS": 1507.503032,
|
183
|
+
"UAH": 7.950018,
|
184
|
+
"UGX": 2307.502341,
|
185
|
+
"USD": 1,
|
186
|
+
"UYU": 19.650014,
|
187
|
+
"UZS": 1665.743366,
|
188
|
+
"VEF": 4.3,
|
189
|
+
"VND": 19495.018539,
|
190
|
+
"VUV": 93.324897,
|
191
|
+
"WST": 2.355598,
|
192
|
+
"XAF": 491.493117,
|
193
|
+
"XCD": 2.692738,
|
194
|
+
"XDR": 0.64003,
|
195
|
+
"XOF": 478.093107,
|
196
|
+
"XPF": 87.277572,
|
197
|
+
"YER": 214.65578,
|
198
|
+
"ZAR": 7.147699,
|
199
|
+
"ZMK": 4847.90687,
|
200
|
+
"ZWD": 15180.730445
|
201
|
+
}
|
202
|
+
}
|
203
|
+
http_version:
|
204
|
+
recorded_at: Fri, 17 Aug 2012 01:01:44 GMT
|
205
|
+
recorded_with: VCR 2.2.4
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://openexchangerates.org/api/historical/2011-02-01.json?app_id=wrong
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ""
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 401
|
19
|
+
message: Unauthorized
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Fri, 17 Aug 2012 01:01:46 GMT
|
23
|
+
Server:
|
24
|
+
- Apache/2
|
25
|
+
X-Powered-By:
|
26
|
+
- PHP/5.3.10
|
27
|
+
Access-Control-Allow-Origin:
|
28
|
+
- "*"
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- application/json; charset=utf-8
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: "{\"error\":true,\"status\":401,\"message\":\"invalid_app_id\",\"description\":\"Invalid App ID - please sign up at https://openexchangerates.org/signup, or contact support@openexchangerates.org.\"}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Fri, 17 Aug 2012 01:01:46 GMT
|
40
|
+
recorded_with: VCR 2.2.4
|
@@ -0,0 +1,205 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://openexchangerates.org/api/latest.json?app_id=bcc1d1ad9f4d4dd69b12a64c913857fe
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ""
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Fri, 17 Aug 2012 01:01:46 GMT
|
23
|
+
Server:
|
24
|
+
- Apache/2
|
25
|
+
X-Powered-By:
|
26
|
+
- PHP/5.3.10
|
27
|
+
Access-Control-Allow-Origin:
|
28
|
+
- "*"
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- application/json; charset=utf-8
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: |-
|
38
|
+
{
|
39
|
+
"disclaimer": "This data is collected from various providers and provided free of charge for informational purposes only, with no guarantee whatsoever of accuracy, validity, availability, or fitness for any purpose; use at your own risk. Other than that, have fun! Usage confirms acceptance of terms: http://openexchangerates.org/terms/",
|
40
|
+
"license": "Data collected from various providers with public-facing APIs; copyright may apply; not for resale; no warranties given. Usage confirms acceptance of license agreement: http://openexchangerates.org/license/",
|
41
|
+
"timestamp": 1345161799,
|
42
|
+
"base": "USD",
|
43
|
+
"rates": {
|
44
|
+
"AED": 3.673199,
|
45
|
+
"AFN": 48.2027,
|
46
|
+
"ALL": 110.778334,
|
47
|
+
"AMD": 411.445,
|
48
|
+
"ANG": 1.77945,
|
49
|
+
"AOA": 95.389999,
|
50
|
+
"ARS": 4.608488,
|
51
|
+
"AUD": 0.950931,
|
52
|
+
"AWG": 1.79035,
|
53
|
+
"AZN": 0.785421,
|
54
|
+
"BAM": 1.584425,
|
55
|
+
"BBD": 2,
|
56
|
+
"BDT": 81.329833,
|
57
|
+
"BGN": 1.589188,
|
58
|
+
"BHD": 0.377014,
|
59
|
+
"BIF": 1429.94,
|
60
|
+
"BMD": 1,
|
61
|
+
"BND": 1.246288,
|
62
|
+
"BOB": 6.958142,
|
63
|
+
"BRL": 2.018925,
|
64
|
+
"BSD": 1,
|
65
|
+
"BTN": 51.6125,
|
66
|
+
"BWP": 7.6934,
|
67
|
+
"BYR": 8360.425,
|
68
|
+
"BZD": 1.882117,
|
69
|
+
"CAD": 0.987125,
|
70
|
+
"CDF": 924.09021,
|
71
|
+
"CHF": 0.973624,
|
72
|
+
"CLF": 0.02147,
|
73
|
+
"CLP": 482.463167,
|
74
|
+
"CNY": 6.366975,
|
75
|
+
"COP": 1819.990917,
|
76
|
+
"CRC": 498.415125,
|
77
|
+
"CUP": 1,
|
78
|
+
"CVE": 89.143368,
|
79
|
+
"CZK": 20.167241,
|
80
|
+
"DJF": 177.38,
|
81
|
+
"DKK": 6.034986,
|
82
|
+
"DOP": 38.989616,
|
83
|
+
"DZD": 82.139281,
|
84
|
+
"EGP": 6.077038,
|
85
|
+
"ETB": 17.888016,
|
86
|
+
"EUR": 0.810708,
|
87
|
+
"FJD": 1.783086,
|
88
|
+
"FKP": 0.635915,
|
89
|
+
"GBP": 0.635915,
|
90
|
+
"GEL": 1.724717,
|
91
|
+
"GHS": 1.936383,
|
92
|
+
"GIP": 0.630595,
|
93
|
+
"GMD": 31.3721,
|
94
|
+
"GNF": 7132.303255,
|
95
|
+
"GTQ": 7.8381,
|
96
|
+
"GYD": 202.949998,
|
97
|
+
"HKD": 7.756852,
|
98
|
+
"HNL": 19.454198,
|
99
|
+
"HRK": 6.042171,
|
100
|
+
"HTG": 41.874733,
|
101
|
+
"HUF": 225.247199,
|
102
|
+
"IDR": 9498.60238,
|
103
|
+
"ILS": 4.028374,
|
104
|
+
"INR": 55.694896,
|
105
|
+
"IQD": 1161.958333,
|
106
|
+
"IRR": 12228.303333,
|
107
|
+
"ISK": 119.776666,
|
108
|
+
"JMD": 88.891875,
|
109
|
+
"JOD": 0.708493,
|
110
|
+
"JPY": 79.277411,
|
111
|
+
"KES": 84.022584,
|
112
|
+
"KGS": 45.018299,
|
113
|
+
"KHR": 4051.503333,
|
114
|
+
"KMF": 398.381632,
|
115
|
+
"KPW": 900,
|
116
|
+
"KRW": 1132.883457,
|
117
|
+
"KWD": 0.282625,
|
118
|
+
"KZT": 148.829003,
|
119
|
+
"LAK": 7996.513268,
|
120
|
+
"LBP": 1502.266025,
|
121
|
+
"LKR": 132.01205,
|
122
|
+
"LRD": 73.574999,
|
123
|
+
"LSL": 8.206533,
|
124
|
+
"LTL": 2.798938,
|
125
|
+
"LVL": 0.564517,
|
126
|
+
"LYD": 1.262,
|
127
|
+
"MAD": 8.926634,
|
128
|
+
"MDL": 12.424093,
|
129
|
+
"MGA": 2244.906667,
|
130
|
+
"MKD": 50.002075,
|
131
|
+
"MMK": 871.51,
|
132
|
+
"MNT": 1394,
|
133
|
+
"MOP": 7.956467,
|
134
|
+
"MRO": 299.868335,
|
135
|
+
"MUR": 30.621318,
|
136
|
+
"MVR": 15.4075,
|
137
|
+
"MWK": 275.297507,
|
138
|
+
"MXN": 13.157958,
|
139
|
+
"MYR": 3.1259,
|
140
|
+
"MZN": 28.60565,
|
141
|
+
"NAD": 8.209444,
|
142
|
+
"NGN": 156.375679,
|
143
|
+
"NIO": 23.614787,
|
144
|
+
"NOK": 5.949577,
|
145
|
+
"NPR": 88.836293,
|
146
|
+
"NZD": 1.233511,
|
147
|
+
"OMR": 0.38486,
|
148
|
+
"PAB": 1,
|
149
|
+
"PEN": 2.606763,
|
150
|
+
"PGK": 2.048436,
|
151
|
+
"PHP": 42.294413,
|
152
|
+
"PKR": 94.463162,
|
153
|
+
"PLN": 3.291512,
|
154
|
+
"PYG": 4411.01969,
|
155
|
+
"QAR": 3.640989,
|
156
|
+
"RON": 3.636538,
|
157
|
+
"RSD": 95.932681,
|
158
|
+
"RUB": 31.872158,
|
159
|
+
"RWF": 608.804924,
|
160
|
+
"SAR": 3.750298,
|
161
|
+
"SBD": 7.065961,
|
162
|
+
"SCR": 13.037453,
|
163
|
+
"SDG": 4.414575,
|
164
|
+
"SEK": 6.695895,
|
165
|
+
"SGD": 1.2496,
|
166
|
+
"SHP": 0.635915,
|
167
|
+
"SLL": 4341.16811,
|
168
|
+
"SOS": 1616.709984,
|
169
|
+
"SRD": 3.287171,
|
170
|
+
"STD": 20039.41026,
|
171
|
+
"SVC": 8.720557,
|
172
|
+
"SYP": 65.272568,
|
173
|
+
"SZL": 8.206133,
|
174
|
+
"THB": 31.500106,
|
175
|
+
"TJS": 4.58195,
|
176
|
+
"TMT": 2.850015,
|
177
|
+
"TND": 1.617325,
|
178
|
+
"TOP": 1.734736,
|
179
|
+
"TRY": 1.7962,
|
180
|
+
"TTD": 6.388825,
|
181
|
+
"TWD": 29.945451,
|
182
|
+
"TZS": 1570.450787,
|
183
|
+
"UAH": 8.074351,
|
184
|
+
"UGX": 2477.074895,
|
185
|
+
"USD": 1,
|
186
|
+
"UYU": 21.108011,
|
187
|
+
"UZS": 1906.946467,
|
188
|
+
"VEF": 4.294748,
|
189
|
+
"VND": 20775.033325,
|
190
|
+
"VUV": 92.120003,
|
191
|
+
"WST": 2.273021,
|
192
|
+
"XAF": 530.876621,
|
193
|
+
"XCD": 2.701683,
|
194
|
+
"XDR": 0.663946,
|
195
|
+
"XOF": 531.323337,
|
196
|
+
"XPF": 96.672801,
|
197
|
+
"YER": 215.042507,
|
198
|
+
"ZAR": 8.229372,
|
199
|
+
"ZMK": 4862.917146,
|
200
|
+
"ZWL": 322.355011
|
201
|
+
}
|
202
|
+
}
|
203
|
+
http_version:
|
204
|
+
recorded_at: Fri, 17 Aug 2012 01:01:46 GMT
|
205
|
+
recorded_with: VCR 2.2.4
|