iex-ruby-client 0.4.1 → 0.4.2

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
  SHA1:
3
- metadata.gz: 31f82e417e023dae4b43a116a26c363f998452ee
4
- data.tar.gz: f567de4892dbc778d9c4a285269d9fb2bfc2a204
3
+ metadata.gz: c7e9b5e2e6d7d24bdd96a69cc425066f793e3d37
4
+ data.tar.gz: d5173ee19bc5a824a9ba55e297911c895fe77b69
5
5
  SHA512:
6
- metadata.gz: 8682c270ea7b9fb8a19deb4b6423252bcbd4b8fd1bdfb5b1805b28d94866309a126bbccea0c70b6c1b58e00e216e2315509f982bac3c20f701a1e5882a1d50a5
7
- data.tar.gz: ea4d46ac096195a920681dc104a1822d97544c97a1089b2a386030f76e284147b6581e64fb87a20742c0f75695d1ec2a27749159240c907fe5e57f6f3701c19c
6
+ metadata.gz: 89c30e29f8fc386597b870ec70f4181f8a7b3db659fc6532caea0c439b0fde7f91375bb8575fe0c8fe0fefbfc0c87d1fe0a0cd56ba87930a2cc41e4bf0d50e9e
7
+ data.tar.gz: 34697845fe238e7ac05e9a77da770e87fb191aba6865a5291567caed7860aa5afe072d1df2f591e068723028ce4c906f67f87877dd859f43757d77e8c7f517d0
@@ -1,17 +1,17 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-08-05 20:08:18 -0400 using RuboCop version 0.51.0.
3
+ # on 2018-08-13 14:38:05 -0400 using RuboCop version 0.51.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 9
9
+ # Offense count: 11
10
10
  # Configuration parameters: CountComments, ExcludedMethods.
11
11
  Metrics/BlockLength:
12
- Max: 85
12
+ Max: 86
13
13
 
14
- # Offense count: 64
14
+ # Offense count: 67
15
15
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
16
16
  # URISchemes: http, https
17
17
  Metrics/LineLength:
@@ -33,6 +33,6 @@ Style/DateTime:
33
33
  - 'lib/iex/resources/news.rb'
34
34
  - 'spec/iex/resources/news_spec.rb'
35
35
 
36
- # Offense count: 26
36
+ # Offense count: 28
37
37
  Style/Documentation:
38
38
  Enabled: false
@@ -4,3 +4,6 @@ cache: bundler
4
4
 
5
5
  rvm:
6
6
  - 2.4.1
