capital-iq 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWFlMDdkYzAzOTVmNDI0Y2VhOTM2NWNiMzZhMWQ5NjMzMDEzZjUxNw==
4
+ YzMxOGI3NmQ2N2QxOTg2NTRlZGYwNDJmNGMyODc3YjhjMDFlYjEzNQ==
5
5
  data.tar.gz: !binary |-
6
- Yjc1Y2MxNjQ4ZjM5YjViOGIxYjY2MTM5NTU2N2ZmMDI1OTYxMGZjMw==
6
+ ZTUwZTI5M2Y2ZDgyZDZjNzFiN2NkMzczNmUyMmJhNjFjZjlkZDg2OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTBiNzMwMzg3NDgwZDcxNWUyMTExODAwODUwODQyZmM4MzA2ZjgxMzQzYzIw
10
- ODE2MzZjM2Q0NjM4ZTIzNTMyZDdlOWU5ZjE0MzBlMzE3NGQ2ZjVkZTY4OGI0
11
- ZmQ5NzQ5ZGRlYjU3MmY5NjEwOWE2MjY0NTBhNTlkZDE1MThjNzE=
9
+ NWJkYmRkMzZhYTU2YzRjNzEwNTEwYjY2NjIyZGY4MzMwZmM2NTY3MGY0ZDA4
10
+ MTg2N2FlZTFmMDA2YjIxMDI3Mjk1ZWNhMGQ4ODcyNWVmNzJlNzUxNzgwYjk4
11
+ Y2U3NmRkZjY5ODI4ZDNmOGNmNmE5ZTZhYjgxMDUyOWU3YWIzZDQ=
12
12
  data.tar.gz: !binary |-
13
- YTFmZDM0MTdjZGJjMjFkYTg5NTExMDc5NDA5Mzc3Mzg2ZWQxNjFhZDk5NmYw
14
- MjhlYWQyODc5MmY0NTZiMGU4MjRlMTEzYWNkNmEwZDc4ZDVlNzEwZTllMjI0
15
- NjI3OWY4MjEyNTQwNjRjYmM3Mjk3OGM1ZjE0MzBlNTdhMWFkNzY=
13
+ NjUyZWU3NWE0YzJlZWNkODQyMTliYmNlMDNlOTM2ZDFjZmE2MWZjMWViNGU1
14
+ OWMzOGI4YWZkZjI3ZmYyODU5M2M5Y2I1YWUwYzVmMDA0MTViZTQzNDZmMTJh
15
+ MjQwNTczYTY5MjRlNjdlMTEyY2YzN2I4YjY4NjE0ZTE4MTkwZjA=
@@ -2,6 +2,12 @@
2
2
 
3
3
  Ruby API wrapper to Capital IQ API.
4
4
 
5
+
6
+ == Installation
7
+
8
+ gem install capital-iq
9
+
10
+
5
11
  == Usage
6
12
 
7
13
  client = CapitalIQ::Base.new('user@host.com', 'sfd98j429ds')
@@ -13,9 +19,6 @@ Ruby API wrapper to Capital IQ API.
13
19
  client.gdsp_request('IQ231729634', 'IQ_CITY')
14
20
  => "San Francisco"
15
21
 
16
-
17
-
18
-
19
22
 
20
23
  == Contributing to capital-iq
21
24
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.3
@@ -2,15 +2,15 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: capital-iq 0.0.1 ruby lib
5
+ # stub: capital-iq 0.0.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "capital-iq"
9
- s.version = "0.0.1"
9
+ s.version = "0.0.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Ian Morgan"]
13
- s.date = "2014-09-26"
13
+ s.date = "2014-10-06"
14
14
  s.description = "Ruby wrapper for the CapIQ API"
15
15
  s.email = "ian@ruby-code.com"
