crunchbase-ruby-library 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +0 -65
  3. data/.rubocop_todo.yml +54 -16
  4. data/Gemfile +1 -0
  5. data/Rakefile +1 -0
  6. data/bin/console +1 -1
  7. data/crunchbase-ruby-library.gemspec +2 -2
  8. data/lib/crunchbase.rb +1 -0
  9. data/lib/crunchbase/api.rb +1 -0
  10. data/lib/crunchbase/client.rb +1 -0
  11. data/lib/crunchbase/model/acquired_by.rb +0 -1
  12. data/lib/crunchbase/model/acquiree.rb +0 -1
  13. data/lib/crunchbase/model/acquirer.rb +0 -1
  14. data/lib/crunchbase/model/acquisition.rb +0 -1
  15. data/lib/crunchbase/model/address.rb +0 -1
  16. data/lib/crunchbase/model/advisory_role.rb +0 -1
  17. data/lib/crunchbase/model/batch_search.rb +0 -1
  18. data/lib/crunchbase/model/board_members_and_advisor.rb +0 -1
  19. data/lib/crunchbase/model/category.rb +0 -1
  20. data/lib/crunchbase/model/competitor.rb +0 -1
  21. data/lib/crunchbase/model/current_team.rb +0 -1
  22. data/lib/crunchbase/model/customer.rb +0 -1
  23. data/lib/crunchbase/model/degree.rb +3 -4
  24. data/lib/crunchbase/model/entity.rb +8 -5
  25. data/lib/crunchbase/model/error.rb +0 -1
  26. data/lib/crunchbase/model/founded_company.rb +0 -1
  27. data/lib/crunchbase/model/founder.rb +0 -1
  28. data/lib/crunchbase/model/fund.rb +1 -0
  29. data/lib/crunchbase/model/fund_raise.rb +1 -0
  30. data/lib/crunchbase/model/funding_round.rb +1 -1
  31. data/lib/crunchbase/model/headquarter.rb +0 -1
  32. data/lib/crunchbase/model/image.rb +0 -1
  33. data/lib/crunchbase/model/investment.rb +0 -1
  34. data/lib/crunchbase/model/investor.rb +0 -1
  35. data/lib/crunchbase/model/ipo.rb +0 -1
  36. data/lib/crunchbase/model/job.rb +8 -7
  37. data/lib/crunchbase/model/location.rb +0 -1
  38. data/lib/crunchbase/model/member.rb +0 -1
  39. data/lib/crunchbase/model/membership.rb +0 -1
  40. data/lib/crunchbase/model/new.rb +0 -1
  41. data/lib/crunchbase/model/office.rb +0 -1
  42. data/lib/crunchbase/model/organization.rb +14 -16
  43. data/lib/crunchbase/model/organization_summary.rb +0 -1
  44. data/lib/crunchbase/model/owned_by.rb +0 -1
  45. data/lib/crunchbase/model/parent_location.rb +0 -1
  46. data/lib/crunchbase/model/past_team.rb +0 -1
  47. data/lib/crunchbase/model/person.rb +9 -8
  48. data/lib/crunchbase/model/person_summary.rb +0 -1
  49. data/lib/crunchbase/model/primary_affiliation.rb +3 -4
  50. data/lib/crunchbase/model/primary_image.rb +0 -1
  51. data/lib/crunchbase/model/primary_location.rb +0 -1
  52. data/lib/crunchbase/model/product.rb +0 -1
  53. data/lib/crunchbase/model/product_summary.rb +1 -0
  54. data/lib/crunchbase/model/school.rb +0 -1
  55. data/lib/crunchbase/model/search.rb +0 -1
  56. data/lib/crunchbase/model/search_result.rb +1 -3
  57. data/lib/crunchbase/model/simple_organization.rb +0 -1
  58. data/lib/crunchbase/model/sub_organization.rb +0 -1
  59. data/lib/crunchbase/model/video.rb +0 -1
  60. data/lib/crunchbase/model/website.rb +0 -1
  61. data/lib/crunchbase/version.rb +1 -1
  62. data/spec/crunchbase/data/organizations/crunchbase.json +2853 -1344
  63. data/spec/crunchbase/model/funding_round_spec.rb +2 -2
  64. data/spec/crunchbase/model/organization_spec.rb +170 -146
  65. data/spec/crunchbase/support/api_helper.rb +8 -5
  66. data/spec/spec_helper.rb +1 -0
  67. metadata +5 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9c1369c879d7ae6abcc3c0691d052e349da787cb
4
- data.tar.gz: 5a0767cf583d4ba492e8573e47bd8190180881a6
2
+ SHA256:
3
+ metadata.gz: 035b17e4db96ed91ac46095be4bc775dad93062408b1ff1b9b8b40f641570357
4
+ data.tar.gz: f3b7534bfaf1494f76ac9d08535787412e9828e1e9f0fcae7ed73d826c8b7a35
5
5
  SHA512:
