metalpriceapi 1.0.2 → 1.1.1

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
2
  SHA256:
3
- metadata.gz: 4630840d040d437ac4d776aa35a9dc92b44ec4d4c0fdcbc1cf8cb3a392dc4c6a
4
- data.tar.gz: 27710da5638fb28ac20215834d2d83e4194843b5014c4c493688c8592be40ba4
3
+ metadata.gz: 7a13080f5dc72f510a61f9d83d4a21bd214e6e354fe29e6b62f6475fe2ecb21d
4
+ data.tar.gz: 7dc7dabf6ef16ac0699149ae79c8fde098dd74c2aa1b2db87a84161379516c68
5
5
  SHA512:
6
- metadata.gz: 60d4a84e3173d63a9875be6f6eac85cb926ae6751f7f5c565faa31884be7c0e380d025f07eb6c1ca209eaf29be7caeaaaa0e90bbe455138239c67fe6aadd48ee
7
- data.tar.gz: b6f5fdfaffb22ca0fa711d5ccdc7054cca15d228b225338c27c8a4315cbe4d57383a977c61a0ab939fa522e0317ab043a61e602019566714b4e8bee08a5135cf
6
+ metadata.gz: 245f15fbcf916a95d67660e6c8c7515bc24d354afdd4e8dc1b23ab6db4611702aa5e14480f45ff24d9f282092fae3dcae68fd508c524032f997ea70de08e4ad8
7
+ data.tar.gz: 547697109c98a7ba4696fdb7233ad30c17fad9c1d0c8f4210b913ff1cb17fd0bd9b1010bdef05b326175fc71f15cc262d4563694bf69d36f1f0bb2804268305d
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 MetalpriceAPI
3
+ Copyright (c) 2025 MetalpriceAPI
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -51,6 +51,21 @@ client.fetchHistorical(date='2021-04-05', base='USD', currencies=['XAU', 'XAG',
51
51
 
52
52
  [Link](https://metalpriceapi.com/documentation#api_historical)
53
53
 
54
+ ---
55
+ #### fetchOHLC(base, currency, date, unit, dateType)
56
+
57
+ - `base` <[string]> Optional. Pass in a base currency, defaults to USD.
58
+ - `currency` <[string]> Required. Specify currency you would like to get OHLC for.
59
+ - `date` <[string]> Required. Specify date to get OHLC for specific date using format `YYYY-MM-DD`.
60
+ - `unit` <[string]> Optional. Pass in a unit, defaults to troy_oz.
61
+ - `dateType` <[string]> Optional. Pass in a date type, overrides date parameter if passed in.
62
+
63
+ ```ruby
64
+ client.fetchOHLC(base='USD', currency='XAU', date='2024-02-05', unit='troy_oz', dateType=nil)
65
+ ```
66
+
67
+ [Link](https://metalpriceapi.com/documentation#api_ohlc)
68
+
54
69
  ---
55
70
  #### convert(from_currency, to_currency, amount, date)
56
71
 
@@ -92,10 +107,26 @@ client.change(start_date='2021-04-05', end_date='2021-04-06', base='USD', curren
92
107
  ```
93
108
 
94
109
  [Link](https://metalpriceapi.com/documentation#api_change)
110
+ ---
111
+ #### carat(start_date, end_date, base, currencies)
112
+
113
+ - `base` <[string]> Optional. Pass in a base currency, defaults to USD.
114
+ - `date` <[string]> Optional. Specify date to get Carat for specific date using format `YYYY-MM-DD`. If not specified, uses live rates.
115
+
116
+ ```ruby
117
+ client.carat(base='USD', date='2021-04-06')
118
+ ```
119
+
120
+ [Link](https://metalpriceapi.com/documentation#api_carat)
95
121
 
96
122
  ---
97
- **[Official documentation](https://metalpriceapi.com/documentation)**
123
+ #### usage()
124
+
125
+ ```ruby
126
+ client.usage()
127
+ ```
98
128
 
129
+ [Link](https://metalpriceapi.com/documentation#api_usage)
99
130
 
100
131
  ---
101
132
  ## FAQ
@@ -22,6 +22,17 @@ module MetalpriceAPI
22
22
  get(date, options)
23
23
  end
24
24
 
25
+ def fetchOHLC(base = nil, currency = nil, date = nil, unit = nil, dateType = nil)
26
+ options = removeEmpty({
27
+ base: base,
28
+ currency: currency,
29
+ date: date,
30
+ unit: unit,
31
+ dateType: dateType
32
+ })
33
+ get('ohlc', options)
34
+ end
35
+
25
36
  def convert(from_currency = nil, to_currency = nil, amount = nil, date = nil)
26
37
  options = removeEmpty({
27
38
  'from': from_currency,
@@ -52,6 +63,18 @@ module MetalpriceAPI
52
63
  get('change', options)
53
64
  end
54
65
 
66
+ def carat(base = '', date = nil)
67
+ options = removeEmpty({
68
+ 'base': base,
69
+ 'date': date
70
+ })
71
+ get('carat', options)
72
+ end
73
+
74
+ def usage
75
+ get('usage')
76
+ end
77
+
55
78
  private
56
79
 
57
80
  def removeEmpty(options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MetalpriceAPI
4
- VERSION = '1.0.2'
4
+ VERSION = '1.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metalpriceapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MetalpriceAPI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-19 00:00:00.000000000 Z
11
+ date: 2025-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday