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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -1
  3. data/lib/crypto-news-api.rb +10 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab6cd086744bffc7b7a93e70f1eefd145c963898
4
- data.tar.gz: 5d1227fd81f7fe3c1178b479ddbbae99495eaf9c
3
+ metadata.gz: c55a65c80c0f2629f0ca692c133a8c8b75a3294b
4
+ data.tar.gz: 8e384284753d3a8a2a0553343b3715cf9c2926e8
5
5
  SHA512:
6
- metadata.gz: b88a75d3da41c3501c958d8a9d768743e7dfdb1a5cbdba66bce4321c4168745041d6fb8fed394ecc6a6c4968131a4af7e398e700e133bf99755d948deceb2bc6
7
- data.tar.gz: bde0a4b103d9ca964a801940cf6a55b85d5783a1d15bb643b35df0e5eaeac7cdf956a480264842fd340f3b69eae9b3aadd393262e9909678d547a2ec9baf7db7
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 English (`en`) and Russian (`ru`) article feeds.
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
@@ -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
- url = URI.parse("#{host}#{url}")
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.1
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-07-24 00:00:00.000000000 Z
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: