latest_stock_price 1.0.1 → 1.0.3

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: 778aa58d46b698c7ab1c11decce31b6f2689f452f020de2af52ffab4db1f84a4
4
- data.tar.gz: 5db44299e9edc950fb50b47811b1a547245689335e52e2e5c92caa4af9402da8
3
+ metadata.gz: dac3a6f27080e915c85d5486a20dd7fcc92083d13af3af4c731db4d944ac17d0
4
+ data.tar.gz: a5b193c3cde9397bc3db7fd381e824b5cff5fcc4d62d5a8207203d76599e7c97
5
5
  SHA512:
6
- metadata.gz: ed3f4a9ff4eb85af61610f104c1cb0b6e03f478fc5617e3b2e3f8be6a04544c322dd11dcfca2c7b16a37e45143e9ad55c5dad3c3638b296d7a085e0c40117fc4
7
- data.tar.gz: 83a87189ae8f73ab38792d3eff836f38842ace39740d596402e47c78a0ce50d8b9c2513144fda955a4f047db3bd94a6306bc86c981db88ebfd4965068ce55f4c
6
+ metadata.gz: 8647a2d9f7717a3fd1be5d00c759b0b311341bfbe1f65ff970f551366fc71ad758902b369936d04b8012847501d5d26ebc08d4daa3e5a18be0ddf8e7f3e764c7
7
+ data.tar.gz: fccd038bcd0c10b8a4f78be09f89522a3cb42d9d3895c8c5e4a9d5369812ba38a04401096bcb80ada5385b3ac3236b8fe53cbacd7b49078c9ff719a6111c5834
data/CHANGELOG.md CHANGED
@@ -6,4 +6,13 @@
6
6
 
7
7
  ## 1.0.1 (29-Oct-24)
8
8
 
9
- * Fix Folder structure
9
+ * Fix Folder structure
10
+
11
+ ## 1.0.2 (29-Oct-24)
12
+
13
+ * Fix README.md
14
+ * Removed redundant `.env` file.
15
+
16
+ ## 1.0.3 (29-Oct-24)
17
+
18
+ * Remove redundant gem `debug`
data/README.md CHANGED
@@ -1,23 +1,108 @@
1
- ## Read Me
2
1
 
2
+ ### Setup
3
3
 
4
- ## Setup
4
+ If you don’t already have bundle, then run this in your project directory (where you’d like to use this gem):
5
+
6
+ #### 1. Add The Gem
7
+
8
+ ```
9
+ bundle init
10
+ ```
11
+
12
+ This will add a **Gemfile** to your project directory.
13
+
14
+ Inside the gem file, add the gem and dependencies like so:
15
+
16
+ ```
17
+ gem 'latest_stock_price', ‘1.0.1’ # Ensure to use version 1.0.1 or above.
18
+ gem 'dotenv', '~> 3.0.0' # Dependency required.
19
+ ```
20
+
21
+ To install the gems, run:
5
22
 
6
23
  ```
7
24
  bundle install
8
25
  ```
9
26
 
10
- #### Create Your Environment Variables File
11
- Copy the sample.env file to create your local .env file:
27
+ #### 2. Configure Credentials
28
+
29
+ This gem uses APIs from rapidapi.com. Ensure an account is created and gather your secret key after logging in.
30
+
31
+ In your project directory, create a `.env` file using the following command:
32
+
33
+ ```
34
+ touch .env
35
+ ```
36
+
37
+ Open the newly created `.env` file and add:
38
+
39
+ ```
40
+ # Rapid API credentials
41
+ X_RAPIDAPI_KEY=‘Add_your_rapid_api_key_here’
42
+ X_RAPIDAPI_HOST='latest-stock-price.p.rapidapi.com'
43
+ ```
44
+
45
+ ### Example Usage
46
+
47
+ As an example, create a new file in you project directory:
48
+
49
+ ```
50
+ touch example.rb
51
+ ```
52
+
53
+ There are 3 ways to interact with the gem:
54
+
55
+ #### 1. Get all the latest stock prices:
56
+
57
+ ```ruby
58
+ # example.rb
59
+ require 'bundler/setup'
60
+ require 'latest_stock_price'
61
+
62
+ price_all = LatestStockPrice::PriceAll.fetch
63
+ puts price_all
64
+ ```
65
+
66
+ In your project repository, run the following command to get the prices of all the stocks:
67
+
68
+ ```ruby
69
+ ruby example.rb # should return an object with many stock data
70
+ ```
71
+
72
+ #### 2. Get the latest price of a specific stock:
73
+
74
+ ```ruby
75
+ # example.rb
76
+ require 'bundler/setup'
77
+ require 'latest_stock_price'
78
+
79
+ price = LatestStockPrice::Price.fetch("AAATECH.NS")
80
+ puts price
81
+ ```
82
+
83
+ In your project repository, run the following command to get the price of a specific stock:
84
+
85
+ ```
86
+ ruby example.rb # should return an object with one stock.
87
+ ```
88
+
89
+ #### 3. Get the latest prices for a specified list of stocks:
90
+
91
+ ```ruby
92
+ # example.rb
93
+ require 'bundler/setup'
94
+ require 'latest_stock_price'
95
+
96
+ prices = LatestStockPrice::Prices.fetch(['AAATECH.NS', 'AADHHOUS.NS'])
97
+ puts prices
98
+ ```
99
+
100
+ In your project repository, run the following command for a list of the stocks and their data.
12
101
 
