Class: DataScope::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/data_scope_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApi

Returns a new instance of Api.



159
160
161
# File 'lib/data_scope_api.rb', line 159

def initialize
  @session = Session.new
end

Instance Attribute Details

#sessionObject (readonly)

Returns the value of attribute session.



157
158
159
# File 'lib/data_scope_api.rb', line 157

def session
  @session
end

Instance Method Details

#extract_with_isin(isin_code, type = :composite, fields = nil, condition = nil) ⇒ Object



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/data_scope_api.rb', line 171

def extract_with_isin(isin_code, type=:composite, fields=nil, condition=nil)
  fields ||= [
    "Close Price",
    "Contributor Code Description",
    "Currency Code Description",
    "Dividend Yield",
    "Main Index",
    "Market Capitalization",
    "Market Capitalization - Local Currency",
    "Percent Change - Close Price - 1 Day",
    "Universal Close Price Date"
  ]
  identifiers = [
    {
      "Identifier" => isin_code,
     "IdentifierType" => "Isin"
    }
  ]
  OnDemandExtract.new(@session, identifiers, type, fields, condition)
end

#extract_with_location(location) ⇒ Object



167
168
169
# File 'lib/data_scope_api.rb', line 167

def extract_with_location(location)
  OnDemandExtract.init_with_location(@session, location)
end

#extract_with_ric(ric_code, type = :composite, fields = nil, condition = nil) ⇒ Object



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/data_scope_api.rb', line 192

def extract_with_ric(ric_code, type=:composite, fields=nil, condition=nil)
  fields ||= [
    "Close Price",
    "Contributor Code Description",
    "Currency Code Description",
    "Dividend Yield",
    "Main Index",
    "Market Capitalization",
    "Market Capitalization - Local Currency",
    "Percent Change - Close Price - 1 Day",
    "Universal Close Price Date"
  ]
  identifiers = [
    {
      "Identifier" => ric_code,
      "IdentifierType" => "Ric"
    }
  ]
  OnDemandExtract.new(@session, identifiers, type, fields, condition)
end

#get_userObject



163
164
165
# File 'lib/data_scope_api.rb', line 163

def get_user
  @user = User.new(@session)
end