This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
// Main server | |
mux.HandleFunc("/api/v1/plans/{id:[0-9]+}", handlers.GetPlan).Methods(http.MethodGet) // Esto funciona perfecto. | |
// Si ejecuto este endpoint en el navegador la lógica funciona de maravilla. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
token, err := request.ParseFromRequest(r, request.OAuth2Extractor, func(token *jwt.Token) (interface{}, error) { | |
return publicKey, nil | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
_strk.push('Page.didMount', function(){ | |
// INICIAN DATOS QUE SE PUEDEN MODIFICAR | |
// Esta es la variable que se debe modificar, será el vínculo que se abra. | |
var href = "https://google.com" | |
// Esta es la url en donde esta el archivo (img) a mostrar | |
var img = "https://gm1.ggpht.com/YC6AUoDV4bLEU1oGUFTlVbpTB_Mc_XzM6wvKDbBxLaPzqIpWcHDx5xMzZykTRaw5Sww3O3bcQo3Jb8yos5i0JilMD7r0o7U-cu-kGd3BTzVpDIind4vPufBm0b00LQ79ol30VH0o0fHwwPS_Jov6O1FCw-_JVc2R-dQRvfwD-SggNwRU9NG_RR2lm0qyY68zsNNioXpJbvOQE3hElq6OxKCkokfCpfC-kHdOo9_Pv74B5JTns6Yxg6Kbqakww9u4AvjAI7IDUfWhrNS7S1Dk5n9pNvPC_zga6fnj2FHJwPGCjMkHWz2uvwK74pI7GplrSLNHI4ZiF50o3LPjQ8UbaKod46BvtgovcYV6fcqiUksQ0baIDQU-Xu13ilC7GqOwe6pU4zZfv4f5Fv9YoKdisjceD18VlMURtsE2hRdjTtyBrvvMyNA136QS53HjA5lgNtGGXDJvu216mEQVgNQjWlQY5HoFACLSFOeMzHhOWE9id8rkuf9V4lhrBBwG43ioiQ2KlMnrx2cMUeOO6YOqxhCiPl8Vksf78tUPjvcg0GTQzPnRCpTkABTD3QnaTC_eH9rQOn4u5OzRxGEH-T-L87av8ievCjuznBeHZ6g2gXbgZ-5FHx5R_zwjBXD4dhGqVtDoVMwknStadoIytek-sv-Zd-maUkckxPxecibCDb0pTaA1YC16KdActl6k1CEPKSQ89QWjGMRUF2w=s0-l7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Antes | |
line_chart = [] | |
@project.areas.uniq.each do |area| | |
activity_area = [] | |
area.project_areas.where(project_id: @project.id).group("DATE_TRUNC('day', created_at)").sum(:progress).each do |key, values| | |
activity_area << { value: values, date: key} | |
end | |
line_chart << { name: area.name, series: activity_area } | |
end | |
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Plan struct { | |
[....] | |
Active bool `json:"active"` | |
CreatedAt time.Time `json:"created_at"` | |
UpdatedAt time.Time `json:"updated_at"` | |
} | |
db.Model(&plan).Where("id = ?", id).Updates(Plan{ | |
Name: name, | |
Period: period, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func CreatePlanStripe(planObj Plan) (*stripe.Plan, error){ | |
stripe.Key = "key" | |
params := &stripe.PlanParams{ | |
Amount: planObj.Amount, | |
// planObj.Period es de tipo string pero me da error, dice: | |
// cannot use planObj.Period (type string) as type stripe.PlanInterval in field value | |
// pero si yo le pongo directamente un string ("month") no da error. | |
Interval: planObj.Period, | |
// El mismo error que con Interval | |
Currency: planObj.Currency, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"totalHits":500,"hits":[{"largeImageURL":"https://pixabay.com/get/ea36b80d2ef1053ed1584d05fb1d4496e274e2dc10ac104497f6c37ea5efb7bb_1280.jpg","webformatHeight":426,"webformatWidth":640,"likes":34,"imageWidth":6000,"id":3392654,"user_id":509903,"views":1327,"comments":18,"pageURL":"https://pixabay.com/en/daisy-heart-romance-valentine-s-day-3392654/","imageHeight":4000,"webformatURL":"https://pixabay.com/get/ea36b80d2ef1053ed1584d05fb1d4496e274e2dc10ac104497f6c37ea5efb7bb_640.jpg","type":"photo","previewHeight":99,"tags":"daisy, heart, romance","downloads":663,"user":"congerdesign","favorites":16,"imageSize":5128325,"previewWidth":150,"userImageURL":"https://cdn.pixabay.com/user/2017/10/20/10-15-52-97_250x250.jpg","previewURL":"https://cdn.pixabay.com/photo/2018/05/12/08/21/daisy-3392654_150.jpg"},{"largeImageURL":"https://pixabay.com/get/ea36b80d28f3063ed1584d05fb1d4496e274e2dc10ac104497f6c37ea5efb7bb_1280.jpg","webformatHeight":360,"webformatWidth":640,"likes":40,"imageWidth":4368,"id":3392077,"user_id":76452 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
### CODE | |
begin | |
conektaTokenId = params[:conektaTokenId] | |
customer = Conekta::Customer.find(current_user.idConekta) | |
card = customer.create_card({:token => conektaTokenId}) | |
rescue Conekta::ParameterValidationError => e | |
puts "\n\n\n\n\n #{e.message_to_purchaser} \n\n\n\n\n" | |
raise | |
#alguno de los parámetros fueron inválidos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"object": "error", | |
"type": "parameter_validation_error", | |
"message": "The token does not exist.", | |
"message_to_purchaser": "El token no existe.", | |
"param": "token", | |
"code": "", | |
"validation_error": "nonexistent_token" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@product = Product.new(product_params) | |
if @product.save | |
redirect_to @product | |
else | |
render :edit | |
end | |
end | |
private |