class LimeLightPlatform
@author Lime Light CRM Engineers
Constants
- URL_TEMPLATE
Attributes
Public Class Methods
@param app_key
[String] The CRM app key @param api_username
[String] The CRM app key @param api_password
[String] The CRM app key @param dev_subdirectory
[String] Subdirectory for developer environments @param debug [Boolean] Increases the log level of API requests and responses
AppBase::new
# File lib/lime_light_platform.rb, line 23 def initialize app_key, api_username, api_password, dev_subdirectory='', debug=false super debug if app_key.blank? raise ApiError.new 'App Key is required' end if api_username.blank? raise ApiError.new 'API username is required' end if api_password.blank? raise ApiError.new 'API password is required' end @app_key = app_key @api_username = api_username @api_password = api_password @dev_subdirectory = dev_subdirectory if !@dev_subdirectory.blank? @dev_subdirectory = @dev_subdirectory + '/' end end
Public Instance Methods
Retrieve billing model data for a specified billing model ID @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 83 def billing_model_view request={} common_optional_param_perform_post base_call_params(__method__), ['offer_id', 'billing_model_id'], request end
Return all active campaigns ina CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 89 def campaign_find_active response = default_response api_response = perform_api_call base_call_params(__method__) response[:raw] = api_response if !api_response.blank? parsed = JSON.parse(api_response) response_code = get_response_code(parsed).to_i response[:code] = response_code campaigns = [] if response_code == 100 && key_exists('campaigns', parsed) response[:success] = true parsed['campaigns'].each do |key, payload| campaigns << { 'id' => payload['campaign_id'], 'name' => payload['campaign_name'] } end end response[:data] = campaigns end response end
Retrieve payment router data for a specified campaign ID @param campaign_id [Integer] Campaign ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 126 def campaign_payment_router_view campaign_id campaign_view_response = campaign_view campaign_id combined_response = { success: false, data: { has_payment_router: 0, campaign_view_response: {}, payment_router_view_response: {} }, } combined_response[:data][:campaign_view_response] = campaign_view_response if campaign_view_response[:success] payment_router_id = campaign_view_response[:data]['payment_router_id'] if !payment_router_id.blank? combined_response[:data][:has_payment_router] = 1 payment_router_view_response = payment_router_view [payment_router_id] if payment_router_view_response[:success] combined_response[:success] = true combined_response[:data][:payment_router_view_response] = payment_router_view_response end end end combined_response end
Retrieve campaign data for a specified campaign ID @param campaign_id [Integer] Campaign ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 119 def campaign_view campaign_id common_entity_view_perform_post base_call_params(__method__), 'campaign_id', campaign_id end
Validate a coupon based on promo code and other coupon parameters @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 159 def coupon_validate request={} call_params = base_call_params __method__ call_params[:body] = { 'campaign_id' => get_if_exists('campaign_id', request, 0), 'shipping_id' => get_if_exists('shipping_id', request, 0), 'email' => get_if_exists('email', request), 'promo_code' => get_if_exists('promo_code', request), 'products' => get_if_exists('products', request) } common_perform_post call_params end
Retrieve customer data for a specified customer ID @param customer_id [Integer] Customer ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 174 def customer_view customer_id common_entity_view_perform_post base_call_params(__method__), 'customer_id', customer_id end
Retrieve gateway data for a specified gateway ID @param gateway_id [Integer] Gateway ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 181 def gateway_view gateway_id common_entity_view_perform_post base_call_params(__method__), 'gateway_id', gateway_id end
Retrieve alternative provider parameters (paypal, icepay) @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 188 def get_alternative_provider request={} call_params = base_call_params __method__ call_params[:body] = { 'campaign_id' => get_if_exists('campaign_id', request, 0), 'alt_pay_type' => get_if_exists('alt_pay_type', request), 'return_url' => get_if_exists('return_url', request), 'cancel_url' => get_if_exists('cancel_url', request), 'amount' => get_if_exists('amount', request), 'shipping_id' => get_if_exists('shipping_id', request), 'bill_country' => get_if_exists('bill_country', request), # icepay only 'products' => get_if_exists('products', request) } common_perform_post call_params end
Create and process a new order @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 206 def new_order request={} common_new_order_request __method__, request end
Create and process a new order based upon an existing order @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 213 def new_order_card_on_file request={} common_new_order_request __method__, request end
Create and process a new order based upon an existing prospect record @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 220 def new_order_with_prospect request={} common_new_order_request __method__, request end
Create a prospect record @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 227 def new_prospect request={} call_params = base_call_params(camel_case_name(__method__)) body = { 'campaignId' => get_if_exists('campaign_id', request), 'email' => get_if_exists('email', request), 'ipAddress' => get_if_exists('ip_address', request) } optional_params = { 'first_name' => 'firstName', 'last_name' => 'lastName', 'address_1' => 'address1', 'address_2' => 'address2', 'city' => 'city', 'state' => 'state', 'zip' => 'zip', 'country' => 'country', 'phone' => 'phone', 'afid' => 'AFID', 'sid' => 'SID', 'affid' => 'AFFID', 'c1' => 'C1', 'c2' => 'C2', 'c3' => 'C3', 'aid' => 'AID', 'opt' => 'OPT', 'click_id' => 'click_id', 'notes' => 'notes', } body = map_param_if_exist optional_params, request, body call_params[:body] = body common_perform_post call_params end
Retrieve offer data according to offer ID and/or campaign ID @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 263 def offer_view request={} common_optional_param_perform_post base_call_params(__method__), ['offer_id', 'campaign_id'], request end
Search for one or more order records according to criteria @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 270 def order_find request={} call_params = base_call_params __method__ date_times = default_date_times call_params[:body] = { 'campaign_id' => get_if_exists('campaign_id', request, 'all'), 'start_date' => get_if_exists('start_date', request, date_times[:today]), 'end_date' => get_if_exists('end_date', request, date_times[:today]), 'start_time' => get_if_exists('start_time', request, date_times[:start_time]), 'end_time' => get_if_exists('end_time', request, date_times[:end_time]), 'search_type' => get_if_exists('search_type', request, 'any'), # could be all 'return_type' => 'order_view' # always order_view } if key_exists('product_ids', request) call_params[:body]['product_ids'] = request['product_ids'] end if key_exists('member_token', request) call_params[:body]['member_token'] = request['member_token'] end if key_exists('criteria', request) call_params[:body]['criteria'] = request['criteria'] end common_perform_post call_params end
Search for one or more order records according to criteria
Criteria is based on several updated statuses
@param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 302 def order_find_updated request={} call_params = base_call_params __method__ date_times = default_date_times call_params[:body] = { 'campaign_id' => get_if_exists('campaign_id', request), 'start_date' => get_if_exists('start_date', request, date_times[:today]), 'end_date' => get_if_exists('end_date', request, date_times[:today]), 'start_time' => get_if_exists('start_time', request, date_times[:start_time]), 'end_time' => get_if_exists('end_time', request, date_times[:end_time]), 'group_keys' => get_if_exists('group_keys', request) } common_perform_post call_params end
Force rebill an exist order @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 319 def order_force_bill request={} call_params = base_call_params __method__ call_params[:body] = { 'order_id' => get_if_exists('order_id', request) } if key_exists('force_gateway_id', request) call_params[:body]['forceGatewayId'] = request['force_gateway_id'] end if key_exists('preserve_force_gateway', request) call_params[:body]['preserve_force_gateway'] = request['preserve_force_gateway'] end common_perform_post call_params end
Reprocess a declined order @param order_id [Integer] The order ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 339 def order_reprocess order_id call_params = base_call_params __method__ call_params[:body] = { 'order_id' => order_id } common_perform_post call_params end
Updates an order record according to various criteria @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 360 def order_update request={} call_params = base_call_params __method__ call_params[:body] = { 'sync_all' => get_if_exists('sync_all', request, 0) } update_options = [ 'confirmation_status', 'blacklist', 'fraud', 'chargeback', 'notes', 'first_name', 'last_name', 'email', 'phone', 'shipping_method', 'shipping_address1', 'shipping_address2', 'shipping_city', 'shipping_zip', 'shipping_state', 'shipping_country', 'billing_address1', 'billing_address2', 'billing_city', 'billing_zip', 'billing_state', 'billing_country', 'rebill_discount', 'next_rebill_product', 'cc_number', 'check_routing', 'check_account', 'check_ssn', 'cc_expiration_date', 'cc_payment_type', 'recurring_date', 'stop_recurring_next_success', 'rma', 'return', 'tracking_number', 'payment_received', 'subscription_override', 'afid', 'affid', 'aid', 'sid', 'c1', 'c2', 'c3', 'opt' ] common_update_perform_post call_params, request, 'order_id', update_options end
Update the recurring properties of an order on an active subscription @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 348 def order_update_recurring request={} call_params = base_call_params __method__ call_params[:body] = { 'order_id' => get_if_exists('order_id', request, 0), 'status' => get_if_exists('status', request) } common_perform_post call_params end
Retrieve order data based upon one or more order IDs @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 416 def order_view request={} call_params = base_call_params __method__ call_params[:body] = { 'order_id' => get_if_exists('order_id', request, []) } common_perform_post call_params end
Retrieve payment router data based upon one or more payment router IDs @param payment_router_id [Array] Payment router IDs @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 425 def payment_router_view payment_router_id=[] common_entity_view_perform_post base_call_params(__method__), 'payment_router_id', payment_router_id end
Retrieve the product variant attributes @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 432 def product_attribute_index request={} call_params = base_call_params __method__ call_params[:body] = { 'product_id' => get_if_exists('product_id', request, []) } common_perform_post call_params end
Return all product bundles in a CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 440 def product_bundle_index common_perform_post base_call_params(__method__) end
Retrieve product bundle data for a specified product ID
This product must be a bundle
@param product_id [Integer] Product ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 448 def product_bundle_view product_id common_entity_view_perform_post base_call_params(__method__), 'product_id', product_id end
Copy a product record @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 455 def product_copy request={} call_params = base_call_params __method__ call_params[:body] = { 'product_id' => get_if_exists('product_id', request, 0) } if key_exists('new_name', request) call_params[:body]['new_name'] = request['new_name'] end common_perform_post call_params end
Create a product record @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 469 def product_create request={} call_params = base_call_params __method__ call_params[:body] = { 'customer_purchase_limit' => get_if_exists('customer_purchase_limit', request, 0), 'taxable' => get_if_exists('taxable', request, 0), 'shippable' => get_if_exists('shippable', request, 0), 'signature_confirmation' => get_if_exists('signature_confirmation', request, 0), 'delivery_confirmation' => get_if_exists('delivery_confirmation', request, 0), 'preserve_quantity' => get_if_exists('preserve_quantity', request, 0), 'collections' => get_if_exists('collections', request, 0), 'shipping_declared_value' => get_if_exists('shipping_declared_value', request, 0), 'product_price' => get_if_exists('product_price', request, 0), 'product_restocking_fee' => get_if_exists('product_restocking_fee', request, 0), 'shipping_weight' => get_if_exists('shipping_weight', request, 0), 'product_sku' => get_if_exists('product_sku', request), 'shipping_digital_url' => get_if_exists('shipping_digital_url', request), 'recurring_discount_max' => get_if_exists('recurring_discount_max', request, 0), 'product_name' => get_if_exists('product_name', request), 'product_description' => get_if_exists('product_description', request), 'category_id' => get_if_exists('category_id', request, 0), 'vertical_id' => get_if_exists('vertical_id', request, 0), 'cost_of_goods_sold' => get_if_exists('cost_of_goods_sold', request, 0), 'product_max_quantity' => get_if_exists('product_max_quantity', request, 1) } common_perform_post call_params end
Delete a product record @param product_id [Integer] Product ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 499 def product_delete product_id common_entity_view_perform_post base_call_params(__method__), 'product_id', product_id end
Update a product record @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 506 def product_update request={} call_params = base_call_params __method__ update_options = [ 'customer_purchase_limit', 'taxable', 'shippable', 'signature_confirmation', 'delivery_confirmation', 'preserve_quantity', 'collections', 'shipping_declared_value', 'product_price', 'product_restocking_fee', 'shipping_weight', 'product_sku', 'shipping_digital_url', 'recurring_discount_max', 'product_name', 'product_description', 'category_id', 'vertical_id', 'cost_of_goods_sold', 'product_max_quantity' ] common_update_perform_post call_params, request, 'product_id', update_options end
Search for a prospect record according to one or more criteria @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 536 def prospect_find request={} call_params = base_call_params __method__ date_times = default_date_times call_params[:body] = { 'campaign_id' => get_if_exists('campaign_id', request, 'all'), 'start_date' => get_if_exists('start_date', request, date_times[:today]), 'end_date' => get_if_exists('end_date', request, date_times[:today]), 'start_time' => get_if_exists('start_time', request, date_times[:start_time]), 'end_time' => get_if_exists('end_time', request, date_times[:end_time]), 'search_type' => get_if_exists('search_type', request, 'any'), # could be all } if key_exists('criteria', request) call_params[:body]['criteria'] = request['criteria'] end common_perform_post call_params end
Update a prospect record @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 558 def prospect_update request={} call_params = base_call_params __method__ update_options = [ 'first_name', 'last_name', 'address', 'address2', 'city', 'state', 'zip', 'country', 'phone', 'email', 'notes' ] common_update_perform_post call_params, request, 'prospect_id', update_options end
Retrieve prospect data for a specified prospect ID @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 579 def prospect_view request={} call_params = base_call_params __method__ call_params[:body] = { 'prospect_id' => get_if_exists('prospect_id', request, []) } common_perform_post call_params end
Attempt to send an order to fulfillment @param order_id [Integer] The order ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 590 def repost_to_fulfillment order_id common_entity_view_perform_post base_call_params(__method__), 'order_id', order_id end
Retrieve shipping method data based upon criteria @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 597 def shipping_method_find request={} call_params = base_call_params __method__ call_params[:body] = { 'campaign_id' => get_if_exists('campaign_id', request, 'all'), 'search_type' => get_if_exists('search_type', request, 'any') # could be all } # criteria options: code, name, group if key_exists('criteria', request) call_params[:body]['criteria'] = request['criteria'] end common_perform_post call_params end
Retrieve shipping method data for a specified shipping ID @param shipping_id [Integer] The shipping method ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 615 def shipping_method_view shipping_id common_entity_view_perform_post base_call_params(__method__), 'shipping_id', shipping_id end
Skips the next billing cycle on a recurring subscription by updating the recurring date
according to billing model configurations
@param subscription_id [String] Subscription ID on the order @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 623 def skip_next_billing subscription_id common_entity_view_perform_post base_call_params(__method__), 'subscription_id', subscription_id end
Update one or more dynamic properties on a recurring subscription @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 630 def subscription_order_update request={} call_params = base_call_params __method__ call_params[:body]['order_id'] = get_if_exists 'order_id', request optional_params = [ 'additional_product_id', 'quantity', 'product_id', 'new_recurring_product_id', 'children', 'new_recurring_price', 'new_recurring_date', 'billing_model_id' ] common_optional_param_perform_post call_params, optional_params, request end
Stop, start, or reset a subscription @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 649 def subscription_update request={} call_params = base_call_params __method__ call_params[:body] = { 'subscription_id' => get_if_exists('subscription_id', request, {}) } common_perform_post call_params end
Provide data necessary to redirect the customer
to their personal bank URL for 3D Secure payments
@param order_id [Integer] The order ID from CRM instance @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 659 def three_d_redirect order_id common_entity_view_perform_post base_call_params(__method__), 'order_id', order_id end
Stops the recurring status of an upsell product on a subscriptions @param request [Hash] Request payload hash @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 666 def upsell_stop_recurring request={} call_params = base_call_params __method__ call_params[:body] = { 'order_id' => get_if_exists('order_id', request), 'product_id' => get_if_exists('product_id', request) } common_perform_post call_params end
Validates the API user username and password @return [Hash] Common response object
# File lib/lime_light_platform.rb, line 677 def validate_credentials common_perform_post(base_call_params(__method__)) end
Private Instance Methods
# File lib/lime_light_platform.rb, line 687 def base_call_params method { url: crm_url(method.to_s), proto: POST, format: BODY_F_JSON, headers: [ { name: 'Authorization', value: 'Basic ' + Base64.strict_encode64("#{@api_username}:#{@api_password}") }, { name: 'Content-Type', value: 'application/json' } ], body: {} } end
# File lib/lime_light_platform.rb, line 788 def camel_case_name name method_name = name.to_s method_name.camelize end
# File lib/lime_light_platform.rb, line 704 def common_entity_view_perform_post call_params, record_key, record_id call_params[:body][record_key] = record_id common_perform_post call_params end
# File lib/lime_light_platform.rb, line 793 def common_new_order_parameters request={} new_order_params = { # Needed for NewOrder customer_shipping_data: { 'first_name' => 'firstName', 'last_name' => 'lastName', 'shipping_address_1' => 'shippingAddress1', 'shipping_address_2' => 'shippingAddress2', 'shipping_city' => 'shippingCity', 'shipping_state' => 'shippingState', 'shipping_zip' => 'shippingZip', 'shipping_country' => 'shippingCountry', }, # Needed for NewOrder, NewOrderWithProspect customer_billing_data: { 'billing_first_name' => 'billingFirstName', 'billing_last_name' => 'billingLastName', 'billing_address_1' => 'billingAddress1', 'billing_address_2' => 'billingAddress2', 'billing_city' => 'billingCity', 'billing_state' => 'billingState', 'billing_zip' => 'billingZip', 'billing_country' => 'billingCountry', }, # Needed for NewOrder, NewOrderWithProspect customer_payment_data: { 'credit_card_type' => 'creditCardType', 'credit_card_number' => 'creditCardNumber', 'expiration_date' => 'expirationDate', 'cvv' => 'CVV', 'check_account_number' => 'checkAccountNumber', 'check_routing_number' => 'checkRoutingNumber', 'sepa_iban' => 'sepa_iban', 'sepa_bic' => 'sepa_bic', 'eurodebit_acct_num' => 'eurodebit_acct_num', 'eurodebit_route_num' => 'eurodebit_route_num' }, customer_critical_data: { 'tran_type' => 'tranType', 'phone' => 'phone', 'email' => 'email', 'shipping_id' => 'shippingId', 'ip_address' => 'ipAddress', 'campaign_id' => 'campaignId', 'products' => 'products', }, optional_params: { 'prospect_id' => 'prospectId', 'previous_order_id' => 'previousOrderId', 'force_gateway_id' => 'forceGatewayId', 'preserve_force_gateway' => 'preserve_force_gateway', 'created_by' => 'createdBy', 'thm_session_id' => 'thm_session_id', 'total_installments' => 'total_installments', 'alt_pay_token' => 'alt_pay_token', 'alt_pay_payer_id' => 'alt_pay_payer_id', 'secret_ssn' => 'secretSSN', 'master_order_id' => 'master_order_id', 'promo_code' => 'promoCode', 'temp_customer_id' => 'temp_customer_id', 'three_d_redirect_url' => 'three_d_redirect_url', 'alt_pay_return_url' => 'alt_pay_return_url', 'session_id' => 'sessionId', 'cascade_override' => 'cascade_override', 'create_member' => 'create_member', 'event_id' => 'event_id', 'ssn_nmi' => 'ssn_nmi', 'device_category' => 'device_category', 'notes' => 'notes', 'utm_source' => 'utm_source', 'utm_medium' => 'utm_medium', 'utm_campaign' => 'utm_campaign', 'utm_content' => 'utm_content', 'utm_term' => 'utm_term', 'afid' => 'AFID', 'sid' => 'SID', 'affid' => 'AFFID', 'c1' => 'C1', 'c2' => 'C2', 'c3' => 'C3', 'aid' => 'AID', 'opt' => 'OPT', 'click_id' => 'click_id', 'initialize_new_subscription' => 'initializeNewSubscription' } } body = map_param_if_exist new_order_params[:customer_shipping_data], request body = map_param_if_exist new_order_params[:customer_billing_data], request, body body = map_param_if_exist new_order_params[:customer_payment_data], request, body body = map_param_if_exist new_order_params[:customer_critical_data], request, body map_param_if_exist new_order_params[:optional_params], request, body end
# File lib/lime_light_platform.rb, line 886 def common_new_order_request method_name, request call_params = base_call_params(camel_case_name(method_name)) call_params[:body] = common_new_order_parameters request common_perform_post call_params end
# File lib/lime_light_platform.rb, line 774 def common_optional_param_perform_post call_params, optional_params, request optional_params.each do |option| if key_exists(option, request) call_params[:body][option] = request[option] end end common_perform_post call_params end
# File lib/lime_light_platform.rb, line 709 def common_perform_post call_params response = default_response api_response = perform_api_call call_params response[:raw] = api_response if !api_response.nil? parsed = JSON.parse(api_response) response_code = get_response_code parsed if !response_code.blank? response_code = response_code.to_i response[:code] = response_code if response_code == 100 response[:success] = true response[:data] = parsed end end end response end
# File lib/lime_light_platform.rb, line 732 def common_update_perform_post call_params, request, record_key, update_options=[] response = default_response # only update what is present if key_exists(record_key, request) call_params[:body][record_key] = {} request[record_key].each {|id, payload| str_id = id.to_s call_params[:body][record_key][str_id] = {} update_options.each do |option| if key_exists(option, payload) call_params[:body][record_key][str_id][option] = payload[option] end end } if !call_params[:body][record_key].empty? api_response = perform_api_call call_params response[:raw] = api_response if !api_response.nil? parsed = JSON.parse(api_response) response_code = get_response_code(parsed) if !response_code.blank? response_code = response_code.to_i response[:code] = response_code if response_code == 100 response[:success] = true response[:data] = parsed end end end end end response end
# File lib/lime_light_platform.rb, line 683 def crm_url method='' URL_TEMPLATE.gsub('<APP_KEY>', @app_key).gsub('<DEV_SUB>', @dev_subdirectory).gsub('<METHOD>', method) end
# File lib/lime_light_platform.rb, line 784 def default_date_times { today: Time.now.strftime('%m/%d/%Y'), start_time: '00:00:00', end_time: '23:59:59' } end
# File lib/lime_light_platform.rb, line 700 def default_response { success: false, code: nil, data: [], raw: '' } end