fedger_api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5653136eb2e79e1f24cbd1e03619ec9143053533
4
+ data.tar.gz: fa62748a29974c4dd9141472b9bdcdfd5034f1e7
5
+ SHA512:
6
+ metadata.gz: 258730820f3a827f717154bb973a4267bf2ddde9be887f8edaa0a0f2e4721f7b7ab801eae8c0e8108bca6ea9ee2472269e7dc1cfdd9163cd69b5a4e3038bd263
7
+ data.tar.gz: 703c0919074a1b44658e4ddca01db49fa1d36673a2fa5466a7890049bb8e8ea71df9f99c15f4b067c1ef7ac4a75c68153651c15de090f062afd2b4843161ce93
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /tmp/
8
+ /spec/fixtures/**/*
9
+ .idea
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ *.gem
15
+ mkmf.log
16
+ .ruby-gemset
17
+ .ruby-version
18
+ fedger_api.yml
19
+ .DS_Store
20
+ /.
data/.rubocop.yml ADDED
@@ -0,0 +1,19 @@
1
+ AllCops:
2
+ Exclude:
3
+ - stribog.gemspec
4
+ - Rakefile
5
+ - bin/test.rb
6
+ - lib/stribog/hash_params.rb
7
+ - spec/**/*
8
+
9
+ Metrics/LineLength:
10
+ Max: 100
11
+
12
+ Metrics/MethodLength:
13
+ Max: 13
14
+
15
+ Metrics/AbcSize:
16
+ Max: 20
17
+
18
+ Metrics/ClassLength:
19
+ Max: 120
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ cache: bundler
3
+ script: bundle exec rake spec
4
+ rvm:
5
+ - 2.2.0
6
+ before_script:
7
+ - cp fedger_api.yml.travis fedger_api.yml
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # A sample Gemfile
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,67 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fedger_api (0.0.1)
5
+ httparty (~> 0.13)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.4.0)
11
+ ast (2.3.0)
12
+ crack (0.4.3)
13
+ safe_yaml (~> 1.0.0)
14
+ diff-lcs (1.2.5)
15
+ hashdiff (0.3.0)
16
+ httparty (0.13.7)
17
+ json (~> 1.8)
18
+ multi_xml (>= 0.5.2)
19
+ json (1.8.3)
20
+ multi_xml (0.5.5)
21
+ parser (2.3.1.4)
22
+ ast (~> 2.2)
23
+ powerpack (0.1.1)
24
+ rainbow (2.1.0)
25
+ rake (11.1.2)
26
+ rspec (3.3.0)
27
+ rspec-core (~> 3.3.0)
28
+ rspec-expectations (~> 3.3.0)
29
+ rspec-mocks (~> 3.3.0)
30
+ rspec-core (3.3.2)
31
+ rspec-support (~> 3.3.0)
32
+ rspec-expectations (3.3.1)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.3.0)
35
+ rspec-mocks (3.3.2)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.3.0)
38
+ rspec-support (3.3.0)
39
+ rubocop (0.45.0)
40
+ parser (>= 2.3.1.1, < 3.0)
41
+ powerpack (~> 0.1)
42
+ rainbow (>= 1.99.1, < 3.0)
43
+ ruby-progressbar (~> 1.7)
44
+ unicode-display_width (~> 1.0, >= 1.0.1)
45
+ ruby-progressbar (1.8.1)
46
+ safe_yaml (1.0.4)
47
+ unicode-display_width (1.1.1)
48
+ vcr (3.0.1)
49
+ webmock (1.24.1)
50
+ addressable (>= 2.3.6)
51
+ crack (>= 0.3.2)
52
+ hashdiff
53
+
54
+ PLATFORMS
55
+ ruby
56
+
57
+ DEPENDENCIES
58
+ bundler (~> 1.13)
59
+ fedger_api!
60
+ rake (~> 11.0)
61
+ rspec (~> 3.0)
62
+ rubocop (~> 0.45)
63
+ vcr (~> 3.0)
64
+ webmock (~> 1.24)
65
+
66
+ BUNDLED WITH
67
+ 1.13.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 WildDima
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,59 @@
1
+ == Fedger_api
2
+
3
+ {<img src="https://travis-ci.org/WildDima/fedger_api.svg?branch=master"
4
+ alt="Build Status" />}[https://travis-ci.org/WildDima/fedger_api]
5
+
6
+ Ruby library for https://fedger.io api.
7
+ ------------
8
+ === Installation
9
+ ------------
10
+ Add this to your application's Gemfile:
11
+
12
+ gem 'fedger_api'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install fedger_api
21
+ ------------
22
+ === Example
23
+ ------------
24
+ More information about API on https://dev.fedger.io/docs
25
+
26
+ client = FedgerAPI::Client.new(api key)
27
+
28
+ ==== Company
29
+
30
+ #Returns a detailed funding history collection.
31
+ client.funding_details(company domain)
32
+
33
+ #Returns Total funding amount and current stage.
34
+ client.funding_status(company domain)
35
+
36
+ #Returns a detailed funding history collection.
37
+ client.fundings(company domain)
38
+
39
+ #Returns nodes connected to a company.
40
+ client.company_insights(company_domain)
41
+
42
+ #Returns a list of investors in a company.
43
+ client.investors(company_domain)
44
+
45
+ #Returns a list with city/country for operative sites of a company.
46
+ client.locations(company_domain)
47
+
48
+ #Returns company peers.
49
+ client.peers(company_domain)
50
+
51
+ #List of company names, an investor has invested in.
52
+ client.portfolio_companies(company_domain)
53
+
54
+ #Returns details of a company profile.
55
+ client.company_snapshot(company_domain)
56
+
57
+ #Returns team profiles for a company.
58
+ client.team_details(company_domain)
59
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,24 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'fedger_api/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'fedger_api'
7
+ s.version = FedgerAPI::VERSION
8
+ s.date = '2016-03-26'
9
+ s.summary = 'feger.io api gem'
10
+ s.description = 'feger.io api gem'
11
+ s.authors = ['Dmitry Topornin']
12
+ s.email = 'dtopornin@gmail.com'
13
+ s.files = `git ls-files -z`.split("\x0")
14
+ s.license = 'MIT'
15
+ s.homepage = 'https://github.com/WildDima/fedger_api'
16
+
17
+ s.add_dependency 'httparty', '~> 0.13'
18
+ s.add_development_dependency 'rubocop', '~> 0.45'
19
+ s.add_development_dependency 'bundler', '~> 1.13'
20
+ s.add_development_dependency 'rake', '~> 11.0'
21
+ s.add_development_dependency 'rspec', '~> 3.0'
22
+ s.add_development_dependency 'vcr', '~> 3.0'
23
+ s.add_development_dependency 'webmock', '~> 1.24'
24
+ end
@@ -0,0 +1,5 @@
1
+ api_key: ~
2
+ test_company: 'google.com'
3
+ discovery_query: 'google'
4
+ iso_country: 'RU'
5
+ year: '2016'
@@ -0,0 +1,66 @@
1
+ module FedgerAPI
2
+ class Client
3
+ # Company
4
+ module Company
5
+ # Returns a detailed funding history collection.
6
+ def funding_details(company_domain)
7
+ company_provider(company_domain, 'funding/details')
8
+ end
9
+
10
+ # Returns Total funding amount and current stage.
11
+ def funding_status(company_domain)
12
+ company_provider(company_domain, 'funding/status')
13
+ end
14
+
15
+ # Returns a detailed funding history collection.
16
+ def fundings(company_domain)
17
+ company_provider(company_domain, 'fundings')
18
+ end
19
+
20
+ # Returns nodes connected to a company.
21
+ def company_insights(company_domain)
22
+ company_provider(company_domain, 'insights')
23
+ end
24
+
25
+ # Returns a list of investors in a company.
26
+ def investors(company_domain)
27
+ company_provider(company_domain, 'investors')
28
+ end
29
+
30
+ # Returns a list with city/country for operative sites of a company.
31
+ def locations(company_domain)
32
+ company_provider(company_domain, 'locations')
33
+ end
34
+
35
+ # Returns company peers.
36
+ def peers(company_domain)
37
+ company_provider(company_domain, 'peers')
38
+ end
39
+
40
+ # List of company names, an investor has invested in.
41
+ def portfolio_companies(company_domain)
42
+ company_provider(company_domain, 'portfolio')
43
+ end
44
+
45
+ # Returns details of a company profile.
46
+ def company_snapshot(company_domain)
47
+ company_provider(company_domain, 'snapshot')
48
+ end
49
+
50
+ # Returns team profiles for a company.
51
+ def team_details(company_domain)
52
+ company_provider(company_domain, 'team/details')
53
+ end
54
+
55
+ private
56
+
57
+ def company_provider(company_domain, uri)
58
+ Response.new(company_request(company_domain, uri))
59
+ end
60
+
61
+ def company_request(company_domain, uri)
62
+ self.class.get("/company/#{company_domain}/#{uri}", merge_options)
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,31 @@
1
+ module FedgerAPI
2
+ class Client
3
+ # Discover
4
+ module Discover
5
+ # Returns a graph of vertices and edges matching the search query.
6
+ def discovery(query)
7
+ discovery_provider(query, '')
8
+ end
9
+
10
+ # Returns detailed corresponding companies matching the search query.
11
+ def discovery_companies(query)
12
+ discovery_provider(query, '/companies')
13
+ end
14
+
15
+ # Returns detailed corresponding vertices matching the search query.
16
+ def discovery_vertices(query)
17
+ discovery_provider(query, '/vertices')
18
+ end
19
+
20
+ private
21
+
22
+ def discovery_provider(query, uri)
23
+ Response.new(discovery_request(query, uri))
24
+ end
25
+
26
+ def discovery_request(query, uri)
27
+ self.class.get("/discover#{uri}", merge_options(s: query))
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ module FedgerAPI
2
+ class Client
3
+ # Geo
4
+ module Geo
5
+ # Returns companies by region.
6
+ def geo_located_companies(country_code)
7
+ geo_provider(country_code, '/company')
8
+ end
9
+
10
+ # Returns fundings by region.
11
+ def geo_located_fundings(country_code)
12
+ geo_provider(country_code, '/funding')
13
+ end
14
+
15
+ private
16
+
17
+ def geo_provider(country_code, uri)
18
+ Response.new(geo_request(country_code, uri))
19
+ end
20
+
21
+ def geo_request(country_code, uri)
22
+ self.class.get("/geo/#{country_code}#{uri}", merge_options)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ module FedgerAPI
2
+ class Client
3
+ # News
4
+ module News
5
+ # Returns a collection of the most recent fundings covered.
6
+ def latest_fundings
7
+ news_provider('/fundings')
8
+ end
9
+
10
+ private
11
+
12
+ def news_provider(uri)
13
+ Response.new(news_request(uri))
14
+ end
15
+
16
+ def news_request(uri)
17
+ self.class.get("/news#{uri}", merge_options)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module FedgerAPI
2
+ class Client
3
+ # Stats
4
+ module Stats
5
+ # TODO
6
+ def stats_fundings(year, query)
7
+ stats_provider(year, query, '/fundings')
8
+ end
9
+
10
+ private
11
+
12
+ def stats_provider(year, query, uri)
13
+ Response.new(stats_request(year, query, uri))
14
+ end
15
+
16
+ def stats_request(year, query, uri)
17
+ self.class.get("/stats#{uri}/#{year}", merge_options(query))
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ module FedgerAPI
2
+ class Client
3
+ # Tagged
4
+ module Tagged
5
+ # Returns companies associated with tags.
6
+ def tagged_companies(query)
7
+ tagged_provider(query, '/company')
8
+ end
9
+
10
+ # Returns fundings associated with tags.
11
+ def tagged_fundings(query)
12
+ tagged_provider(query, '/funding')
13
+ end
14
+
15
+ private
16
+
17
+ def tagged_provider(query, uri)
18
+ Response.new(tagged_request(query, uri))
19
+ end
20
+
21
+ def tagged_request(query, uri)
22
+ self.class.get("/tagged#{uri}", merge_options(query))
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,46 @@
1
+ module FedgerAPI
2
+ # Class provide connection to fedger.io api
3
+ class Client
4
+ require 'httparty'
5
+ require_relative 'response'
6
+ require_relative 'client/company'
7
+ require_relative 'client/discover'
8
+ require_relative 'client/geo'
9
+ require_relative 'client/news'
10
+ require_relative 'client/stats'
11
+ require_relative 'client/tagged'
12
+
13
+ include HTTParty
14
+ include FedgerAPI::Client::Company
15
+ include FedgerAPI::Client::Discover
16
+ include FedgerAPI::Client::Geo
17
+ include FedgerAPI::Client::News
18
+ include FedgerAPI::Client::Stats
19
+ include FedgerAPI::Client::Tagged
20
+
21
+ attr_reader :options, :api_key
22
+
23
+ base_uri 'https://api.fedger.io/v1'
24
+ format :json
25
+
26
+ def initialize(api_key = nil)
27
+ @api_key ||= api_key || ENV['FEDGER_API_KEY']
28
+ @options = { query: { apikey: @api_key }, verify: false }
29
+ end
30
+
31
+ protected
32
+
33
+ def response
34
+ @response ||= Response
35
+ end
36
+
37
+ def create_response(http_response)
38
+ response.new(http_response)
39
+ end
40
+
41
+ def merge_options(query = nil)
42
+ return options unless query
43
+ options.merge(query: options[:query].merge(query))
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,28 @@
1
+ module FedgerAPI
2
+ # Class implements response
3
+ class Response
4
+ attr_reader :response
5
+
6
+ def initialize(response)
7
+ @response = response
8
+ create_keys!
9
+ end
10
+
11
+ def to_h
12
+ response.to_h
13
+ end
14
+
15
+ def to_a
16
+ response.map { |k, v| [k, v] }
17
+ end
18
+
19
+ private
20
+
21
+ def create_keys!
22
+ response.each do |key, val|
23
+ instance_variable_set("@#{key}", val)
24
+ define_singleton_method(key) { val }
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,3 @@
1
+ module FedgerAPI
2
+ VERSION = '0.0.1'.freeze
3
+ end
data/lib/fedger_api.rb ADDED
@@ -0,0 +1,6 @@
1
+ # Ruby library for fedger.io api
2
+ module FedgerAPI
3
+ require_relative 'fedger_api/client'
4
+ require_relative 'fedger_api/version'
5
+ require_relative 'fedger_api/response'
6
+ end
@@ -0,0 +1,82 @@
1
+ require 'spec_helper'
2
+ require_relative '../../../lib/fedger_api/client'
3
+
4
+
5
+ describe FedgerAPI::Client, vcr: true do
6
+ fedger_api_config = YAML::load_file(File.join(__dir__, '../../../fedger_api.yml'))
7
+
8
+ let(:client) { FedgerAPI::Client.new(fedger_api_config['api_key']) }
9
+
10
+ context FedgerAPI::Client::Company do
11
+ context '#funding_details' do
12
+ subject { client.funding_details(fedger_api_config['test_company']) }
13
+
14
+ it { should be_an FedgerAPI::Response }
15
+ it { should respond_to(:name, :domain, :amount_total, :rounds) }
16
+ end
17
+
18
+ context '#funding_status' do
19
+ subject { client.funding_status(fedger_api_config['test_company']) }
20
+
21
+ it { should be_an FedgerAPI::Response }
22
+ it { should respond_to(:name, :domain, :amount_total) }
23
+ end
24
+
25
+ context '#fundings' do
26
+ subject { client.fundings(fedger_api_config['test_company']) }
27
+
28
+ it { should be_an FedgerAPI::Response }
29
+ end
30
+
31
+ context '#company_insights' do
32
+ subject { client.company_insights(fedger_api_config['test_company']) }
33
+
34
+ it { should be_an FedgerAPI::Response }
35
+ it { should respond_to(:cursor, :nodes) }
36
+ end
37
+
38
+ context '#investors' do
39
+ subject { client.investors(fedger_api_config['test_company']) }
40
+
41
+ it { should be_an FedgerAPI::Response }
42
+ it { should respond_to(:name, :domain, :investors) }
43
+ end
44
+
45
+ context '#locations' do
46
+ subject { client.locations(fedger_api_config['test_company']) }
47
+
48
+ it { should be_an FedgerAPI::Response }
49
+ it { should respond_to(:name) }
50
+ end
51
+
52
+ context '#peers' do
53
+ subject { client.peers(fedger_api_config['test_company']) }
54
+
55
+ it { should be_an FedgerAPI::Response }
56
+ it { should respond_to(:peers) }
57
+ end
58
+
59
+ context '#portfolio_companies' do
60
+ subject { client.portfolio_companies(fedger_api_config['test_company']) }
61
+
62
+ it { should be_an FedgerAPI::Response }
63
+ it { should respond_to(:domain, :name, :portfolio) }
64
+ end
65
+
66
+ context '#company_snapshot' do
67
+ subject { client.company_snapshot(fedger_api_config['test_company']) }
68
+
69
+ it { should be_an FedgerAPI::Response }
70
+ it { should respond_to(:fundingLevel, :dateFounded, :name, :slug) }
71
+ end
72
+
73
+ context '#team_details' do
74
+ subject { client.team_details(fedger_api_config['test_company']) }
75
+
76
+ it { should be_an FedgerAPI::Response }
77
+ it { should respond_to(:domain, :name, :team) }
78
+ end
79
+ end
80
+ end
81
+
82
+
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+ require_relative '../../../lib/fedger_api/client'
3
+
4
+
5
+ describe FedgerAPI::Client, vcr: true do
6
+ fedger_api_config = YAML::load_file(File.join(__dir__, '../../../fedger_api.yml'))
7
+
8
+ let(:client) { FedgerAPI::Client.new(fedger_api_config['api_key']) }
9
+
10
+ context FedgerAPI::Client::Discover do
11
+ context '#discovery' do
12
+ subject { client.discovery(fedger_api_config['discovery_query']) }
13
+
14
+ it { should be_an FedgerAPI::Response }
15
+ it { should respond_to(:data) }
16
+ end
17
+
18
+ context '#discovery_companies' do
19
+ subject { client.discovery_companies(fedger_api_config['discovery_query']) }
20
+
21
+ it { should be_an FedgerAPI::Response }
22
+ it { should respond_to(:cursor, :data) }
23
+ end
24
+
25
+ context '#discovery_vertices' do
26
+ subject { client.discovery_vertices(fedger_api_config['discovery_query']) }
27
+
28
+ it { should be_an FedgerAPI::Response }
29
+ it { should respond_to(:cursor, :total_count, :data) }
30
+ end
31
+ end
32
+ end
33
+
34
+
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+ require_relative '../../../lib/fedger_api/client'
3
+
4
+
5
+ describe FedgerAPI::Client, vcr: true do
6
+ fedger_api_config = YAML::load_file(File.join(__dir__, '../../../fedger_api.yml'))
7
+
8
+ let(:client) { FedgerAPI::Client.new(fedger_api_config['api_key']) }
9
+
10
+ context FedgerAPI::Client::Geo do
11
+ context '#geo_located_companies' do
12
+ subject { client.geo_located_companies(fedger_api_config['iso_country']) }
13
+
14
+ it { should be_an FedgerAPI::Response }
15
+ it { should respond_to(:companies) }
16
+ end
17
+
18
+ context '#geo_located_fundings' do
19
+ subject { client.geo_located_fundings(fedger_api_config['iso_country']) }
20
+
21
+ it { should be_an FedgerAPI::Response }
22
+ it { should respond_to(:fundings) }
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+ require_relative '../../../lib/fedger_api/client'
3
+
4
+
5
+ describe FedgerAPI::Client, vcr: true do
6
+ fedger_api_config = YAML::load_file(File.join(__dir__, '../../../fedger_api.yml'))
7
+
8
+ let(:client) { FedgerAPI::Client.new(fedger_api_config['api_key']) }
9
+
10
+ context FedgerAPI::Client::News do
11
+ context '#latest_fundings' do
12
+ subject { client.latest_fundings() }
13
+
14
+ it { should be_an FedgerAPI::Response }
15
+ it { should respond_to(:date_reference, :fundings) }
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+ require_relative '../../../lib/fedger_api/client'
3
+
4
+
5
+ describe FedgerAPI::Client, vcr: true do
6
+ fedger_api_config = YAML::load_file(File.join(__dir__, '../../../fedger_api.yml'))
7
+
8
+ let(:client) { FedgerAPI::Client.new(fedger_api_config['api_key']) }
9
+
10
+ context FedgerAPI::Client::Stats do
11
+ context '#latest_fundings' do
12
+ subject { client.stats_fundings(fedger_api_config['year'], {month: 1, country: fedger_api_config['iso_country']}) }
13
+
14
+ it { should be_an FedgerAPI::Response }
15
+ it { should respond_to(:year, :currency, :type) }
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+ require_relative '../../../lib/fedger_api/client'
3
+
4
+
5
+ describe FedgerAPI::Client, vcr: true do
6
+ fedger_api_config = YAML::load_file(File.join(__dir__, '../../../fedger_api.yml'))
7
+
8
+ let(:client) { FedgerAPI::Client.new(fedger_api_config['api_key']) }
9
+
10
+ context FedgerAPI::Client::Tagged do
11
+ context '#tagged_companies' do
12
+ subject(:request) { client.tagged_companies({tags: fedger_api_config['discovery_query'], isJoin: 'true'}) }
13
+
14
+ it { should be_an FedgerAPI::Response }
15
+ it { should respond_to(:companies) }
16
+
17
+ context '#to_h' do
18
+ subject { request.to_h }
19
+
20
+ it { should be_an Hash }
21
+ it { should include('companies') }
22
+ end
23
+
24
+ context '#to_a' do
25
+ subject { request.to_a }
26
+
27
+ it { should be_an Array }
28
+ end
29
+ end
30
+ end
31
+
32
+ context FedgerAPI::Client::Tagged do
33
+ context '#tagged_fundings' do
34
+ subject(:request) { client.tagged_fundings({tags: fedger_api_config['discovery_query'], range_from: 1, range_to: 20, isJoin: true}) }
35
+
36
+ it { should be_an FedgerAPI::Response }
37
+ it { should respond_to(:fundings) }
38
+
39
+ context '#to_h' do
40
+ subject { request.to_h }
41
+
42
+ it { should be_an Hash }
43
+ it { should include('fundings') }
44
+ end
45
+
46
+ context '#to_a' do
47
+ subject { request.to_a }
48
+
49
+ it { should be_an Array }
50
+ end
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+ require_relative '../../lib/fedger_api/client'
3
+
4
+
5
+ describe FedgerAPI::Client, vcr: true do
6
+ fedger_api_config = YAML::load_file(File.join(__dir__, '../../fedger_api.yml'))
7
+
8
+ let(:client) { FedgerAPI::Client.new(fedger_api_config['api_key']) }
9
+ end
@@ -0,0 +1,14 @@
1
+ require_relative '../lib/fedger_api'
2
+ require 'webmock/rspec'
3
+ require 'vcr'
4
+
5
+ RSpec.configure do |config|
6
+
7
+ end
8
+
9
+ VCR.configure do |config|
10
+ config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
11
+ config.hook_into :webmock
12
+ config.configure_rspec_metadata!
13
+ config.default_cassette_options = { record: :new_episodes }
14
+ end
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fedger_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dmitry Topornin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.13'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.45'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.45'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.13'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.13'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '11.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '11.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.24'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.24'
111
+ description: feger.io api gem
112
+ email: dtopornin@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - ".gitignore"
118
+ - ".rubocop.yml"
119
+ - ".travis.yml"
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - LICENSE.txt
123
+ - README.rdoc
124
+ - Rakefile
125
+ - fedger_api.gemspec
126
+ - fedger_api.yml.travis
127
+ - lib/fedger_api.rb
128
+ - lib/fedger_api/client.rb
129
+ - lib/fedger_api/client/company.rb
130
+ - lib/fedger_api/client/discover.rb
131
+ - lib/fedger_api/client/geo.rb
132
+ - lib/fedger_api/client/news.rb
133
+ - lib/fedger_api/client/stats.rb
134
+ - lib/fedger_api/client/tagged.rb
135
+ - lib/fedger_api/response.rb
136
+ - lib/fedger_api/version.rb
137
+ - spec/lib/client/company_spec.rb
138
+ - spec/lib/client/discovery_spec.rb
139
+ - spec/lib/client/geo_spec.rb
140
+ - spec/lib/client/news_spec.rb
141
+ - spec/lib/client/stats_spec.rb
142
+ - spec/lib/client/tagged_spec.rb
143
+ - spec/lib/client_spec.rb
144
+ - spec/spec_helper.rb
145
+ homepage: https://github.com/WildDima/fedger_api
146
+ licenses:
147
+ - MIT
148
+ metadata: {}
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ requirements: []
164
+ rubyforge_project:
165
+ rubygems_version: 2.6.8
166
+ signing_key:
167
+ specification_version: 4
168
+ summary: feger.io api gem
169
+ test_files: []