6
- metadata.gz: 53d5afedbb3347f6070c20ef3cb121a4f87b8597c5033145f29910e6df0c26ce1b0c4aad8b58be79fcd391fd441394ef0e749e3421758f9df68c0c7afd8a3313
7
- data.tar.gz: 9edc9efb7e651c8535b12509ec3fe8caa8512092cf749ae6bc5b48a3a93186e126c13627da2d34f58cb6f83ecdf4e74de821dd2fc91dcde85da86ba0627113c0
6
+ metadata.gz: 7383ecfeb84864295c6dc163d6da678e85082973e73b0cb0cde3a55ad8406264bd95ceea01c378aeb72a01b6c7bcfbe5417d28afceb28322d6fe73ff984ee72e
7
+ data.tar.gz: 9ea83223558b62835bc716305438aa4bf922a4a94bdba87a8dd335dec8f275ddfe7afaed4a99bbef6eaa4f2f94fa7643f1a9236c26569988cf66ae195350d5b1
@@ -1,66 +1 @@
1
- # This is the configuration used to check the rubocop source code.
2
-
3
1
  inherit_from: .rubocop_todo.yml
4
-
5
- AllCops:
6
- DisplayCopNames: true
7
- TargetRubyVersion: 2.4
8
- Exclude:
9
- - '**/*.yml'
10
- - 'tmp/**/*'
11
-
12
- Style/StringLiterals:
13
- Enabled: false
14
-
15
- Documentation:
16
- Enabled: false
17
-
18
- Style/RegexpLiteral:
19
- Enabled: false
20
-
21
- Style/SpaceInsideHashLiteralBraces:
22
- Enabled: false
23
-
24
- Style/DotPosition:
25
- EnforcedStyle: trailing
26
-
27
- Style/FormatString:
28
- Enabled: false
29
-
30
- Lint/AssignmentInCondition:
31
- Enabled: false
32
-
33
- Style/EmptyLinesAroundAccessModifier:
34
- Enabled: false
35
-
36
- Style/SingleLineBlockParams:
37
- Enabled: false
38
-
39
- Style/NumericLiterals:
40
- Exclude:
41
- - 'spec/**/*'
42
-
43
- Style/StringLiteralsInInterpolation:
44
- Enabled: false
45
-
46
- Style/CaseIndentation:
47
- # Valid values are: case, end
48
- EnforcedStyle: end
49
- IndentOneStep: false
50
-
51
- Lint/EndAlignment:
52
- EnforcedStyleAlignWith: variable
53
-
54
- Lint/UselessAssignment:
55
- Enabled: false
56
-
57
- Style/NumericLiterals:
58
- Enabled: false
59
-
60
- Metrics/BlockLength:
61
- Exclude:
62
- - "**/*_spec.rb"
63
-
64
- Metrics/ModuleLength:
65
- Exclude:
66
- - "**/*_spec.rb"
@@ -1,47 +1,85 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-08-28 16:18:43 +0800 using RuboCop version 0.45.0.
3
+ # on 2019-12-07 15:33:05 +0800 using RuboCop version 0.77.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: 7
9
+ # Offense count: 1
10
+ Lint/DuplicateMethods:
11
+ Exclude: false
12
+
13
+ # Offense count: 2
14
+ Lint/UriEscapeUnescape:
15
+ Exclude:
16
+ - 'lib/crunchbase/api.rb'
17
+
18
+ # Offense count: 5
10
19
  Metrics/AbcSize:
11
- Max: 53
20
+ Max: 23
21
+
22
+ Metrics/ModuleLength:
23
+ Max: 468
24
+
25
+ # Offense count: 22
26
+ # Configuration parameters: CountComments, ExcludedMethods.
27
+ # ExcludedMethods: refine
28
+ Metrics/BlockLength:
29
+ Max: 368
12
30
 
13
31
  # Offense count: 1
14
32
  # Configuration parameters: CountComments.
15
33
  Metrics/ClassLength:
16
- Max: 250
34
+ Max: 152
17
35
 
18
36
  # Offense count: 1
19
37
  Metrics/CyclomaticComplexity:
20
38
  Max: 7
21
39
 
22
- # Offense count: 181
23
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
24
- # URISchemes: http, https
25
- Metrics/LineLength:
26
- Max: 267
27
-
28
- # Offense count: 7
29
- # Configuration parameters: CountComments.
40
+ # Offense count: 4
41
+ # Configuration parameters: CountComments, ExcludedMethods.
30
42
  Metrics/MethodLength:
31
43
  Max: 28
32
44
 
33
- # Offense count: 49
34
- # Configuration parameters: EnforcedStyle, SupportedStyles.
45
+ # Offense count: 50
46
+ # Cop supports --auto-correct.
47
+ # Configuration parameters: AutoCorrect, EnforcedStyle.
35
48
  # SupportedStyles: nested, compact
36
49
  Style/ClassAndModuleChildren:
37
50
  Enabled: false
38
51
 
39
- # Offense count: 38
52
+ # Offense count: 44
40
53
  Style/Documentation:
