Sha256: 8f05cfefd99da99ded56c59a21d550764d992e9fe3fb76d3f6b7c226fc423b13

Contents?: true

Size: 902 Bytes

Versions: 2

Compression:

Stored size: 902 Bytes

Contents

module Brickwall
  module API
    class Subscription

      def self.create(params = {})
        response = RestClient.post API.url('subscription'), params, {
          'X-ApiKey' => Brickwall.configuration.brick_private_key
        }
        JSON.parse response
      rescue RestClient::Exception => e
        err = JSON.parse e.response
        Error.new err['type'], err['error'], err['code']
      end

      def self.get(subscription_id)
        response = RestClient.get API.url("subscription/#{subscription_id}"), {
          'X-ApiKey' => Brickwall.configuration.brick_private_key
        }
        JSON.parse response
      end

      def self.cancel(subscription_id)
        response = RestClient.post API.url("subscription/#{subscription_id}/cancel"), {}, {
          'X-ApiKey' => Brickwall.configuration.brick_private_key
        }
        JSON.parse response
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brickwall-0.2.0 lib/brickwall/api/subscription.rb
brickwall-0.1.0 lib/brickwall/api/subscription.rb