Convert a bunch of HTTP links to HTTPS (#1757)

This commit is contained in:
Alex Jordan 2016-10-31 16:21:03 -07:00 committed by Andrew Cantino
parent 9a3290ef40
commit 77da54ea0c
5 changed files with 14 additions and 14 deletions

View file

@ -5,13 +5,13 @@ module Agents
description <<-MD
The StubHub Agent creates an event for a given StubHub Event.
It can be used to track how many tickets are available for the event and the minimum and maximum price. All that is required is that you paste in the url from the actual event, e.g. http://www.stubhub.com/outside-lands-music-festival-tickets/outside-lands-music-festival-3-day-pass-san-francisco-golden-gate-park-polo-fields-8-8-2014-9020701/
It can be used to track how many tickets are available for the event and the minimum and maximum price. All that is required is that you paste in the url from the actual event, e.g. https://www.stubhub.com/outside-lands-music-festival-tickets/outside-lands-music-festival-3-day-pass-san-francisco-golden-gate-park-polo-fields-8-8-2014-9020701/
MD
event_description <<-MD
Events looks like this:
{
"url": "http://stubhub.com/valid-event-url"
"url": "https://stubhub.com/valid-event-url"
"name": "Event Name"
"date": "2014-08-01"
"max_price": "999.99"
@ -29,7 +29,7 @@ module Agents
end
def default_options
{ 'url' => 'http://stubhub.com/enter-your-event-here' }
{ 'url' => 'https://stubhub.com/enter-your-event-here' }
end
def validate_options
@ -63,7 +63,7 @@ module Agents
end
def base_url
'http://www.stubhub.com/listingCatalog/select/?q='
'https://www.stubhub.com/listingCatalog/select/?q='
end
def build_url

View file

@ -7,7 +7,7 @@ module Agents
Services are provided using Microsoft Translator. You can [sign up](https://datamarket.azure.com/dataset/bing/microsofttranslator) and [register your application](https://datamarket.azure.com/developer/applications/register) to get `client_id` and `client_secret` which are required to use this agent.
`to` must be filled with a [translator language code](http://msdn.microsoft.com/en-us/library/hh456380.aspx).
`to` must be filled with a [translator language code](https://msdn.microsoft.com/en-us/library/hh456380.aspx).
Specify what you would like to translate in `content` field, you can use [Liquid](https://github.com/cantino/huginn/wiki/Formatting-Events-using-Liquid) specify which part of the payload you want to translate.
@ -34,7 +34,7 @@ module Agents
end
def translate(text, to, access_token)
translate_uri = URI 'http://api.microsofttranslator.com/v2/Ajax.svc/Translate'
translate_uri = URI 'https://api.microsofttranslator.com/v2/Ajax.svc/Translate'
params = {
'text' => text,
'to' => to
@ -63,7 +63,7 @@ module Agents
auth_uri = URI "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13"
response = postform auth_uri, :client_id => interpolated['client_id'],
:client_secret => interpolated['client_secret'],
:scope => "http://api.microsofttranslator.com",
:scope => "https://api.microsofttranslator.com",
:grant_type => "client_credentials"
access_token = JSON.parse(response.body)["access_token"]
incoming_events.each do |event|

View file

@ -18,10 +18,10 @@ module Agents
The `location` should be:
* For Wunderground: A US zipcode, or any location that Wunderground supports. To find one, search [wunderground.com](http://wunderground.com) and copy the location part of the URL. For example, a result for San Francisco gives `http://www.wunderground.com/US/CA/San_Francisco.html` and London, England gives `http://www.wunderground.com/q/zmw:00000.1.03772`. The locations in each are `US/CA/San_Francisco` and `zmw:00000.1.03772`, respectively.
* For Wunderground: A US zipcode, or any location that Wunderground supports. To find one, search [wunderground.com](https://wunderground.com) and copy the location part of the URL. For example, a result for San Francisco gives `https://www.wunderground.com/US/CA/San_Francisco.html` and London, England gives `https://www.wunderground.com/q/zmw:00000.1.03772`. The locations in each are `US/CA/San_Francisco` and `zmw:00000.1.03772`, respectively.
* For Dark Sky: `location` must be a comma-separated string of co-ordinates (longitude, latitude). For example, San Francisco would be `37.7771,-122.4196`.
You must setup an [API key for Wunderground](http://www.wunderground.com/weather/api/) in order to use this Agent with Wunderground.
You must setup an [API key for Wunderground](https://www.wunderground.com/weather/api/) in order to use this Agent with Wunderground.
You must setup an [API key for Dark Sky](https://darksky.net/dev/) in order to use this Agent with Dark Sky.
@ -49,7 +49,7 @@ module Agents
},
"conditions": "Rain Showers",
"icon": "rain",
"icon_url": "http://icons-ak.wxug.com/i/c/k/rain.gif",
"icon_url": "https://icons-ak.wxug.com/i/c/k/rain.gif",
"skyicon": "mostlycloudy",
...
}

View file

@ -47,7 +47,7 @@ module Agents
"@_attr_" is the XPath expression to extract the value of an attribute named _attr_ from a node, and `string(.)` gives a string with all the enclosed text nodes concatenated without entity escaping (such as `&amp;`). To extract the innerHTML, use `./node()`; and to extract the outer HTML, use `.`.
You can also use [XPath functions](http://www.w3.org/TR/xpath/#section-String-Functions) like `normalize-space` to strip and squeeze whitespace, `substring-after` to extract part of a text, and `translate` to remove commas from formatted numbers, etc. Instead of passing `string(.)` to these functions, you can just pass `.` like `normalize-space(.)` and `translate(., ',', '')`.
You can also use [XPath functions](https://www.w3.org/TR/xpath/#section-String-Functions) like `normalize-space` to strip and squeeze whitespace, `substring-after` to extract part of a text, and `translate` to remove commas from formatted numbers, etc. Instead of passing `string(.)` to these functions, you can just pass `.` like `normalize-space(.)` and `translate(., ',', '')`.
Beware that when parsing an XML document (i.e. `type` is `xml`) using `xpath` expressions, all namespaces are stripped from the document unless the top-level option `use_namespaces` is set to `true`.
@ -141,7 +141,7 @@ module Agents
def default_options
{
'expected_update_period_in_days' => "2",
'url' => "http://xkcd.com",
'url' => "https://xkcd.com",
'type' => "html",
'mode' => "on_change",
'extract' => {

View file

@ -3,7 +3,7 @@ require 'rails_helper'
describe Agents::StubhubAgent do
let(:name) { 'Agent Name' }
let(:url) { 'http://www.stubhub.com/event/name-1-1-2014-12345' }
let(:url) { 'https://www.stubhub.com/event/name-1-1-2014-12345' }
let(:parsed_body) { JSON.parse(body)['response']['docs'][0] }
let(:valid_params) { { 'url' => parsed_body['url'] } }
let(:body) { File.read(Rails.root.join('spec/data_fixtures/stubhub_data.json')) }
@ -20,7 +20,7 @@ describe Agents::StubhubAgent do
} }
before do
stub_request(:get, "http://www.stubhub.com/listingCatalog/select/?q=%2B%20stubhubDocumentType:event%0D%0A%2B%20event_id:#{stubhub_event_id}%0D%0A&rows=10&start=0&wt=json").
stub_request(:get, "https://www.stubhub.com/listingCatalog/select/?q=%2B%20stubhubDocumentType:event%0D%0A%2B%20event_id:#{stubhub_event_id}%0D%0A&rows=10&start=0&wt=json").
to_return(:status => 200, :body => body, :headers => {})
@stubhub_agent = described_class.new(name: name, options: valid_params)