41
54
  Enabled: false
42
55
 
43
- # Offense count: 16
56
+ # Offense count: 2
44
57
  # Configuration parameters: MinBodyLength.
45
58
  Style/GuardClause:
59
+ Exclude: false
60
+
61
+ # Offense count: 3
62
+ # Cop supports --auto-correct.
63
+ # Configuration parameters: Strict.
64
+ Style/NumericLiterals:
65
+ MinDigits: 11
66
+
67
+ Style/RedundantFreeze:
68
+ Enabled: false
69
+
70
+ Style/PercentLiteralDelimiters:
46
71
  Enabled: false
47
72
 
73
+ # Offense count: 3
74
+ # Cop supports --auto-correct.
75
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
76
+ # SupportedStyles: single_quotes, double_quotes
77
+ Style/StringLiterals:
78
+ Exclude: false
79
+
80
+ # Offense count: 146
81
+ # Cop supports --auto-correct.
82
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
83
+ # URISchemes: http, https
84
+ Metrics/LineLength:
85
+ Max: 234
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  gem 'coveralls', require: false
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'rspec/core/rake_task'
3
4
  require 'bundler/gem_tasks'
4
5
 
@@ -13,7 +13,7 @@ Crunchbase::API.debug = yaml['debug']
13
13
  Crunchbase::API.timeout = yaml['timeout']
14
14
 
15
15
  # (If you use this, don't forget to add pry to your Gemfile!)
16
- require "pry"
16
+ require 'pry'
17
17
  Pry.start
18
18
 
19
19
  # require 'irb'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'crunchbase/version'
6
6
 
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_development_dependency 'bundler'
23
- spec.add_development_dependency 'rake'
24
23
  spec.add_development_dependency 'pry'
24
+ spec.add_development_dependency 'rake'
25
25
  spec.add_development_dependency 'rspec'
26
26
  spec.add_development_dependency 'rspec-its'
27
27
  spec.add_development_dependency 'rubocop'
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'singleton'
4
4
  require 'time'
5
+ require 'pry'
5
6
 
6
7
  require 'json'
7
8
  require 'crunchbase/version'
@@ -134,6 +134,7 @@ module Crunchbase
134
134
  # JSON contains an error.
135
135
  def get_json_response(uri)
136
136
  raise Exception, 'User key required, visit https://data.crunchbase.com/v3.1/docs' unless @key
137
+
137
138
  uri += "#{uri =~ /\?/ ? '&' : '?'}user_key=#{@key}"
138
139
 
139
140
  resp = Timeout.timeout(@timeout) do
@@ -51,6 +51,7 @@ module Crunchbase
51
51
  end
52
52
 
53
53
  private
54
+
54
55
  def kclass(kclass_name)
55
56
  Crunchbase::Model.const_get kclass_name
56
57
  end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -14,9 +13,9 @@ module Crunchbase::Model
14
13
  def initialize(json)
15
14
  super
16
15
 
17
- unless (relationships = json['relationships']).nil?
18
- instance_relationships_object(Crunchbase::Model::School, 'school', relationships['school'])
19
- end
16
+ return if (relationships = json['relationships']).nil?
17
+
18
+ instance_relationships_object(Crunchbase::Model::School, 'school', relationships['school'])
20
19
  end
21
20
 
22
21
  def property_keys
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase
@@ -13,8 +12,12 @@ module Crunchbase
13
12
  instance_variable_set('@uuid', json['uuid'] || nil)
14
13
 
15
14
  properties = json['properties'] || {}
16
- property_keys.each { |v| instance_variable_set("@#{v}", properties[v]) }
17
- date_keys.each { |v| instance_variable_set("@#{v}", properties[v].nil? ? nil : Date.parse(properties[v])) }
15
+ property_keys.each do |v|
16
+ instance_variable_set("@#{v}", properties[v])
17
+ end
18
+ date_keys.each do |v|
19
+ instance_variable_set("@#{v}", properties[v].nil? ? nil : Date.parse(properties[v]))
20
+ end
18
21
 
19
22
  instance_timestamps(properties)
20
23
 
@@ -40,7 +43,7 @@ module Crunchbase
40
43
  return Time.parse(date) if date.is_a?(String)
41
44
 
42
45
  Time.at(date)
43
- rescue
46
+ rescue StandardError
44
47
  nil
45
48
  end
46
49
 
@@ -61,7 +64,7 @@ module Crunchbase
61
64
  end
62
65
 
63
66
  def relationship_lists
64
- { }
67
+ {}
65
68
  end
66
69
 
67
70
  def set_relationships_object(kclass, key, list)
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # encoding utf-8
3
4
 
4
5
  module Crunchbase::Model
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # encoding utf-8
3
4
 
4
5
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -22,6 +21,7 @@ module Crunchbase::Model
22
21
 
23
22
  relationships = json['relationships']
24
23
  return if relationships.nil?
24
+
25
25
  relationship_with_funded(relationships['funded_organization'])
26
26
  end
27
27
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Crunchbase::Model