55 "errors"
66 "fmt"
77 "log"
8+ "net/http"
89 "strings"
910 "time"
1011
@@ -19,7 +20,7 @@ type RefiWebFetcher struct {
1920}
2021
2122func (r * RefiWebFetcher ) Fetch () ([]models.FeedItem , error ) {
22- body , err := makeRequest (fmt .Sprintf ("https://api.reliefweb.int/v1/countries/%v" , r .Country .ReliefWeb ), "get" , nil )
23+ body , err := makeRequest (fmt .Sprintf ("https://api.reliefweb.int/v1/countries/%v" , r .Country .ReliefWeb ), http . MethodGet , nil )
2324 if err != nil {
2425 return nil , err
2526 }
@@ -65,8 +66,8 @@ func (r *RefiWebFetcher) parseItem(t *goquery.Selection) (*models.FeedItem, erro
6566 if len (segments ) == 0 || to .Int64 (segments [len (segments )- 1 ]) == 0 {
6667 return & item , nil
6768 }
68- nodeUrl := fmt .Sprintf ("http://api.rwlabs.org/v0/report/%v" , segments [len (segments )- 1 ])
69- body , err := makeRequest (nodeUrl , "get" , nil )
69+ nodeURL := fmt .Sprintf ("http://api.rwlabs.org/v0/report/%v" , segments [len (segments )- 1 ])
70+ body , err := makeRequest (nodeURL , "get" , nil )
7071 if err != nil {
7172 return nil , err
7273 }
@@ -83,31 +84,6 @@ func (r *RefiWebFetcher) parseItem(t *goquery.Selection) (*models.FeedItem, erro
8384 return & item , nil
8485}
8586
86- // type RWResponse struct {
87- // Version string `json:"version"`
88- // Status int `json:"status"`
89- // Time int `json:"time"`
90- // Data struct {
91- // Type string `json:"type"`
92- // ID int `json:"id"`
93- // Item struct {
94- // ID int `json:"id"`
95- // Name string `json:"name"`
96- // Description string `json:"description"`
97- // Status string `json:"status"`
98- // Iso3 string `json:"iso3"`
99- // Featured bool `json:"featured"`
100- // URL string `json:"url"`
101- // DescriptionHTML string `json:"description-html"`
102- // Current bool `json:"current"`
103- // Location struct {
104- // Lat float64 `json:"lat"`
105- // Long float64 `json:"long"`
106- // } `json:"location"`
107- // } `json:"item"`
108- // } `json:"data"`
109- // }
110-
11187type RWResponse struct {
11288 Href string `json:"href"`
11389 Time int `json:"time"`
0 commit comments