startupstats 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in startupstats-client.gemspec
3
+ # Specify your gem's dependencies in startupstats.gemspec
4
4
  gemspec
@@ -1,4 +1,5 @@
1
1
  require 'startupstats/formd/models/filing'
2
+ require 'startupstats/formd/models/company'
2
3
  module StartupStats
3
4
  module Formd
4
5
  module Filings
@@ -0,0 +1,14 @@
1
+ module StartupStats
2
+ module Formd
3
+ class Company
4
+ attr_accessor :id, :sec_id, :name, :entity_type, :inc_state, :address_street1, :address_street2,
5
+ :address_city, :address_spc, :address_zip, :phone
6
+
7
+ def initialize response = {}
8
+ response.each do |k, v|
9
+ instance_variable_set("@#{k}",v) unless v.nil?
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,13 +1,17 @@
1
+ require 'startupstats/formd/models/company'
1
2
  module StartupStats
2
3
  module Formd
3
4
  class Filing
4
- attr_accessor :filing_url_html , :filing_url_xml , :filing_id, :filing_type
5
+ attr_accessor :id, :filing_url_html , :filing_url_xml , :filing_id, :filing_type
5
6
  attr_accessor :company_id, :filing_num, :filing_date, :industry_group, :long_offering, :business_combo, :processed,
6
7
  :min_investment, :offering_amount, :offering_sold, :num_investors, :sales_commission, :finders_fee, :use_of_proceeds, :security_type
7
8
  attr_accessor :company #this will store all details
8
9
  def initialize response = {}
9
10
  response.each do |k, v|
10
- instance_variable_set("@#{k}",v) unless v.nil?
11
+ instance_variable_set("@#{k}",v) unless v.nil? || k == :company
12
+ if k == :company
13
+ instance_variable_set("@#{k}", StartupStats::Formd::Company.new(v) )
14
+ end
11
15
  end
12
16
  end
13
17
 
@@ -1,3 +1,3 @@
1
1
  module StartupStats
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/spec/factories.rb CHANGED
@@ -1,8 +1,6 @@
1
- module StartupStats
2
- module Formd
3
1
  FactoryGirl.define do
4
2
 
5
- factory :filing do
3
+ factory :filing , class: StartupStats::Formd::Filing do
6
4
  filing_url_html "http://www.sec.gov/Archives/edgar/data/1525533/000152553312000003/xslFormDX01/primary_doc.xml"
7
5
  filing_url_xml "http://www.sec.gov/Archives/edgar/data/1525533/000152553312000003/primary_doc.xml"
8
6
  filing_id "000152553312000003"
@@ -42,7 +40,7 @@ FactoryGirl.define do
42
40
  end
43
41
 
44
42
 
45
- factory :company do
43
+ factory :company , class: StartupStats::Formd::Company do
46
44
  # based on this: http://www.sec.gov/Archives/edgar/data/1562176/000156217612000001/xslFormDX01/primary_doc.xml
47
45
  sec_id "0001562176"
48
46
  name "Interesante, Inc."
@@ -99,7 +97,4 @@ FactoryGirl.define do
99
97
  factory :security do
100
98
  name "Equity"
101
99
  end
102
- end
103
-
104
- end
105
100
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+ describe StartupStats::Formd::Company do
3
+ before {
4
+ @company = build_stubbed(:company)
5
+ }
6
+ subject { @company }
7
+
8
+ it { should respond_to(:name) }
9
+ it { should respond_to(:entity_type) }
10
+ it { should respond_to(:inc_state) }
11
+ it { should respond_to(:address_street1) }
12
+ it { should respond_to(:address_street2) }
13
+ it { should respond_to(:address_city) }
14
+ it { should respond_to(:address_spc) }
15
+ it { should respond_to(:address_zip) }
16
+ it { should respond_to(:phone) }
17
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+ describe StartupStats::Formd::Filing do
3
+ before {
4
+ @filing = build_stubbed(:filing_complete)
5
+ }
6
+ subject { @filing }
7
+
8
+ it { should respond_to(:filing_url_html) }
9
+ it { should respond_to(:filing_url_xml) }
10
+ it { should respond_to(:filing_id) }
11
+ it { should respond_to(:filing_type) }
12
+ it { should respond_to( :filing_id ) }
13
+ it { should respond_to( :offering_amount ) }
14
+ it { should respond_to( :offering_sold ) }
15
+ it { should respond_to( :industry_group ) }
16
+ end
@@ -2,18 +2,34 @@ require 'spec_helper'
2
2
  require 'vcr'
