crunchbase-ruby-library 0.1.6 → 0.1.7

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: 0ad940bca165d85e87b478f8934cb8810f9433ae
4
- data.tar.gz: e2ae5f5b0736f043ae0ff0571ec279fb3d275699
3
+ metadata.gz: baf0952d3a602e2915249cf794a819630a28d02a
4
+ data.tar.gz: 27d3fabb48e933aefe80e5a389a1b3ed9622b430
5
5
  SHA512:
6
- metadata.gz: 137231ba95555b75d966237879a8849acea81fe04f4d8f414a483377b748fa912157ce95f427a22596e1b31a544dafa9ba454d85ffd88f0880cfd988aae4df1f
7
- data.tar.gz: 8ef1a82ef01c884f0cd7ac49640d0f1072bcac4335dddb3c7ab9e219fc1b0120d8c73fbba232323831eff980a6b5b244b626c6bf24d37e5fe16368c81acfada9
6
+ metadata.gz: e5558201d8108adf4cf4d0a7cb1596b85e3e88230a21b10f399de019c1fef92a6546d5a7a8c4f2ea2774a76b38d1464857bae0aab14764b6ef71dc866080289d
7
+ data.tar.gz: 8aaaed0ba98da197c134b53d96361afc139753ce59fac6a812de2c8e27f93fb7955e138a373f247541fb96cfcbb5136753280d041b6df5fb4ca100fc688d7f2a
data/README.md CHANGED
@@ -25,9 +25,9 @@ Config your user_key, debug somewhere like development.rb, Recommended directory
25
25
  Crunchbase::API.key = 'user_key'
26
26
  Crunchbase::API.debug = false
27
27
 
28
- ## Search Organization OR Person
28
+ ## Search Organization OR Person OR Product OR IPO
29
29
 
30
- Retrieve the way, Please use Search Class. The Search Will Return a list consisting of objects of the OrganizationSummary | PersonSummary type. Example:
30
+ Retrieve the way, Please use Search Class. The Search Will Return a list consisting of objects of the OrganizationSummary | PersonSummary | ProductSummary type. Example:
31
31
 
32
32
  Query Orgnization
33
33
 
@@ -50,6 +50,18 @@ Retrieve the way, Please use Search Class. The Search Will Return a list consist
50
50
 
51
51
  response.results.each { |i| [i.first_name, i.last_name] }
52
52
 
53
+ Query Product
54
+
55
+ response = Crunchbase::Model::Search.search({}, 'products')
56
+
57
+ response.results.each { |i| i.name }
58
+
59
+ Query IPO
60
+
61
+ response = Crunchbase::Model::Search.search({}, 'ipos')
62
+
63
+ response.results.each { |i| i.name }
64
+
53
65
  ## Get Organization && RelationShips
54
66
 
55
67
  Get information by the permalink, Example:
@@ -42,6 +42,7 @@ module Crunchbase
42
42
  autoload :PrimaryImage, "crunchbase/model/primary_image"
43
43
  autoload :PrimaryLocation, "crunchbase/model/primary_location"
44
44
  autoload :Product, "crunchbase/model/product"
45
+ autoload :ProductSummary, "crunchbase/model/product_summary"
45
46
  autoload :School, "crunchbase/model/school"
46
47
  autoload :Search, "crunchbase/model/search"
47
48
  autoload :SearchResult, "crunchbase/model/search_result"
@@ -124,13 +124,17 @@ module Crunchbase::Model
124
124
  end
125
125
 
126
126
  def self.get_model_name(resource_list)
127
- return nil unless ['organizations', 'people'].include?(resource_list)
127
+ return nil unless ['organizations', 'people', 'products', 'ipos'].include?(resource_list)
128
128
 
129
129
  case resource_list
130
130
  when 'organizations'
131
131
  OrganizationSummary
132
132
  when 'people'
133
133
  PersonSummary
134
+ when 'products'
135
+ ProductSummary
136
+ when 'ipos'
137
+ Ipo
134
138
  else
135
139
  nil
136
140
  end
@@ -2,27 +2,38 @@
2
2
 
3
3
  module Crunchbase::Model
4
4
  class Ipo < Crunchbase::Model::Entity