13
102
  ```
14
- cp sample.env .env
103
+ ruby example.rb # should return an object with the specified stocks.
15
104
  ```
16
105
 
17
- #### Set Your API Keys
18
- Open the .env file in your preferred text editor and add your API keys:
19
- # .env
20
- RAPIDAPI_KEY='your_actual_api_key'
21
- RAPIDAPI_HOST='latest-stock-price.p.rapidapi.com'
106
+ ### Warnings
22
107
 
23
- **Note:** To obtain a Rapid APi key, login to your Rapid Api account and find it in the account settings.
108
+ The `.env` file contains your secret key. Ensure the file does not get committed to remote repositories by adding it to your `.gitignore` file.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "latest_stock_price"
3
- s.version = "1.0.1"
3
+ s.version = "1.0.3"
4
4
  s.summary = "Latest stock price"
5
5
  s.authors = ["Ciever Hassan"]
6
6
  s.description = "A gem for displaying the latest stock price."
@@ -19,8 +19,7 @@ Gem::Specification.new do |s|
19
19
  "spec/price_all_spec.rb",
20
20
  "spec/price_spec.rb",
21
21
  "spec/prices_spec.rb",
22
- "spec/spec_helper.rb",
23
- "sample.env",
22
+ "spec/spec_helper.rb",
24
23
  "README.md",
25
24
  "CHANGELOG.md",
26
25
  "Gemfile",
@@ -33,5 +32,4 @@ Gem::Specification.new do |s|
33
32
 
34
33
  s.add_dependency 'net-http', '~> 0.4.1'
35
34
  s.add_dependency 'uri', '~> 0.10.0'
36
- s.add_dependency 'debug', '~> 1.8'
37
35
  end
@@ -1,4 +1,3 @@
1
- require 'debug'
2
1
  require 'spec_helper'
3
2
  require 'webmock/rspec'
4
3
  require './lib/latest_stock_price/http_client'
@@ -1,4 +1,3 @@
1
- require 'debug'
2
1
  require 'spec_helper'
3
2
  require 'webmock/rspec'
4
3
  require './lib/latest_stock_price/price_all'
data/spec/price_spec.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'debug'
2
1
  require 'spec_helper'
3
2
  require 'webmock/rspec'
4
3
  require './lib/latest_stock_price/price'
data/spec/prices_spec.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'debug'
2
1
  require 'spec_helper'
3
2
  require 'webmock/rspec'
4
3
  require './lib/latest_stock_price/prices'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: latest_stock_price
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ciever Hassan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-28 00:00:00.000000000 Z
11
+ date: 2024-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.10.0
83
- - !ruby/object:Gem::Dependency
84
- name: debug
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.8'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.8'
97
83
  description: A gem for displaying the latest stock price.
98
84
  email: ciever.a.h@hotmail.com
99
85
  executables: []
@@ -111,7 +97,6 @@ files:
111
97
  - lib/price_all.rb
112
98
  - lib/prices.rb
113
99
  - lib/version.rb
114
- - sample.env
115
100
  - spec/http_client_spec.rb
116
101
  - spec/price_all_spec.rb
117
102
  - spec/price_spec.rb
data/sample.env DELETED
@@ -1,3 +0,0 @@
1
- # Rapid APi credentials
2
- X_RAPIDAPI_KEY='your_rapidapi_key_here'
3
- X_RAPIDAPI_HOST='your_rapidpia_host'