16
16
  s.extra_rdoc_files = [
@@ -1,4 +1,5 @@
1
1
  require 'httparty'
2
+ require 'json'
2
3
  require_relative 'capital-iq/base'
3
4
  require_relative 'capital-iq/request'
4
5
  require_relative 'capital-iq/api-error'
@@ -1,6 +1,7 @@
1
1
  module CapitalIQ
2
2
  class Base
3
- include HTTParty
3
+ ENDPOINT = 'https://sdk.gds.standardandpoors.com/gdssdk/rest/v2/clientservice.json'
4
+ include HTTParty
4
5
  format :json
5
6
 
6
7
  def initialize(username, password)
@@ -9,38 +10,50 @@ module CapitalIQ
9
10
 
10
11
  def request(function, identifier, mnemonic, properties)
11
12
  request_body = Request.new(function, identifier, mnemonic, properties).request
12
- response_data = self.class.post('https://sdk.gds.standardandpoors.com/gdssdk/rest/v2/clientservice.json', body: request_body, basic_auth: @auth, ssl_version: :SSLv3).parsed_response
13
+ response_data = self.class.post(ENDPOINT, body: request_body, basic_auth: @auth, ssl_version: :SSLv3).parsed_response
13
14
  response = response_data[response_data.keys.first].first
14
15
  raise CapitalIQ::APIError, response['ErrMsg'] if response['ErrMsg']
15
16
  response
16
17
  end
17
-
18
+
18
19
  def gdst_request(identifier, mnemonic)
19
20
  response = request('GDST', identifier, mnemonic, {PERIODTYPE: "IQ_FQ"})
20
21
  response['Rows'].first['Row'].first
21
22
  end
22
-
23
+
23
24
  def gdsp_request(identifier, mnemonic)
24
25
  response = request('GDSP', identifier, mnemonic, nil)
25
26
  response['Rows'].first['Row'].first
26
27
  end
27
-
28
- def quick_match(name)
29
- response = request('GDSHE', name, 'IQ_COMPANY_ID_QUICK_MATCH', {startRank:"1", endRank:"5"})
28
+
29
+ def gdshe_request(identifier, mnemonic, properties)
30
+ response = request('GDSHE', identifier, mnemonic, properties)
30
31
  response['Rows'].first['Row'].first
31
32
  end
32
-
33
+
34
+ def quick_match(name)
35
+ gdshe_request(name, 'IQ_COMPANY_ID_QUICK_MATCH', {startRank:"1", endRank:"5"})
36
+ end
37
+
33
38
  def match_and_request(name, mnemonic)
34
39
  identifier = quick_match(name)
35
- response = gdsp_request(identifier, mnemonic)
36
- response['Rows'].first['Row'].first
40
+ gdsp_request(identifier, mnemonic)
37
41
  end
38
-
39
- def transaction_list(name)
42
+
43
+ def transaction_list(identifier)
44
+ transaction_items = ['IQ_TR_TARGET_ID', 'IQ_TR_BUYER_ID', 'IQ_TR_SELLER_ID', 'IQ_TR_STATUS', 'IQ_TR_CLOSED_DATE', 'IQ_TR_IMPLIED_EV_FINAL']
45
+ walk_transactions(identifier, transaction_items)
46
+ end
47
+
48
+ def pe_transactions(identifier)
49
+ transaction_items = ['IQ_COMPANY_NAME']
50
+ walk_transactions(identifier, transaction_items)
51
+ end
52
+
53
+ private
54
+ def walk_transactions(identifier, transaction_items)
40
55
  acquisitions = {}
41
- identifier = quick_match(name)
42
56
  transaction_list = request('GDSHE', identifier, 'IQ_TRANSACTION_LIST_MA', {startRank:"1", endRank:"20"})
43
- transaction_items = ['IQ_TR_TARGET_ID', 'IQ_TR_BUYER_ID', 'IQ_TR_SELLER_ID', 'IQ_TR_STATUS']
44
57
  return nil if transaction_list['Rows'].first["Row"].first == 'Data Unavailable'
45
58
  transaction_list['Rows'].each do |transaction|
46
59
  acquisitions[transaction['Row'].first] = transaction_items.map {|transaction_item|
@@ -55,18 +68,9 @@ module CapitalIQ
55
68
  ]
56
69
  }.reduce({}, :merge)
57
70
  end
58
- acquisitions
59
- end
60
- end
61
-
62
- class Transaction
63
-
64
- end
65
- end
66
-
67
- # Multiple datapoints in request, support in request class/method
68
-
69
- # CapIQ IDs in Org table
71
+ acquisitions
70
72
 
71
- # Sellers in Organization table?
73
+ end
72
74
 
75
+ end
76
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capital-iq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-26 00:00:00.000000000 Z
11
+ date: 2014-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty