crunchbase-api 0.2.0 → 0.2.1

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: 6c2ac0fa42f645c3bb02ef986561ce5e7c492b27
4
- data.tar.gz: b75493f9cd774d2d6d6f6abcac7ffaf23b8dbae2
3
+ metadata.gz: 452abeab234d7e3409496d5492c949ee37a229cc
4
+ data.tar.gz: fc5890fc883db7e945be0c2b9a9d3d532c899c9a
5
5
  SHA512:
6
- metadata.gz: ac19af8c511f8c632fc7999b405d42f1eb412743e564d7d586b4836a81b5406663b10a8605f368cb81970a1fe7b4247a6943bd15f8d5f95a52af3778e57c9a1d
7
- data.tar.gz: 83acc5090188aabda059a60f69586d8a4be9f540a28de0f00532f9dfad92446aff204fc291fa504369c60cc3df356958624e44a3a67718117ae346f23966eebe
6
+ metadata.gz: ac4e0833a76240b40cd3a1f24ef943defc812f89e5836e5598043ec00d5b3a16f70e437c613fcbc21696e64f315f28aaefea2867783c1895543ecc3b30d18a68
7
+ data.tar.gz: 997587789ea3dabb92bc4ae1015c0e7686aee66ea1b3ad8839959ef8c1df6cb8f3999b36a0074d589088b0be951b5cafa8c86890571a388e8d42b5fcc6a154d7
@@ -3,6 +3,3 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  - 2.1.0
6
-
7
- env:
8
- secure: "KVB7wcUFXijzIHebnXDbvSvhArBgDlyX19P/r9X+e0+3gXBPh7B0omAFaPdqb6iHye7RimJduab3hGlmKv/4wYfz09gcIQYu5i1YhNaKSuZI+/gBT6t8c0nzVzNWenISNt/+mTExD7Ew65+F7SY57NbZNpnYT4Nis2DFFPNIgYQ="
@@ -26,21 +26,25 @@ module Crunchbase
26
26
 
27
27
  def fetch(resource, data = {})
28
28
  data[:user_key] = self.user_key
29
- uri = "#{self.api_endpoint}/#{resource}?"
30
- uri << data.map { |k, v| "#{URI::escape(k.to_s)}=#{URI::escape(v.to_s)}" }.join('&')
29
+ uri_str = "#{self.api_endpoint}/#{resource}?"
30
+ uri_str << data.map { |k, v| "#{URI::escape(k.to_s)}=#{URI::escape(v.to_s)}" }.join('&')
31
31
 
32
32
  begin
33
- response = Net::HTTP.get_response(URI.parse uri)
33
+ uri = URI.parse(uri_str)
34
+ http = Net::HTTP.new(uri.host, uri.port)
35
+ http.use_ssl = true
36
+ request = Net::HTTP::Get.new(uri.request_uri)
37
+ response = http.request(request)
34
38
  raise CrunchbaseException, response.body.to_s unless response.code.to_i == 200
35
39
  body = response.body.to_s
36
40
  rescue => e
37
- raise CrunchbaseException, "Failed to fetch #{uri}: #{e}"
41
+ raise CrunchbaseException, "Failed to fetch #{uri_str}: #{e}"
38
42
  end
39
43
 
40
44
  begin
41
45
  response = JSON.parse body
42
46
  rescue => e
43
- raise CrunchbaseException, "Failed to parse response for #{uri}: #{e}"
47
+ raise CrunchbaseException, "Failed to parse response for #{uri_str}: #{e}"
44
48
  end
45
49
 
46
50
  if response['data']['error'] and response['data']['error']['message']
@@ -3,7 +3,7 @@ module Crunchbase
3
3
 
4
4
  OPTIONS = [:user_key, :api_endpoint].freeze
5
5
  USER_KEY = nil
6
- API_ENDPOINT = 'http://api.crunchbase.com/v/2'
6
+ API_ENDPOINT = 'https://api.crunchbase.com/v/2'
7
7
 
8
8
  attr_accessor *OPTIONS
9
9
 
@@ -1,3 +1,3 @@
1
1
  module Crunchbase
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -3,10 +3,10 @@ require 'helper'
3
3
  describe 'Organization', :vcr do
4
4
 
5
5
  it 'should retrieve organization by domain' do
6
- relation = Crunchbase::Organization.find_all_by_domain_name('facebook.com').first
6
+ relation = Crunchbase::Organization.find_all_by_domain_name('infogr.am').first
7
7
  c = relation.fetch
8
8
  c.must_be_instance_of Crunchbase::Organization
9
- c.name.must_equal 'Facebook'
9
+ c.name.must_equal 'Infogram'
10
10
  end
11
11
 
12
12
  it 'should retrieve organization by name' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchbase-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandis Klakovskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-16 00:00:00.000000000 Z
11
+ date: 2015-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json