talentlms 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac0dec21de1848e106494349efde89e7a0987f32
4
- data.tar.gz: 3170a23e6d4f092f36ff8a571b705dbc11de8c8c
3
+ metadata.gz: 8e7382d7696dd177403fb5baae0e0616dce60b86
4
+ data.tar.gz: 2a183732ab174a48b4389e9142c2f89072c63785
5
5
  SHA512:
6
- metadata.gz: ca1f462b79ebb2456518e8d502b53d0a51c29b0fc1266d63d5a2c3646dcf9dc0d2dbd3e9197c4bf5b33c8fa03abbe4fbad24357f06d3e2779dca8ee326f9c1f1
7
- data.tar.gz: 37ddedea22e72c351cfe3334eb453996c82645068bca673d30743005f9944bdf22420e5d414b193abd9dbe942df29943fe2ba923d7cb17f07f3d0a7bda327884
6
+ metadata.gz: 8348f14f0370ea7bdace178d85c1b019a6c17b44231550156af73fb1e4f4959a712fac350e9478a18d72772391086f23b5b09cdd61ed7cb4070fbd7dcd44350c
7
+ data.tar.gz: 776c9f0bc04a9b9ce1d6813dfc8695fe39649c1394b365d4beec28a3696b469fa684f4ce2167353072b36e03d64eeda1219400583a9e0e4f4632f900b9766a6e
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ before_install: gem install bundler
data/lib/talentlms.rb CHANGED
@@ -1,2 +1,14 @@
1
1
  require "talentlms/version"
2
2
  require "talentlms/client"
3
+
4
+ module TalentLMS
5
+ extend self
6
+
7
+ def init(options={})
8
+ @@client = TalentLMS::Client.new(options)
9
+ end
10
+
11
+ def method_missing(method, *args, &block)
12
+ @@client.send(method, *args, &block)
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Talentlms
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,40 @@
1
+ require 'test_helper'
2
+
3
+ describe 'API' do
4
+ before do
5
+ TalentLMS.init({
6
+ :api_key => '03a82de6de2d939564aa607b0e24a030b5047c54ed87c77fea',
7
+ :sub_domain => 'example'
8
+ })
9
+ @headers = {
10
+ 'Authorization' => 'Basic MDNhODJkZTZkZTJkOTM5NTY0YWE2MDdiMGUyNGEwMzBiNTA0N2M1NGVkODdjNzdmZWE6',
11
+ 'Host' => 'example.talentlms.com',
12
+ 'User-Agent' => 'RubyHTTPGem/0.5.0'
13
+ }
14
+ end
15
+
16
+ it 'GET users' do
17
+ stub_request(:get, "https://example.talentlms.com/api/v1/users")
18
+ .with(:headers => @headers)
19
+ .to_return(:status => 200, :body => "[{\"id\": 1}, {\"id\": 2}]", :headers => {})
20
+
21
+ expected = [{"id" => 1}, {"id" => 2}]
22
+ assert_equal expected, TalentLMS.users
23
+ end
24
+
25
+ it 'GET user' do
26
+ stub_request(:get, "https://example.talentlms.com/api/v1/users/id:1")
27
+ .with(:headers => @headers)
28
+ .to_return(:status => 200, :body => "{\"id\": 1}", :headers => {})
29
+ expected = {"id" => 1}
30
+ assert_equal expected, TalentLMS.users(:id => 1)
31
+ end
32
+
33
+ it 'GET course' do
34
+ stub_request(:get, "https://example.talentlms.com/api/v1/courses/id:5")
35
+ .with(:headers => @headers)
36
+ .to_return(:status => 200, :body => "{\"id\": 5}", :headers => {})
37
+ expected = {"id" => 5}
38
+ assert_equal expected, TalentLMS.courses(:id => 5)
39
+ end
40
+ end
@@ -7,16 +7,11 @@ describe 'Client' do
7
7
  :api_key => @key,
8
8
  :sub_domain => 'example'
9
9
  })
10
- @headers = {
11
- 'Authorization' => 'Basic MDNhODJkZTZkZTJkOTM5NTY0YWE2MDdiMGUyNGEwMzBiNTA0N2M1NGVkODdjNzdmZWE6',
12
- 'Host' => 'example.talentlms.com',
13
- 'User-Agent' => 'RubyHTTPGem/0.5.0'
14
- }
15
10
  end
16
11
 
17
12
  describe '#auth_header' do
18
13
  it 'adds auth header without white space' do
19
- expected = @headers["Authorization"]
14
+ expected = 'Basic MDNhODJkZTZkZTJkOTM5NTY0YWE2MDdiMGUyNGEwMzBiNTA0N2M1NGVkODdjNzdmZWE6'
20
15
  assert_equal expected, @client.auth_header(@key)["Authorization"]
21
16
  end
22
17
  end
@@ -37,15 +32,4 @@ describe 'Client' do
37
32
  assert_equal expected, @client.route_for_method('usersetstatus', :user_id => 1, :status => 'ok')
38
33
  end
39
34
  end
40
-
41
- describe 'API' do
42
- it 'finds user by id' do
43
- stub_request(:get, "https://example.talentlms.com/api/v1/users/id:1").
44
- with(:headers => @headers).
45
- to_return(:status => 200, :body => "{\"id\": 1}", :headers => {})
46
-
47
- expected = {"id" => 1}
48
- assert_equal expected, @client.users(:id => 1)
49
- end
50
- end
51
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: talentlms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Mercier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-18 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -89,6 +89,7 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - .gitignore
91
91
  - .ruby-version
92
+ - .travis.yml
92
93
  - Gemfile
93
94
  - LICENSE.txt
94
95
  - README.md
@@ -98,6 +99,7 @@ files:
98
99
  - lib/talentlms/version.rb
99
100
  - talentlms.gemspec
100
101
  - test/test_helper.rb
102
+ - test/unit/api_test.rb
101
103
  - test/unit/client_test.rb
102
104
  homepage: ''
103
105
  licenses:
@@ -125,4 +127,5 @@ specification_version: 4
125
127
  summary: Talent LMS API gem
126
128
  test_files:
127
129
  - test/test_helper.rb
130
+ - test/unit/api_test.rb
128
131
  - test/unit/client_test.rb