Sha256: 5a26ce81ca25c45182858010177eb427e512fb9ee8f39b4c4d0106102db1c01f

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 Bytes

Contents

# encoding: utf-8
require 'active_support/core_ext'

module ViglinkApi
  module Request

    def get(path, options)
      request(:get, path, options)
    end

    def post(path, options)
      request(:post, path, options)
    end

    def request(method, path, options)
      response = connection.send(method) do |request|
      case method
        when :get
          request.url(path, options)
        when :put, :post
          request.path = path
          request.body = options.to_xml unless options.empty?
        end
      end

      response.body
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
viglink-api-0.1.1 lib/viglink_api/request.rb
viglink-api-0.1.0 lib/viglink_api/request.rb