Sha256: 952d30da90b68cf4f8860e77e08dc719c06b4654b69fa8e6806032c324471d71
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'fortnox/api/class_methods' require 'fortnox/api/environment_validation' require 'fortnox/api/request_handling' require 'httparty' module Fortnox module API class Base include HTTParty extend Fortnox::API::ClassMethods include Fortnox::API::EnvironmentValidation include Fortnox::API::RequestHandling HTTParty::Parser::SupportedFormats[ "text/html" ] = :json DEFAULT_HEADERS = { 'Content-Type' => 'application/json', 'Accept' => 'application/json', } HTTP_METHODS = [ :get, :put, :post, :delete ] attr_accessor :headers def initialize self.class.base_uri( get_base_url ) self.headers = DEFAULT_HEADERS.merge({ 'Client-Secret' => get_client_secret, 'Access-Token' => get_access_token, }) end HTTP_METHODS.each do |method| define_method method do |*args| execute do |remote| remote.send( method, *args ) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fortnox-api-0.1.0 | lib/fortnox/api/base.rb |