sensei_eod_utils 0.0.47 → 0.0.48

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
  SHA256:
3
- metadata.gz: 31d32b2ef01c08152a1144507367a36291fa0cc743c21337584f532987911530
4
- data.tar.gz: b4a3709d72405096085f159aa56190db310afcef8155c3523c7bbb3dbc64db1f
3
+ metadata.gz: 977c529b0edffffdf316c9ecf3fc698aefae0b80c64e6d7c9bf0972f244984cf
4
+ data.tar.gz: 5f4f2005ccdb250bdf9875c59a3262f6d6555ed87677583afc2f1aa21b34464c
5
5
  SHA512:
6
- metadata.gz: 751e530615e2588f002d15db8497742cacfbfc382585ad56750422c0532c06257482a34e09d095bcb304fdbadb1a924bff426ff17aa10d4b57a80e3acab4bc27
7
- data.tar.gz: 7df2c146b62387d51705df21e14949ce10557e1aa31bd16e1f314f6ba1533332538860fa620a038740d7a24254781202de35e0f4a513485d088e58aac7d0dd59
6
+ metadata.gz: a2010c440a0858d5279ec00eebfc756350a2e1398339d1b5e2791bdb4f55ef23128d5b1902c3c86521d094c5cb4c32be44d9f2a2be5484bfec3fa8f9212cb2c7
7
+ data.tar.gz: c8282e3c659bfd8ba6c34d576df898c0789b29e7d3d901a9323ae6df8936c57367af98b36f6088ad789903b59c62c8cec3c53a83074459eb8ad3ecd828a58185
@@ -0,0 +1,27 @@
1
+ require 'ostruct'
2
+ require 'httparty'
3
+
4
+ module SenseiApi
5
+ class Base
6
+ class <<self
7
+ def find_by(params)
8
+ response = HTTParty.get(url, query: params.compact, format: :json)
9
+ JSON.parse(response.body, object_class: OpenStruct)
10
+ end
11
+
12
+ def create(params)
13
+ response = HTTParty.post(url, body: params.compact.reject { |key, _| key == :id }, format: :json)
14
+ JSON.parse(response.body, object_class: OpenStruct)
15
+ end
16
+
17
+ def update(params)
18
+ response = HTTParty.put(url, body: params.compact, format: :json)
19
+ JSON.parse(response.body, object_class: OpenStruct)
20
+ end
21
+
22
+ def url
23
+ raise NotImplementedError
24
+ end
25
+ end
26
+ end
27
+ end
@@ -13,3 +13,5 @@ require 'eod_facade/options.rb'
13
13
  require 'eod_facade/eod.rb'
14
14
 
15
15
  require 'eod_services/instrument_type.rb'
16
+
17
+ require 'sensei_api/base'
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'sensei_eod_utils'
5
- s.version = '0.0.47'
5
+ s.version = '0.0.48'
6
6
  s.date = '2019-12-20'
7
7
  s.summary = 'Sensei trader utility functions and Eod api facade'
8
8
  s.authors = ['Nishant Shah']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensei_eod_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.47
4
+ version: 0.0.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nishant Shah
@@ -88,6 +88,7 @@ files:
88
88
  - lib/eod_models/trade_action.rb
89
89
  - lib/eod_services/contract.rb
90
90
  - lib/eod_services/instrument_type.rb
91
+ - lib/sensei_api/base.rb
91
92
  - lib/sensei_eod_utils.rb
92
93
  - sensei_eod_utils.gemspec
93
94
  homepage: https://rubygems.org/gems/sensei_eod_utils