Skip to content

Commit

Permalink
Minimal client
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Shirinkin committed Jun 17, 2015
1 parent 8721480 commit f7d9eef
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions groovehq.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_dependency "httparty"

spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
end
2 changes: 2 additions & 0 deletions lib/groovehq.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require 'httparty'
require "groovehq/version"
require "groovehq/client"

module GrooveHQ
# Your code goes here...
Expand Down
16 changes: 16 additions & 0 deletions lib/groovehq/client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module GrooveHQ
class Client

def initialize(access_token = nil)
@access_token = access_token || ENV["GROOVEHQ_ACCESS_TOKEN"]
end

def perform_request(path)
url = "https://api.groovehq.com/v1/#{path}"

response = HTTParty.get(url, headers: { 'Authorization' => "Bearer #{@access_token}" })

JSON.parse(response.body)
end
end
end

0 comments on commit f7d9eef

Please sign in to comment.