Use code blocks in README
This commit is contained in:
parent
11b6b4f110
commit
76e1816d3f
1 changed files with 10 additions and 4 deletions
14
README.md
14
README.md
|
@ -4,24 +4,30 @@ Text alerting on a website content change
|
||||||
|
|
||||||
* web request
|
* web request
|
||||||
|
|
||||||
|
```
|
||||||
require 'net/http'
|
require 'net/http'
|
||||||
uri = URI('https://github.com/chrisvfritz')
|
uri = URI('https://github.com/chrisvfritz')
|
||||||
content = Net::HTTP.get(uri)
|
content = Net::HTTP.get(uri)
|
||||||
|
```
|
||||||
|
|
||||||
* parse content
|
* parse content
|
||||||
|
|
||||||
|
```
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
parsed = Nokogiri::HTML(content)
|
parsed = Nokogiri::HTML(content)
|
||||||
chris\_face = parse.css('.avatar').attr('src').value
|
chris_face = parse.css('.avatar').attr('src').value
|
||||||
|
```
|
||||||
|
|
||||||
* ??? (process)
|
* ??? (process)
|
||||||
|
|
||||||
* send text
|
* send text
|
||||||
|
|
||||||
|
```
|
||||||
require 'twilio-ruby'
|
require 'twilio-ruby'
|
||||||
client = Twilio::REST::Client.new(account\_sid, auth\_token)
|
client = Twilio::REST::Client.new(account_sid, auth_token)
|
||||||
client.messages.create(
|
client.messages.create(
|
||||||
from: from\_number,
|
from: from_number,
|
||||||
to: notification\_number,
|
to: notification_number,
|
||||||
body: 'Repos changed'
|
body: 'Repos changed'
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue