crypto-news-api 1.0.1 → 1.2.0
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 +4 -4
- data/README.md +15 -1
- data/lib/crypto-news-api.rb +10 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c55a65c80c0f2629f0ca692c133a8c8b75a3294b
|
4
|
+
data.tar.gz: 8e384284753d3a8a2a0553343b3715cf9c2926e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a1dcee6cf346fbea25fa23e903a9a6aca5b7252782c823fc7d1e8b0577a5862d2ccbf3dfefeae33b5e9ff7ef1e1986347da28506e6200429b100176fbf3763a
|
7
|
+
data.tar.gz: 8ee89d4ecab6c96d66974908ec5ffd71f4a28738211de9a63ad5285f9b1a7453514a4e870827c1f793fa85de78d1cfdc955746638d0fc9a42abfaf7d9db93d73
|
data/README.md
CHANGED
@@ -17,6 +17,9 @@ require "crypto-news-api"
|
|
17
17
|
|
18
18
|
api = CryptoControl::QueryAPI.new("API_KEY_HERE")
|
19
19
|
|
20
|
+
# Enable the sentiment datapoints
|
21
|
+
api.getTopNews
|
22
|
+
|
20
23
|
# Get top news
|
21
24
|
puts api.getTopNews
|
22
25
|
|
@@ -61,10 +64,21 @@ puts api.getCoinDetails "ethereum"
|
|
61
64
|
- **getLatestItemsByCoin(coin: String, lang?: enum)** Get reddit/tweets/articles (seperated) for a particular coin (sorted by relevance)
|
62
65
|
- **getCoinDetails(coin: String)** Get all details about a particular coin (links, description, subreddits, twitter etc..)
|
63
66
|
|
64
|
-
`lang` allows developers to choose which language they'd like to get the feed. Currently CryptoControl supports
|
67
|
+
`lang` allows developers to choose which language they'd like to get the feed. Currently the CryptoControl API supports the following languages:
|
68
|
+
- English (`en` default)
|
69
|
+
- Chinese/Mandarin (`cn`)
|
70
|
+
- German (`de`)
|
71
|
+
- Italian (`it`)
|
72
|
+
- Japanese (`jp`)
|
73
|
+
- Korean (`ko`)
|
74
|
+
- Portuguese (`po`)
|
75
|
+
- Russian (`ru`)
|
76
|
+
- Spanish (`es`)
|
65
77
|
|
66
78
|
The coin slugs are the coin id's used from the CoinMarketCap api. You can see the full list of coins here: [https://api.coinmarketcap.com/v1/ticker/?limit=2000](https://api.coinmarketcap.com/v1/ticker/?limit=2000)
|
67
79
|
|
80
|
+
`enableSentiment()` will tell CrpytoControl to return articles/reddit/twitter with sentiment datapoints as well (ie. how much +ve/-ve an article is). This feature is for [CryptoControl premium users](https://cryptocontrol.io/en/about/premium) only.
|
81
|
+
|
68
82
|
## Sample response from the server
|
69
83
|
|
70
84
|
```javascript
|
data/lib/crypto-news-api.rb
CHANGED
@@ -9,17 +9,19 @@ module CryptoControl
|
|
9
9
|
def initialize(apiKey, proxyURL = nil)
|
10
10
|
@apiKey = apiKey
|
11
11
|
@proxyURL = proxyURL
|
12
|
+
@sentiment = false
|
12
13
|
end
|
13
14
|
|
14
15
|
|
15
16
|
def fetch (url)
|
16
17
|
host = @proxyURL ? @proxyURL : 'https://cryptocontrol.io/api/v1/public'
|
17
|
-
|
18
|
-
|
18
|
+
sentiment = "sentiment=#{@sentiment}"
|
19
|
+
url = URI.parse("#{host}#{url}#{url.include?("?") ? "&" : "?" }#{sentiment}")
|
19
20
|
https = Net::HTTP.new(url.host, url.port)
|
20
21
|
https.use_ssl = true
|
21
22
|
|
22
23
|
headers = {
|
24
|
+
'user-agent' => 'CryptoControl Ruby API v1.2.0'
|
23
25
|
'content-type' =>'application/json',
|
24
26
|
'x-api-key' => @apiKey
|
25
27
|
}
|
@@ -30,6 +32,11 @@ module CryptoControl
|
|
30
32
|
end
|
31
33
|
|
32
34
|
|
35
|
+
def enableSentiment()
|
36
|
+
@sentiment = true
|
37
|
+
end
|
38
|
+
|
39
|
+
|
33
40
|
def getKeyDetails
|
34
41
|
fetch '/'
|
35
42
|
end
|
@@ -108,4 +115,4 @@ module CryptoControl
|
|
108
115
|
fetch "/details/coin/#{coin}"
|
109
116
|
end
|
110
117
|
end
|
111
|
-
end
|
118
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crypto-news-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Enamakel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Client to get a crypto newsfeed in your app from the CryptoControl API
|
14
14
|
email:
|