Sha256: e45290d348ab77f06bca264dc3451cbb6d4a9e00e49b5fcd40fa225c69107cd8

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true

require 'json'

class Mercadopago::Client
  module Preferences
    def create_preferences(preferences)
      response = send_preferences_request(preferences)
      @preferences_response = JSON.parse(response)
    rescue RestClient::Exception => e
      @errors << I18n.t(:authentication_error, scope: :mercadopago)
      raise e.message
    end

    private

    def send_preferences_request(preferences)
      RestClient.post(preferences_url(access_token), preferences.to_json,
                      content_type: 'application/json', accept: 'application/json')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_mercadopago-1.0.0 app/models/mercadopago/client/preferences.rb