-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qf kz_att_http & kz_att_ftp #3010
Conversation
Fix default_format/0 in kz_att_http & kz_att_ftp Fix parsing field_list from storage_plan in kz_att_http & kz_att_ftp
@@ -139,11 +139,15 @@ format_url(Fields, JObj, Args, Separator) -> | |||
format_url_field(JObj, Args, Fields, Acc) | |||
when is_list(Fields) -> | |||
[format_url(Fields, JObj, Args, <<>>) | Acc]; | |||
format_url_field(JObj, Args, #{<<"arg">> := Arg}, Fields) -> | |||
format_url_field(JObj, Args, {arg, Arg}, Fields); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skorobkov when is Fields
a map item ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/2600hz/kazoo/blob/master/core/kazoo_attachments/src/kz_att_http.erl#L29
Fields = maps:get('field_list', Params, default_format()),
Params is map, so this JSON in data plan will be converted to map and field_list
will be parsed in format_url_field/4
"attachments": {
"modb-att-http": {
"handler": "http",
"settings": {
"url": "http://ip:80",
"verb": "put",
"field_list": [
{
"field": "pvt_account_id"
},
{
"field": "owner_id"
},
{
"arg": "id"
},
{
"arg": "attachment"
}
]
}
}
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, good point. kz_att_http
and kz_att_ftp
were coded to provide backward compatibility for existing deployments for usage in kz_media_record
. using them as "real" att handlers in the data plans
is cool :)
thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was planning to move call records files from CouchDB into plain files. Sometimes client wants to download their records not via API. So when I found this module, I thought it was made for this. о_О
@@ -155,6 +159,6 @@ format_url_field(_JObj, _Args, Field, Fields) -> | |||
default_format() -> | |||
[{field, <<"pvt_account_id">>} | |||
,{field, <<"owner_id">>} | |||
,{args, <<"id">>} | |||
,{arg, <<"id">>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch :)
@skorobkov awesome! thanks. |
Fix default_format/0 in kz_att_http & kz_att_ftp Fix parsing field_list from storage_plan in kz_att_http & kz_att_ftp
Fix
kz_att_http:fetch_attachment/1
Fix
default_format/0
in kz_att_http & kz_att_ftpFix parsing
field_list
from storage_plan in kz_att_http & kz_att_ftp