Skip to content

Instantly share code, notes, and snippets.

View adiwids's full-sized avatar

Adi Widyawan adiwids

View GitHub Profile
{
"data": [
{
"id": "6daf7061-2cf0-4b7c-aba9-cde723697676",
"type": "daily_order_summary",
"attributes": {
"date": "2019-04-10T23:59:59.999+07:00",
"generated_at": "2019-04-11T01:00:00.000+07:00",
"orders_count": 31,
"sold_items_count": 957,
@adiwids
adiwids / json_response.md
Last active February 8, 2019 06:15
Contoh JSON response RESTFull API

Simple

GET https://ludweb.herokuapp.com/api/v1/relationships.json

{
    "relationships": [
        {
            "name": "engaged_with",
            "display_name": "Engaged with"
{
"data": {
"id": "R20181100000031",
"type": "order",
"attributes": {
"is_dropship": false,
"number": "R20181100000031",
"date": "2018-11-28T00:00:00.000Z",
"state": "on_cart",
"items_count": 2,
configure_option "--with-mysql" "mysqlnd"
# Laravel 5.4 requirement start here
configure_option "--with-mcrypt" "/usr"
configure_option "--with-iconv" "/usr/local" # manual configure of libiconv with prefix /usr/local & reinstall gettext lib
configure_option "--with-pdo-pgsql" "/usr"
configure_option "--with-pgsql" "/usr/lib/postgresql/9.5" # adjust version of your installed PosgreSQL via (aptitude)
configure_option "--with-sybase" "/usr/local" # using freetds lib with /usr/local as prefix, linked as lib64
configure_option "--with-sybase-ct" "/usr/local" # using freetds lib with /usr/local as prefix, linked as lib64
# Laravel 5.4 requirement end here
# Find user that has registered device (reg token registered) on server
user = User.find_by(email: '<email>')
# Find last notification object received by that user
notif = PushNotification.where(recipient_id: u.id).last
# Assign notificatable object (might be object of Post, Comment, etc) from 'notif'
obj = notif.notificatable
# Destroy last notification log, assigned as 'notif' since server won't send any duplicate notification object
notif.destroy
# Re-send notification
PushNotification.broadcast_notifications_for(obj, [user])
```
TimelineSetting Load (0.2ms) SELECT `timeline_settings`.`id`, `timeline_settings`.`date_field`, `timeline_settings`.`hover` FROM `timeline_settings` WHERE `timeline_settings`.`organization_id` = 1 AND `timeline_settings`.`entity_type` = 'LeadContact' AND `timeline_settings`.`object` = 'Task' ORDER BY `timeline_settings`.`position` ASC
TimelineFilter Load (10.8ms) SELECT `timeline_filters`.* FROM `timeline_filters` WHERE `timeline_filters`.`timeline_setting_id` = 39211 ORDER BY `timeline_filters`.`position` ASC
TimelineFilter Load (10.7ms) SELECT `timeline_filters`.* FROM `timeline_filters` WHERE `timeline_filters`.`timeline_setting_id` = 39201 ORDER BY `timeline_filters`.`position` ASC
TimelineFilter Load (0.2ms) SELECT `timeline_filters`.* FROM `timeline_filters` WHERE `timeline_filters`.`timeline_setting_id` = 11571 ORDER BY `timeline_filters`.`position` ASC
TimelineFilter Load (0.2ms) SELECT `timeline_filters`.* FROM `timeline_filters` WHERE `timeline_filters`.`timeline_setting_id` = 3
Updating __only__ Call Dispostion option on Conversation Outcome form.
From local Rails server's log:
```
D, [2018-08-02T17:21:53.297271 #23825] DEBUG -- : SQL (0.4ms) INSERT INTO `sent_general_call_prompts` (`salesforce_entity_id`, `general_prompt_id`, `created_at`, `updated_at`) VALUES ('0037000000a6o7S', 1, '2018-08-02 10:21:53', '2018-08-02 10:21:53')
D, [2018-08-02T17:21:53.302215 #23825] DEBUG -- : (3.7ms) COMMIT
D, [2018-08-02T17:21:53.305102 #23825] DEBUG -- : UserSetting Load (1.4ms) SELECT `user_settings`.* FROM `user_settings` WHERE `user_settings`.`user_id` = 1 AND `user_settings`.`name` = 'show_task_options' LIMIT 1
D, [2018-08-02T17:21:53.307590 #23825] DEBUG -- : (0.4ms) BEGIN
D, [2018-08-02T17:21:53.308944 #23825] DEBUG -- : (0.2ms) COMMIT
I, [2018-08-02T17:21:54.576765 #23825] INFO -- : Enqueued UserActionJob (Job ID: 8e150f8a-a08c-4e14-80df-6a3742801fdd) to Sidekiq(default) with arguments: {:user_id=>1, :organization_id=>1, :event=>"API[Create]", :duration=>1}
require "#{File.dirname(__FILE__)}/../../vendor/plugins/moonshine/lib/moonshine.rb"
class ApplicationManifest < Moonshine::Manifest::Rails
# The majority of your configuration should be in <tt>config/moonshine.yml</tt>
# If necessary, you may provide extra configuration directly in this class
# using the configure method. The hash passed to the configure method is deep
# merged with what is in <tt>config/moonshine.yml</tt>. This could be used,
# for example, to store passwords and/or private keys outside of your SCM, or
# to query a web service for configuration data.
#
# In the example below, the value configuration[:custom][:random] can be used in
{
"challenges": [
"cvv"
],
"environment": "production",
"clientApiUrl": "https://api.braintreegateway.com:443/merchants/kqzsv2v4y7nz44xm/client_api",
"assetsUrl": "https://assets.braintreegateway.com",
"authUrl": "https://auth.venmo.com",
"analytics": {
"url": "https://client-analytics.braintreegateway.com/kqzsv2v4y7nz44xm"
//braintree configuration fetched
{
"challenges": [
"cvv",
"postal_code"
],
"environment": "sandbox",
"clientApiUrl": "https://api.sandbox.braintreegateway.com:443/merchants/k8x49qgdv2b7tx24/client_api",
"assetsUrl": "https://assets.braintreegateway.com",