5
-
6
- RESOURCE_LIST = 'ipos'
7
-
8
- attr_reader :api_path, :web_path, :went_public_on, :went_public_on_trust_code,
9
- :stock_exchange_symbol, :stock_symbol,
10
- :shares_sold, :opening_share_price,
11
- :opening_share_price_currency_code, :opening_share_price_usd, :opening_valuation,
12
- :opening_valuation_currency_code, :opening_valuation_usd,
13
- :money_raised, :money_raised_currency_code, :money_raised_usd,
5
+
6
+ RESOURCE_LIST = RESOURCE_NAME = 'ipos'
7
+
8
+ attr_reader :api_path, :web_path, :went_public_on, :went_public_on_trust_code,
9
+ :stock_exchange_symbol, :stock_symbol,
10
+ :shares_sold, :opening_share_price,
11
+ :opening_share_price_currency_code, :opening_share_price_usd, :opening_valuation,
12
+ :opening_valuation_currency_code, :opening_valuation_usd,
13
+ :money_raised, :money_raised_currency_code, :money_raised_usd,
14
14
  :created_at, :updated_at
15
15
 
16
16
  attr_reader :funded_company, :stock_exchange, :images, :videos, :news
17
17
 
18
+ def initialize(json)
19
+ super
20
+
21
+ unless (relationships = json['relationships']).nil?
22
+ set_relationships_object(Crunchbase::Model::Organization, 'funded_company', relationships['funded_company'])
23
+ set_relationships_object(Crunchbase::Model::New, 'news', relationships['news'])
24
+ set_relationships_object(Crunchbase::Model::Video, 'videos', relationships['videos'])
25
+ end
26
+ end
27
+
28
+
18
29
  def property_keys
19
30
  %w[
20
- api_path web_path went_public_on went_public_on_trust_code
21
- stock_exchange_symbol stock_symbol
22
- shares_sold opening_share_price
23
- opening_share_price_currency_code opening_share_price_usd opening_valuation
24
- opening_valuation_currency_code opening_valuation_usd
25
- money_raised money_raised_currency_code money_raised_usd
31
+ api_path web_path went_public_on went_public_on_trust_code
32
+ stock_exchange_symbol stock_symbol
33
+ shares_sold opening_share_price
34
+ opening_share_price_currency_code opening_share_price_usd opening_valuation
35
+ opening_valuation_currency_code opening_valuation_usd
36
+ money_raised money_raised_currency_code money_raised_usd
26
37
  created_at updated_at
27
38
  ]
28
39
  end
@@ -32,4 +43,4 @@ module Crunchbase::Model
32
43
  end
33
44
 
34
45
  end
35
- end
46
+ end
@@ -3,25 +3,17 @@
3
3
  module Crunchbase::Model
4
4
  class OwnedBy < Crunchbase::Model::Entity
5
5
 
6
- attr_reader :name, :path, :created_at, :updated_at
6
+ attr_reader :name, :api_path, :web_path, :created_at, :updated_at
7
7
 
8
8
  def initialize(json)
9
- instance_variable_set("@type_name", json['type'] || nil)
10
-
11
- property_keys.each { |v|
12
- instance_variable_set("@#{v}", json[v] || nil)
13
- }
14
-
15
- %w[created_at updated_at].each { |v|
16
- instance_variable_set("@#{v}", Time.at(json[v]))
17
- }
9
+ super
18
10
  end
19
11
 
20
12
  def property_keys
21
13
  %w[
22
- name path created_at updated_at
14
+ name api_path web_path created_at updated_at
23
15
  ]
24
16
  end
25
17
 
26
18
  end
27
- end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Crunchbase::Model
2
+ class ProductSummary < Crunchbase::Model::Entity
3
+
4
+ attr_reader :permalink, :api_path, :web_path, :name, :short_description,
5
+ :owner_permalink, :owner_api_path, :owner_web_path, :owner_name,
6
+ :profile_image_url, :homepage_url, :facebook_url, :twitter_url, :linkedin_url,
7
+ :created_at, :updated_at
8
+
9
+
10
+ def property_keys
11
+ %w[
12
+ permalink api_path web_path name short_description
13
+ owner_permalink owner_api_path owner_web_path owner_name
14
+ profile_image_url homepage_url facebook_url twitter_url linkedin_url
15
+ created_at updated_at
16
+ ]
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Crunchbase
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchbase-ruby-library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Encore Shao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,6 +125,7 @@ files:
125
125
  - lib/crunchbase/model/primary_image.rb
126
126
  - lib/crunchbase/model/primary_location.rb
127
127
  - lib/crunchbase/model/product.rb
128
+ - lib/crunchbase/model/product_summary.rb
128
129
  - lib/crunchbase/model/school.rb
129
130
  - lib/crunchbase/model/search.rb
130
131
  - lib/crunchbase/model/search_result.rb