7
+
8
+ before_script:
9
+ - bundle exec danger
@@ -1,3 +1,8 @@
1
+ ### 0.4.2 (2018/08/14)
2
+
3
+ * [#24](https://github.com/dblock/iex-ruby-client/pull/24): Add danger-toc and danger-changelog - [@rodolfobandeira](https://github.com/rodolfobandeira).
4
+ * [#21](https://github.com/dblock/iex-ruby-client/pull/21): Added `IEX::Resources::Dividends` - [@rodolfobandeira](https://github.com/rodolfobandeira).
5
+
1
6
  ### 0.4.1 (2018/08/07)
2
7
 
3
8
  * [#18](https://github.com/dblock/iex-ruby-client/pull/18): Added `IEX::Resources::KeyStats` - [@rodolfobandeira](https://github.com/rodolfobandeira).
@@ -9,8 +14,8 @@
9
14
 
10
15
  ### 0.3.3 (2018/07/06)
11
16
 
12
- * [#5](https://github.com/dblock/iex-ruby-client/pull/5): Added `IEX::Resources::OHLC#get` - [@jromanovs](https://github.com/jromanovs).
13
- * [#5](https://github.com/dblock/iex-ruby-client/pull/5): Added `IEX::Resources::OHLC#market` - [@jromanovs](https://github.com/jromanovs).
17
+ * [#5](https://github.com/dblock/iex-ruby-client/pull/5): Added `IEX::Resources::OHLC#get` - [@jromanovs](https://github.com/jromanovs).
18
+ * [#5](https://github.com/dblock/iex-ruby-client/pull/5): Added `IEX::Resources::OHLC#market` - [@jromanovs](https://github.com/jromanovs).
14
19
 
15
20
  ### 0.3.2 (2018/05/26)
16
21
 
@@ -0,0 +1,2 @@
1
+ toc.check
2
+ changelog.check
data/Gemfile CHANGED
@@ -1,3 +1,12 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ group :development do
6
+ gem 'pry'
7
+ end
8
+
9
+ group :test do
10
+ gem 'danger-changelog', '~> 0.3.0'
11
+ gem 'danger-toc', '~> 0.1'
12
+ end
data/README.md CHANGED
@@ -6,6 +6,29 @@ IEX Finance API
6
6
 
7
7
  A Ruby client for the [IEX Finance API](https://iextrading.com/developer).
8
8
 
9
+
10
+ # Table of Contents
11
+
12
+ - [Installation](#installation)
13
+ - [Methods Available:](#methods-available)
14
+ - [Usage](#usage)
15
+ - [Get a Single Price](#get-a-single-price)
16
+ - [Get a Quote](#get-a-quote)
17
+ - [Get a OHLC (Open, High, Low, Close) price](#get-a-ohlc-open-high-low-close-price)
18
+ - [Get a market OHLC (Open, High, Low, Close) prices](#get-a-market-ohlc-open-high-low-close-prices)
19
+ - [Get Company Information](#get-company-information)
20
+ - [Get a Company Logo](#get-a-company-logo)
21
+ - [Get Recent News](#get-recent-news)
22
+ - [Get Chart](#get-chart)
23
+ - [Get Key Stats](#get-key-stats)
24
+ - [Get Dividends](#get-dividends)
25
+ - [Errors](#errors)
26
+ - [SymbolNotFound](#symbolnotfound)
27
+ - [ClientError](#clienterror)
28
+ - [Contributing](#contributing)
29
+ - [Copyright and License](#copyright-and-license)
30
+
31
+
9
32
  ## Installation
10
33
 
11
34
  Add to Gemfile.
@@ -28,6 +51,7 @@ Run `bundle install`.
28
51
  - [Get Recent News](#get-recent-news)
29
52
  - [Get Chart](#get-chat)
30
53
  - [Get Key Stats](#get-key-stats)
54
+ - [Get Dividends](#get-dividends)
31
55
 
32
56
 
33
57
  ## Usage
@@ -154,14 +178,9 @@ first.high # 94.97
154
178
  You can specify a chart range and additional options.
155
179
 
156
180
  ```ruby
157
- # 1d or 1m data depending on the day or week and time of day
158
- IEX::Resources::Chart.get('MSFT', 'dynamic')
159
-
160
- # a specific date
161
- IEX::Resources::Chart.get('MSFT', Date.new(2018, 3, 26))
162
-
163
- # every n-th data point
164
- IEX::Resources::Chart.get('MSFT', '1d', chart_interval: 10)
181
+ IEX::Resources::Chart.get('MSFT', 'dynamic') # 1d or 1m data depending on the day or week and time of day
182
+ IEX::Resources::Chart.get('MSFT', Date.new(2018, 3, 26)) # a specific date
183
+ IEX::Resources::Chart.get('MSFT', '1d', chart_interval: 10) # every n-th data point
165
184
  ```
166
185
 
167
186
  ### Get Key Stats
@@ -237,6 +256,25 @@ key_stats.day_5_change_percent_s # '-0.10%'
237
256
  ```
238
257
  See [#key-stats](https://iextrading.com/developer/docs/#key-stats) for detailed documentation or [key_stats.rb](lib/iex/resources/key_stats.rb) for returned fields.
239
258
 
259
+ ### Get Dividends
260
+
261
+ Fetches dividends for a symbol.
262
+
263
+ ```ruby
264
+ dividends = IEX::Resources::Dividends.get('MSFT', '6m') # Options are: 5y, 2y, 1y, ytd, 6m, 3m, 1m
265
+
266
+ dividends.payment_date # '2018-03-08'
267
+ dividends.record_date # '2018-02-15'
268
+ dividends.declared_date # '2017-11-29'
269
+ dividends.amount # 0.42
270
+ dividends.amount_dollar # '$0.42'
271
+ dividends.flag # ''
272
+ dividends.type # 'Dividend income'
273
+ dividends.qualified # 'Q'
274
+ dividends.indicated # ''
275
+ ```
276
+ See [#dividends](https://iextrading.com/developer/docs/#dividends) for detailed documentation or [dividends.rb](lib/iex/resources/dividends.rb) for returned fields.
277
+
240
278
 
241
279
  ## Errors
242
280
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'faraday', '>= 0.9'
19
19
  s.add_dependency 'faraday_middleware'
20
20
  s.add_dependency 'hashie'
21
- s.add_dependency 'money_helper'
21
+ s.add_dependency 'money_helper', '~> 1.0'
22
22
  s.add_development_dependency 'rake', '~> 10'
23
23
  s.add_development_dependency 'rspec'
24
24
  s.add_development_dependency 'rubocop', '0.51.0'
@@ -19,6 +19,7 @@ end
19
19
 
20
20
  require_relative 'api/chart'
21
21
  require_relative 'api/company'
22
+ require_relative 'api/dividends'
22
23
  require_relative 'api/logo'
23
24
  require_relative 'api/key_stats'
24
25
  require_relative 'api/news'
@@ -0,0 +1,18 @@
1
+ module IEX
2
+ module Api
3
+ module Dividends
4
+ def self.get(symbol, range = nil)
5
+ connection(symbol, range).get.body
6
+ end
7
+
8
+ def self.connection(symbol, range = nil)
9
+ IEX::Api.default_connection [
10
+ symbol,
11
+ 'dividends',
12
+ range ? '6m' : nil,
13
+ range
14
+ ].compact.join('/')
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,9 +1,11 @@
1
1
  require_relative 'resources/resource'
2
- require_relative 'resources/quote'
2
+
3
+ require_relative 'resources/chart'
3
4
  require_relative 'resources/company'
4
- require_relative 'resources/price'
5
+ require_relative 'resources/dividends'
6
+ require_relative 'resources/key_stats'
7
+ require_relative 'resources/logo'
5
8
  require_relative 'resources/news'
6
- require_relative 'resources/chart'
7
9
  require_relative 'resources/ohlc'
8
- require_relative 'resources/logo'
9
- require_relative 'resources/key_stats'
10
+ require_relative 'resources/price'
11
+ require_relative 'resources/quote'
@@ -0,0 +1,31 @@
1
+ require_relative 'base'
2
+
3
+ module IEX
4
+ module Resources
5
+ class Dividends < Resource
6
+ property 'payment_date', from: 'paymentDate'
7
+ property 'record_date', from: 'recordDate'
8
+ property 'declared_date', from: 'declaredDate'
9
+ property 'amount'
10
+ property 'amount_dollar'
11
+ property 'flag'
12
+ property 'type'
13
+ property 'qualified'
14
+ property 'indicated'
15
+
16
+ def initialize(data)
17
+ super
18
+ # TODO: require Hashie >= 2.5.8, see https://github.com/intridea/hashie/pull/457
19
+ self['amount_dollar'] = Base.to_dollar(amount: amount, ignore_cents: false)
20
+ end
21
+
22
+ def self.get(stock_symbol, range = nil)
23
+ Base.symbol(stock_symbol) do
24
+ IEX::Api::Dividends.get(stock_symbol, range).map do |data|
25
+ new data
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -26,7 +26,7 @@ module IEX
26
26
  property 'symbol'
27
27
  property 'ebitda', from: 'EBITDA'
28
28
  property 'revenue'
29
- property 'revenue_dollar', from: 'revenue', with: ->(v) { Base.to_dollar(amount: v) }
29
+ property 'revenue_dollar'
30
30
  property 'gross_profit', from: 'grossProfit'
31
31
  property 'gross_profit_dollar', from: 'grossProfit', with: ->(v) { Base.to_dollar(amount: v) }
32
32
  property 'cash'
@@ -71,6 +71,12 @@ module IEX
71
71
  property 'day_5_change_percent', from: 'day5ChangePercent'
72
72
  property 'day_5_change_percent_s', from: 'day5ChangePercent', with: ->(v) { Base.float_to_percentage(v) }
73
73
 
74
+ def initialize(data = {})
75
+ super
76
+ # TODO: require Hashie >= 2.5.8, see https://github.com/intridea/hashie/pull/457
77
+ self['revenue_dollar'] = Base.to_dollar(amount: revenue)
78
+ end
79
+
74
80
  def self.get(symbol)
75
81
  new IEX::Api::KeyStats.get(symbol)
76
82
  rescue Faraday::ResourceNotFound => e
@@ -1,3 +1,3 @@
1
1
  module IEX
2
- VERSION = '0.4.1'.freeze
2
+ VERSION = '0.4.2'.freeze
3
3
  end
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.iextrading.com/1.0/stock/INVALID/dividends/6m/INVALID
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 404
19
+ message: Not Found
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Fri, 10 Aug 2018 19:58:42 GMT
25
+ Content-Type:
26
+ - text/html; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - ctoken=b745053a8bbf4a93bb35eb797014e8bd; Domain=.iextrading.com; Path=/; Expires=Sat,
33
+ 11 Aug 2018 07:58:42 GMT; Secure
34
+ Content-Security-Policy:
35
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
36
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
37
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
38
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
39
+ 'self' 'unsafe-inline' 'unsafe-eval';
40
+ X-Content-Security-Policy:
41
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
42
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
43
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
44
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
45
+ 'self' 'unsafe-inline' 'unsafe-eval';
46
+ Frame-Options:
47
+ - SAMEORIGIN
48
+ X-Frame-Options:
49
+ - SAMEORIGIN
50
+ Strict-Transport-Security:
51
+ - max-age=15768000
52
+ Access-Control-Allow-Origin:
53
+ - "*"
54
+ Access-Control-Allow-Credentials:
55
+ - 'true'
56
+ Access-Control-Allow-Methods:
57
+ - GET, OPTIONS
58
+ Access-Control-Allow-Headers:
59
+ - Origin, X-Requested-With, Content-Type, Accept
60
+ body:
61
+ encoding: ASCII-8BIT
62
+ string: Unknown symbol
63
+ http_version:
64
+ recorded_at: Fri, 10 Aug 2018 19:58:42 GMT
65
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,69 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.iextrading.com/1.0/stock/MSFT/dividends/6m/6m
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Fri, 10 Aug 2018 19:58:42 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Content-Length:
28
+ - '371'
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - ctoken=4cd7bd7bcc2c4ee4b5db344ca760c90c; Domain=.iextrading.com; Path=/; Expires=Sat,
33
+ 11 Aug 2018 07:58:42 GMT; Secure
34
+ Content-Security-Policy:
35
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
36
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
37
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
38
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
39
+ 'self' 'unsafe-inline' 'unsafe-eval';
40
+ X-Content-Security-Policy:
41
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
42
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
43
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
44
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
45
+ 'self' 'unsafe-inline' 'unsafe-eval';
46
+ Frame-Options:
47
+ - SAMEORIGIN
48
+ X-Frame-Options:
49
+ - SAMEORIGIN
50
+ X-Content-Type-Options:
51
+ - nosniff
52
+ Strict-Transport-Security:
53
+ - max-age=15768000
54
+ Access-Control-Allow-Origin:
55
+ - "*"
56
+ Access-Control-Allow-Credentials:
57
+ - 'true'
58
+ Access-Control-Allow-Methods:
59
+ - GET, OPTIONS
60
+ Access-Control-Allow-Headers:
61
+ - Origin, X-Requested-With, Content-Type, Accept
62
+ body:
63
+ encoding: UTF-8
64
+ string: '[{"exDate":"2018-02-14","paymentDate":"2018-03-08","recordDate":"2018-02-15","declaredDate":"2017-11-29","amount":0.42,"flag":"","type":"Dividend
65
+ income","qualified":"Q","indicated":""},{"exDate":"2017-11-15","paymentDate":"2017-12-14","recordDate":"2017-11-16","declaredDate":"2017-09-19","amount":0.42,"flag":"","type":"Dividend
66
+ income","qualified":"Q","indicated":""}]'
67
+ http_version:
68
+ recorded_at: Fri, 10 Aug 2018 19:58:42 GMT
69
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,69 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.iextrading.com/1.0/stock/MSFT/dividends/6m/1y
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Fri, 10 Aug 2018 19:58:42 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Content-Length:
28
+ - '371'
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - ctoken=36ba9e13ade0470e938240d302a243c1; Domain=.iextrading.com; Path=/; Expires=Sat,
33
+ 11 Aug 2018 07:58:42 GMT; Secure
34
+ Content-Security-Policy:
35
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
36
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
37
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
38
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
39
+ 'self' 'unsafe-inline' 'unsafe-eval';
40
+ X-Content-Security-Policy:
41
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
42
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
43
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
44
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
45
+ 'self' 'unsafe-inline' 'unsafe-eval';
46
+ Frame-Options:
47
+ - SAMEORIGIN
48
+ X-Frame-Options:
49
+ - SAMEORIGIN
50
+ X-Content-Type-Options:
51
+ - nosniff
52
+ Strict-Transport-Security:
53
+ - max-age=15768000
54
+ Access-Control-Allow-Origin:
55
+ - "*"
56
+ Access-Control-Allow-Credentials:
57
+ - 'true'
58
+ Access-Control-Allow-Methods:
59
+ - GET, OPTIONS
60
+ Access-Control-Allow-Headers:
61
+ - Origin, X-Requested-With, Content-Type, Accept
62
+ body:
63
+ encoding: UTF-8
64
+ string: '[{"exDate":"2018-02-14","paymentDate":"2018-03-08","recordDate":"2018-02-15","declaredDate":"2017-11-29","amount":0.42,"flag":"","type":"Dividend
65
+ income","qualified":"Q","indicated":""},{"exDate":"2017-11-15","paymentDate":"2017-12-14","recordDate":"2017-11-16","declaredDate":"2017-09-19","amount":0.42,"flag":"","type":"Dividend
66
+ income","qualified":"Q","indicated":""}]'
67
+ http_version:
68
+ recorded_at: Fri, 10 Aug 2018 19:58:42 GMT
69
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,68 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.iextrading.com/1.0/stock/MSFT/dividends
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Sat, 11 Aug 2018 13:16:51 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Content-Length:
28
+ - '186'
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - ctoken=ccb88e016a434ff3b028933badc76184; Domain=.iextrading.com; Path=/; Expires=Sun,
33
+ 12 Aug 2018 01:16:51 GMT; Secure
34
+ Content-Security-Policy:
35
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
36
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
37
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
38
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
39
+ 'self' 'unsafe-inline' 'unsafe-eval';
40
+ X-Content-Security-Policy:
41
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
42
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
43
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
44
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
45
+ 'self' 'unsafe-inline' 'unsafe-eval';
46
+ Frame-Options:
47
+ - SAMEORIGIN
48
+ X-Frame-Options:
49
+ - SAMEORIGIN
50
+ X-Content-Type-Options:
51
+ - nosniff
52
+ Strict-Transport-Security:
53
+ - max-age=15768000
54
+ Access-Control-Allow-Origin:
55
+ - "*"
56
+ Access-Control-Allow-Credentials:
57
+ - 'true'
58
+ Access-Control-Allow-Methods:
59
+ - GET, OPTIONS
60
+ Access-Control-Allow-Headers:
61
+ - Origin, X-Requested-With, Content-Type, Accept
62
+ body:
63
+ encoding: UTF-8
64
+ string: '[{"exDate":"2018-02-14","paymentDate":"2018-03-08","recordDate":"2018-02-15","declaredDate":"2017-11-29","amount":0.42,"flag":"","type":"Dividend
65
+ income","qualified":"Q","indicated":""}]'
66
+ http_version:
67
+ recorded_at: Sat, 11 Aug 2018 13:16:51 GMT
68
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,69 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.iextrading.com/1.0/stock/MSFT/dividends/6m/INVALID
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Sat, 11 Aug 2018 13:18:55 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Content-Length:
28
+ - '371'
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - ctoken=810c099ba2f8423e9f5adb38c85efd59; Domain=.iextrading.com; Path=/; Expires=Sun,
33
+ 12 Aug 2018 01:18:55 GMT; Secure
34
+ Content-Security-Policy:
35
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
36
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
37
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
38
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
39
+ 'self' 'unsafe-inline' 'unsafe-eval';
40
+ X-Content-Security-Policy:
41
+ - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
42
+ 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
43
+ https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
44
+ wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
45
+ 'self' 'unsafe-inline' 'unsafe-eval';
46
+ Frame-Options:
47
+ - SAMEORIGIN
48
+ X-Frame-Options:
49
+ - SAMEORIGIN
50
+ X-Content-Type-Options:
51
+ - nosniff
52
+ Strict-Transport-Security:
53
+ - max-age=15768000
54
+ Access-Control-Allow-Origin:
55
+ - "*"
56
+ Access-Control-Allow-Credentials:
57
+ - 'true'
58
+ Access-Control-Allow-Methods:
59
+ - GET, OPTIONS
60
+ Access-Control-Allow-Headers:
61
+ - Origin, X-Requested-With, Content-Type, Accept
62
+ body:
63
+ encoding: UTF-8
64
+ string: '[{"exDate":"2018-02-14","paymentDate":"2018-03-08","recordDate":"2018-02-15","declaredDate":"2017-11-29","amount":0.42,"flag":"","type":"Dividend
65
+ income","qualified":"Q","indicated":""},{"exDate":"2017-11-15","paymentDate":"2017-12-14","recordDate":"2017-11-16","declaredDate":"2017-09-19","amount":0.42,"flag":"","type":"Dividend
66
+ income","qualified":"Q","indicated":""}]'
67
+ http_version:
68
+ recorded_at: Sat, 11 Aug 2018 13:18:55 GMT
69
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,56 @@
1
+ require 'spec_helper'
2
+
3
+ describe IEX::Resources::Dividends do
4
+ context 'known symbol' do
5
+ context 'with defaults', vcr: { cassette_name: 'dividends/msft' } do
6
+ subject do
7
+ IEX::Resources::Dividends.get('MSFT', '6m')
8
+ end
9
+ let(:dividends) { subject.first }
10
+ it 'retrieves dividends' do
11
+ expect(dividends.payment_date).to eq '2018-03-08'
12
+ expect(dividends.record_date).to eq '2018-02-15'
13
+ expect(dividends.declared_date).to eq '2017-11-29'
14
+ expect(dividends.amount_dollar).to eq '$0.42'
15
+ expect(dividends.flag).to eq ''
16
+ expect(dividends.type).to eq 'Dividend income'
17
+ expect(dividends.qualified).to eq 'Q'
18
+ expect(dividends.indicated).to eq ''
19
+ end
20
+ end
21
+ context 'without range', vcr: { cassette_name: 'dividends/msft_default_range' } do
22
+ subject do
23
+ IEX::Resources::Dividends.get('MSFT')
24
+ end
25
+ it 'retrieves dividends when no range is passed' do
26
+ expect(subject.size).to eq 1
27
+ end
28
+ end
29
+ context 'invalid range', vcr: { cassette_name: 'dividends/msft_invalid_range' } do
30
+ subject do
31
+ IEX::Resources::Dividends.get('MSFT', 'INVALID')
32
+ end
33
+ let(:dividends) { subject.first }
34
+ it 'retrieves dividends when invalid range is passed' do
35
+ expect(subject.size).to eq 2 # Falls into default 1 year
36
+ expect(dividends.type).to eq 'Dividend income'
37
+ end
38
+ end
39
+ context 'with range', vcr: { cassette_name: 'dividends/msft_1y' } do
40
+ subject do
41
+ IEX::Resources::Dividends.get('MSFT', '1y')
42
+ end
43
+ it 'retrieves dividends with range of 1 year' do
44
+ expect(subject.size).to eq 2
45
+ end
46
+ end
47
+ end
48
+ context 'invalid symbol', vcr: { cassette_name: 'dividends/invalid' } do
49
+ subject do
50
+ IEX::Resources::Dividends.get('INVALID', 'INVALID')
51
+ end
52
+ it 'fails with SymbolNotFoundError' do
53
+ expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
54
+ end
55
+ end
56
+ end
@@ -38,6 +38,7 @@ describe IEX::Resources::KeyStats do
38
38
  expect(subject.eps_surprise_percent).to eq 11.6279
39
39
  expect(subject.eps_surprise_percent_s).to eq '+1162.79%'
40
40
  expect(subject.ebitda).to eq 23_558_000_000
41
+ expect(subject.revenue).to eq 53_456_000_000
41
42
  expect(subject.revenue_dollar).to eq '$53,456,000,000'
42
43
  expect(subject.gross_profit).to eq 34_114_000_000
43
44
  expect(subject.gross_profit_dollar).to eq '$34,114,000,000'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iex-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-08 00:00:00.000000000 Z
11
+ date: 2018-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: money_helper
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '1.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -149,6 +149,7 @@ files:
149
149
  - ".travis.yml"
150
150
  - CHANGELOG.md
151
151
  - CONTRIBUTING.md
152
+ - Dangerfile
152
153
  - Gemfile
153
154
  - LICENSE.md
154
155
  - README.md
@@ -160,6 +161,7 @@ files:
160
161
  - lib/iex/api.rb
161
162
  - lib/iex/api/chart.rb
162
163
  - lib/iex/api/company.rb
164
+ - lib/iex/api/dividends.rb
163
165
  - lib/iex/api/key_stats.rb
164
166
  - lib/iex/api/logo.rb
165
167
  - lib/iex/api/news.rb
@@ -176,6 +178,7 @@ files:
176
178
  - lib/iex/resources/chart/default.rb
177
179
  - lib/iex/resources/chart/one_day.rb
178
180
  - lib/iex/resources/company.rb
181
+ - lib/iex/resources/dividends.rb
179
182
  - lib/iex/resources/key_stats.rb
180
183
  - lib/iex/resources/logo.rb
181
184
  - lib/iex/resources/news.rb
@@ -195,6 +198,11 @@ files:
195
198
  - spec/fixtures/iex/chart/msft.yml
196
199
  - spec/fixtures/iex/company/invalid.yml
197
200
  - spec/fixtures/iex/company/msft.yml
201
+ - spec/fixtures/iex/dividends/invalid.yml
202
+ - spec/fixtures/iex/dividends/msft.yml
203
+ - spec/fixtures/iex/dividends/msft_1y.yml
204
+ - spec/fixtures/iex/dividends/msft_default_range.yml
205
+ - spec/fixtures/iex/dividends/msft_invalid_range.yml
198
206
  - spec/fixtures/iex/key_stats/invalid.yml
199
207
  - spec/fixtures/iex/key_stats/msft.yml
200
208
  - spec/fixtures/iex/logo/msft.yml
@@ -211,6 +219,7 @@ files:
211
219
  - spec/iex/resources/base_spec.rb
212
220
  - spec/iex/resources/chart_spec.rb
213
221
  - spec/iex/resources/company_spec.rb
222
+ - spec/iex/resources/dividends_spec.rb
214
223
  - spec/iex/resources/key_stats_spec.rb
215
224
  - spec/iex/resources/logo_spec.rb
216
225
  - spec/iex/resources/news_spec.rb
@@ -254,6 +263,11 @@ test_files:
254
263
  - spec/fixtures/iex/chart/msft.yml
255
264
  - spec/fixtures/iex/company/invalid.yml
256
265
  - spec/fixtures/iex/company/msft.yml
266
+ - spec/fixtures/iex/dividends/invalid.yml
267
+ - spec/fixtures/iex/dividends/msft.yml
268
+ - spec/fixtures/iex/dividends/msft_1y.yml
269
+ - spec/fixtures/iex/dividends/msft_default_range.yml
270
+ - spec/fixtures/iex/dividends/msft_invalid_range.yml
257
271
  - spec/fixtures/iex/key_stats/invalid.yml
258
272
  - spec/fixtures/iex/key_stats/msft.yml
259
273
  - spec/fixtures/iex/logo/msft.yml
@@ -270,6 +284,7 @@ test_files:
270
284
  - spec/iex/resources/base_spec.rb
271
285
  - spec/iex/resources/chart_spec.rb
272
286
  - spec/iex/resources/company_spec.rb
287
+ - spec/iex/resources/dividends_spec.rb
273
288
  - spec/iex/resources/key_stats_spec.rb
274
289
  - spec/iex/resources/logo_spec.rb
275
290
  - spec/iex/resources/news_spec.rb