3
3
  describe StartupStats::Formd::Filings do
4
4
  use_vcr_cassette 'filings' , :record => :new_episodes
5
- let(:client){ StartupStats::Formd::Client.new( {
6
- :access_token => ENV['FORMD_TOKEN'] ,
7
- :access_token_key => "access_token" ,
8
- :endpoint => ENV['FORMD_ENDPOINT'] ,
9
- } ) }
5
+ context "without valid authentication" do
6
+ let(:client){ StartupStats::Formd::Client.new({
7
+ :access_token => "" ,
8
+ :access_token_key => "access_token" ,
9
+ :endpoint => ENV['FORMD_ENDPOINT'] ,
10
+ }) }
10
11
 
11
- it "gets filings in batch" do
12
- #VCR.use_cassette('filings' , :record => :new_episodes ) do
13
- filings = client.filings( start = 0 , limit = 5 , industry = nil )
14
- expect(filings).to be_an Array
15
- expect(filings.first).to be_a StartupStats::Formd::Filing
16
- filings.first.company_id.should eq 3
17
- #end
12
+ it "should raise an error" do
13
+ expect{
14
+ client.filings( start = 0 , limit = 5 , industry = nil )
15
+ }.to raise_error(StartupStats::Error::Unauthorized)
16
+ end
17
+ end
18
+ context "with valid authentication" do
19
+ let(:client){ StartupStats::Formd::Client.new( {
20
+ :access_token => ENV['FORMD_TOKEN'] ,
21
+ :access_token_key => "access_token" ,
22
+ :endpoint => ENV['FORMD_ENDPOINT'] ,
23
+ } ) }
24
+
25
+ it "gets filings in batch" do
26
+ #VCR.use_cassette('filings' , :record => :new_episodes ) do
27
+ filings = client.filings( start = 0 , limit = 5 , industry = nil )
28
+ expect(filings).to be_an Array
29
+ filings.size.should == 5
30
+ expect(filings.first).to be_a StartupStats::Formd::Filing
31
+ expect(filings.first.company).to be_a StartupStats::Formd::Company
32
+ #end
33
+ end
18
34
  end
19
35
  end
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,7 @@ require 'simplecov'
2
2
  SimpleCov.start
3
3
 
4
4
  require 'rspec'
5
- require 'startupstats-client'
5
+ require 'startupstats'
6
6
  require 'factory_girl'
7
7
  require 'factories'
8
8
  require 'vcr'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: startupstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -153,6 +153,7 @@ files:
153
153
  - lib/startupstats/error/unauthorized.rb
154
154
  - lib/startupstats/formd/client.rb
155
155
  - lib/startupstats/formd/filings.rb
156
+ - lib/startupstats/formd/models/company.rb
156
157
  - lib/startupstats/formd/models/filing.rb
157
158
  - lib/startupstats/requestable.rb
158
159
  - lib/startupstats/response/parse_json.rb
@@ -160,6 +161,8 @@ files:
160
161
  - lib/startupstats/version.rb
161
162
  - spec/factories.rb
162
163
  - spec/formd/client_spec.rb
164
+ - spec/formd/company_spec.rb
165
+ - spec/formd/filing_spec.rb
163
166
  - spec/formd/filings_spec.rb
164
167
  - spec/formd/formd_spec.rb
165
168
  - spec/spec_helper.rb
@@ -194,6 +197,8 @@ summary: A Ruby interface to the network of StartupStats APIs.
194
197
  test_files:
195
198
  - spec/factories.rb
196
199
  - spec/formd/client_spec.rb
200
+ - spec/formd/company_spec.rb
201
+ - spec/formd/filing_spec.rb
197
202
  - spec/formd/filings_spec.rb
198
203
  - spec/formd/formd_spec.rb
199
204
  - spec/spec_helper.rb