File tree Expand file tree Collapse file tree 6 files changed +20
-10
lines changed
Expand file tree Collapse file tree 6 files changed +20
-10
lines changed Original file line number Diff line number Diff line change 7676 rack (3.1.7 )
7777 rainbow (3.1.1 )
7878 rake (13.2.1 )
79- rate_center (0.1.6 )
79+ rate_center (0.1.7 )
8080 regexp_parser (2.9.2 )
8181 rexml (3.3.8 )
8282 rspec (3.13.0 )
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ module App
44 class Handler
55 def self . process ( **)
66 new . process
7+ rescue StandardError => e
8+ Sentry . capture_exception ( e )
9+ raise ( e )
710 end
811
912 def process
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ default: &default
33 skyetel_username : " <%= ENV['SKYETEL_USERNAME'] % >"
44 skyetel_password : " <%= ENV['SKYETEL_PASSWORD'] % >"
55 supported_cities_data_file : " <%= ENV.fetch('SUPPORTED_CITIES_DATA_FILE', 'supported_cities.csv') % >"
6- min_stock : " <%= ENV.fetch('MIN_STOCK', 50 ) % >"
7- max_stock : " <%= ENV.fetch('MAX_STOCK', 100 ) % >"
6+ min_stock : " <%= ENV.fetch('MIN_STOCK', 0 ) % >"
7+ max_stock : " <%= ENV.fetch('MAX_STOCK', 0 ) % >"
88 somleng_number_visibility : " <%= ENV.fetch('SOMLENG_NUMBER_VISIBILITY', 'public') % >"
99
1010development : &development
Original file line number Diff line number Diff line change 1+ # Examples
2+
13## Build your own docker image
24
3- 1 . Edit the supported_cities.csv file with a list of supported cities
4- 2 . Build your own docker image
5+ Edit the supported_cities.csv file with a list of supported cities and build your own docker image.
56
67``` bash
78docker buildx build -t --platform linux/amd64 somleng-skyetel:example .
89```
910
10- 3 . Run your image
11+ ## Deployment
12+
13+ The image is ready to be deployed to AWS Lambda and can be triggered by a scheduler.
14+
15+ ## Standalone mode
16+
17+ If you're not using Lambda, you can run your image with the following command.
1118
1219``` bash
13- docker run --platform linux/amd64 --rm -it -- entrypoint /bin/sh somleng-skyetel:example
20+ docker run --platform linux/amd64 --rm -it -e APP_ENV=production -e SOMLENG_API_KEY= ' somleng-carrier-api-key ' SOMLENG_API_KEY= ' somleng-carrier-api-key ' -e SKYETEL_USERNAME= ' skyetel-username ' -e SKYETEL_PASSWORD= ' skyetel-password ' -e MAX_STOCK=2 -- entrypoint ruby somleng-skyetel:example -r ./app.rb -e App::Handler.process
1421```
Original file line number Diff line number Diff line change 11country , region , name
2- US , NY , New York
2+ US , FL , Jacksonville
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ module App
1717 }
1818 ] . to_json
1919 )
20- stub_app_settings ( max_stock : 2 )
20+ stub_app_settings ( min_stock : 2 , max_stock : 3 )
2121 stub_jsonapi_request (
2222 :get , "https://api.somleng.org/carrier/v1/phone_numbers/stats" ,
2323 response_body : file_fixture ( "somleng/responses/phone_number_stats.json" ) . read
@@ -40,7 +40,7 @@ module App
4040
4141 App ::Handler . process ( event : { } , context : double ( "LambdaContext" , as_json : { } ) )
4242
43- expect ( a_request ( :post , "https://api.somleng.org/carrier/v1/phone_numbers" ) ) . to have_been_made . times ( 2 )
43+ expect ( a_request ( :post , "https://api.somleng.org/carrier/v1/phone_numbers" ) ) . to have_been_made . times ( 4 )
4444 end
4545 end
4646end
You can’t perform that action at this time.
0 commit comments