Sha256: 32f31e2294006e9bf27af6f34cc06bbc7d2690903939c1280bf358814e5f6ae6
Contents?: true
Size: 629 Bytes
Versions: 24
Compression:
Stored size: 629 Bytes
Contents
require 'rest-client' class DiscoApp::ApiClient SUBSCRIPTION_ENDPOINT = 'app_subscriptions.json' def initialize(shop, url) @shop = shop @url = url end def create_app_subscription return unless @url.present? url = @url + SUBSCRIPTION_ENDPOINT begin response = RestClient::Request.execute( method: :post, headers: { content_type: :json }, url: url, payload: { shop: @shop, subscription: @shop.current_subscription }.to_json ) rescue RestClient::BadRequest, RestClient::ResourceNotFound => e raise DiscoApiError.new(e.message) end end end
Version data entries
24 entries across 24 versions & 1 rubygems