crunchbase-ruby-library 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,14 +11,13 @@ module Crunchbase::Model
11
11
  super
12
12
 
13
13
  unless (relationships = json['relationships']).nil?
14
- set_relationships_object(Crunchbase::Model::Person, 'person', relationships['person'])
14
+ instance_relationships_object(Crunchbase::Model::Person, 'person', relationships['person'])
15
15
  end
16
16
  end
17
17
 
18
- def set_relationships_object(object_name, key, item)
19
- return unless item
20
-
21
- instance_variable_set "@#{key}", ( object_name.new(item) || nil )
18
+ # Factory method to return an instance from a permalink
19
+ def self.get(permalink)
20
+ nil
22
21
  end
23
22
 
24
23
  end
@@ -11,14 +11,13 @@ module Crunchbase::Model
11
11
  super
12
12
 
13
13
  unless (relationships = json['relationships']).nil?
14
- set_relationships_object(Crunchbase::Model::Person, 'person', relationships['person'])
14
+ instance_relationships_object(Crunchbase::Model::Person, 'person', relationships['person'])
15
15
  end
16
16
  end
17
17
 
18
- def set_relationships_object(object_name, key, item)
19
- return unless item
20
-
21
- instance_variable_set "@#{key}", ( object_name.new(item) || nil )
18
+ # Factory method to return an instance from a permalink
19
+ def self.get(permalink)
20
+ nil
22
21
  end
23
22
 
24
23
  end
@@ -116,7 +116,7 @@ module Crunchbase::Model
116
116
 
117
117
  instance_variable_set "@#{key}", ( object_name.new(item) || nil )
118
118
  end
119
-
119
+
120
120
  def self.get_model_name(resource_list)
121
121
  return nil unless ['organizations', 'people'].include?(resource_list)
122
122
 
@@ -8,12 +8,8 @@ module Crunchbase::Model
8
8
  attr_reader :object
9
9
 
10
10
  def initialize(json)
11
- set_relationship_object('object', Crunchbase::Model::Person, json) if json['type'] == 'Person'
12
- set_relationship_object('object', Crunchbase::Model::Organization, json) if json['type'] == 'Organization'
13
- end
14
-
15
- def set_relationship_object(key, object_name, json)
16
- instance_variable_set "@#{key}", ( object_name.new(json) || nil )
11
+ instance_relationships_object(Crunchbase::Model::Person, 'object', json) if json['type'] == 'Person'
12
+ instance_relationships_object(Crunchbase::Model::Organization, 'object', json) if json['type'] == 'Organization'
17
13
  end
18
14
 
19
15
  def person?
@@ -14,8 +14,8 @@ module Crunchbase::Model
14
14
  super
15
15
 
16
16
  unless (relationships = json['relationships']).nil?
17
- set_relationships_object(Crunchbase::Model::Person, 'person', relationships['person'])
18
- set_relationships_object(Crunchbase::Model::Organization, 'organization', relationships['organization'])
17
+ instance_relationships_object(Crunchbase::Model::Person, 'person', relationships['person'])
18
+ instance_relationships_object(Crunchbase::Model::Organization, 'organization', relationships['organization'])
19
19
  end
20
20
  end
21
21
 
@@ -29,11 +29,5 @@ module Crunchbase::Model
29
29
  %w[ started_on ended_on ]
30
30
  end
31
31
 
32
- def set_relationships_object(object_name, key, item)
33
- return unless item
34
-
35
- instance_variable_set "@#{key}", ( object_name.new(item) || nil )
36
- end
37
-
38
32
  end
39
33
  end
@@ -8,12 +8,8 @@ module Crunchbase::Model
8
8
  attr_reader :object
9
9
 
10
10
  def initialize(json)
11
- set_relationship_object('object', Crunchbase::Model::Person, json) if json['type'] == 'Person'
12
- set_relationship_object('object', Crunchbase::Model::Organization, json) if json['type'] == 'Organization'
13
- end
14
-
15
- def set_relationship_object(key, object_name, json)
16
- instance_variable_set "@#{key}", ( object_name.new(json) || nil )
11
+ instance_relationships_object(Crunchbase::Model::Person, 'object', json) if json['type'] == 'Person'
12
+ instance_relationships_object(Crunchbase::Model::Organization, 'object', json) if json['type'] == 'Organization'
17
13
  end
18
14
 
19
15
  def person?
@@ -11,14 +11,13 @@ module Crunchbase::Model
11
11
  super
12
12
 
13
13
  unless (relationships = json['relationships']).nil?
14
- set_relationships_object(Crunchbase::Model::Person, 'person', relationships['person'])
14
+ instance_relationships_object(Crunchbase::Model::Person, 'person', relationships['person'])
15
15
  end
16
16
  end
17
17
 
18
- def set_relationships_object(object_name, key, item)
19
- return unless item
20
-
21
- instance_variable_set "@#{key}", ( object_name.new(item) || nil )
18
+ # Factory method to return an instance from a permalink
19
+ def self.get(permalink)
20
+ nil
22
21
  end
23
22
 
24
23
  end
@@ -14,6 +14,7 @@ module Crunchbase::Model
14
14
  @query = query
15
15
  @results = []
16
16
  @total_items = 0
17
+ @pages = 0
17
18
 
18
19
  populate_results(json, _model) if json['error'].nil?
19
20
  end
@@ -1,3 +1,3 @@
1
1
  module Crunchbase
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -7,7 +7,7 @@ module Crunchbase
7
7
 
8
8
  before(:all) do
9
9
  begin
10
- @past_team = PastTeam.organization_lists("apple2")
10
+ @past_team = PastTeam.organization_lists("apple")
11
11
  rescue Exception => e
12
12
  @past_team = nil
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchbase-ruby-library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-26 00:00:00.000000000 Z
12
+ date: 2015-05-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -163,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
163
  version: '0'
164
164
  segments:
165
165
  - 0
166
- hash: 1490326135808996398
166
+ hash: -1555948034410529507
167
167
  required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  none: false
169
169
  requirements:
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  segments:
174
174
  - 0
175
- hash: 1490326135808996398
175
+ hash: -1555948034410529507
176
176
  requirements: []
177
177
  rubyforge_project:
178
178
  rubygems_version: 1.8.23.2