credly 0.0.1 → 0.0.2

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: cbfda88cb9f0b74434154eeaf2c30b2b2f57eca2
4
- data.tar.gz: 23052d6d8f5a1fb29b4d0a847fc66f15efd30284
3
+ metadata.gz: b86e3b114c437d2143b9657648f8951b8caa8f5a
4
+ data.tar.gz: 8b9ac6c6f01e334e13df2097f2e09c56e9dbb10c
5
5
  SHA512:
6
- metadata.gz: b1454967c24553f048ab0a83dfcd05a6a99f504a772ab01ed6af778e2bb3760a7d455cbb9b8e6dd7719baacf92fbcd83f6c450e099837b926839d1c544e0c6e6
7
- data.tar.gz: 56363883bd24100f2a1f3d81f4d9d1e8e35e5481deb24e4c705cbfa59cc8848cf8574d720dc9c415498807f62e768fcca3bf454352a4b67d1c1cfbc07b3e9305
6
+ metadata.gz: 411988b2985245817fc0441383c42e9242bb70cafee59d8a57e1e077c45882ecb95014863815a5ee256943964280a0ad84e7eaca83e64d35e25308ec439fe4b4
7
+ data.tar.gz: a283bbc7fca7f8c7baef1d05fa1e5e3d9637d15cd632dca01dd0583d734be2aed8446dee3f4d8a98a7fce1d8a103e39f2197833be2d5580a37d5bd52272befaa
data/.gitignore CHANGED
@@ -1 +1,4 @@
1
1
  tmp/
2
+ *.gem
3
+ .idea
4
+ Gemfile.lock
data/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Gonzalo Rodríguez-Baltanás Díaz, Haiku Learning Systems
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile CHANGED
@@ -16,4 +16,9 @@ task :publish => :build do
16
16
  end
17
17
 
18
18
  task :release => :publish do
19
+ end
20
+
21
+ task :install_gems do
22
+ # Used when testing in 1.8.6, where bundler is not available.
23
+ system("gem install faraday activesupport multi_json rake pry-debugger json_spec rspec guard-bundler guard-rspec rb-inotify rb-fsevent rb-fchange ruby_gntp faraday fabrication fuubar awesome_print")
19
24
  end
@@ -29,12 +29,12 @@ module Credly
29
29
  options[:user_agent]
30
30
  end
31
31
 
32
- def self.auth_token=(auth_token)
33
- options[:auth_token] = auth_token
32
+ def self.access_token=(access_token)
33
+ options[:access_token] = access_token
34
34
  end
35
35
 
36
- def self.auth_token
37
- options[:auth_token]
36
+ def self.access_token
37
+ options[:access_token]
38
38
  end
39
39
 
40
40
  def self.version=(version)
@@ -50,7 +50,7 @@ module Credly
50
50
  @@options
51
51
  else
52
52
  @@options = { :base_endpoint => 'https://apistaging2.credly.com',
53
- :auth_token => nil,
53
+ :access_token => nil,
54
54
  :version => 'v0.2',
55
55
  :debugging => false,
56
56
  :user_agent => 'credly_ruby_client' }
@@ -67,15 +67,22 @@ module Credly
67
67
 
68
68
  end
69
69
 
70
- require 'active_support/all'
70
+ if defined? Rails
71
+ if Rails::VERSION::MAJOR > 2
72
+ require 'active_support/all'
73
+ else
74
+ require 'active_support'
75
+ end
76
+ else
77
+ require 'active_support/all'
78
+ end
71
79
 
72
80
  require 'credly/version'
73
81
  require 'credly/connection'
74
82
  require 'credly/response/follow_redirects'
75
83
  require 'credly/requierable'
76
- require 'credly/api'
77
84
  require 'credly/client'
78
85
 
79
86
  require 'credly/api/base'
80
87
 
81
- Dir[File.dirname(__FILE__) + "/credly/api/*"].each {|file| require file }
88
+ Dir[File.dirname(__FILE__) + "/credly/api/*"].each {|file| require file unless file == 'base.rb' }
@@ -2,19 +2,19 @@ module Credly
2
2
  class Api
3
3
  class Badges < Base
4
4
 
5
- def all(options = Hash.new)
5
+ def all(options = {})
6
6
  get("badges", options)
7
7
  end
8
8
 
9
- def create(options = Hash.new)
9
+ def create(options = {})
10
10
  post('badges', options)
11
11
  end
12
12
 
13
- def find(id, options = Hash.new)
13
+ def find(id, options = {})
14
14
  get("badges/#{id}", options)
15
15
  end
16
16
 
17
- def update(id, options = Hash.new)
17
+ def update(id, options = {})
18
18
  post("badges/#{id}", options)
19
19
  end
20
20
 
@@ -1,4 +1,3 @@
1
- require 'ostruct'
2
1
 
3
2
  module Credly
4
3
  class Api
@@ -7,13 +6,19 @@ module Credly
7
6
  include Requierable
8
7
 
9
8
  attr_accessor :response
9
+ attr_accessor :id
10
10
 
11
- def initialize(options = Hash.new)
12
- @client = options[:client]
11
+ def initialize(options = {})
12
+ @client = options.delete(:client)
13
+ options.each_pair do |key, value|
14
+ if self.respond_to?("#{key}=")
15
+ self.send("#{key}=", value)
16
+ end
17
+ end
13
18
  end
14
19
 
15
20
  def build_object
16
- return OpenStruct.new(MultiJson.load(@response))
21
+ MultiJson.load(@response)
17
22
  end
18
23
 
19
24
  def before_request(*args)
@@ -3,7 +3,7 @@ module Credly
3
3
  class Badges < Base
4
4
 
5
5
  class Categories < Base
6
- def all(options = Hash.new)
6
+ def all(options = {})
7
7
  get("badges/categories", options)
8
8
  end
9
9
  end
@@ -3,8 +3,10 @@ module Credly
3
3
  class MemberBadges < Base
4
4
 
5
5
  class Evidence < Base
6
- def all(member_badge, options = Hash.new)
7
- get("member_badges/#{member_badge}/evidence", options)
6
+ attr_accessor :member_badge_id
7
+
8
+ def all(options = {})
9
+ get("member_badges/#{self.member_badge_id}/evidence", options)
8
10
  end
9
11
  end
10
12
 
@@ -2,16 +2,16 @@ module Credly
2
2
  class Api
3
3
  class MemberBadges < Base
4
4
 
5
- def create(options = Hash.new)
5
+ def create(options = {})
6
6
  post('member_badges', options)
7
7
  end
8
8
 
9
- def find(id, options = Hash.new)
9
+ def find(id, options = {})
10
10
  get("member_badges/#{id}", options)
11
11
  end
12
12
 
13
13
  def evidence
14
- Evidence.new(:client => @client)
14
+ Evidence.new(:client => @client, :member_badge_id => self.id)
15
15
  end
16
16
 
17
17
  end
@@ -0,0 +1,31 @@
1
+ module Credly
2
+ class Api
3
+ class Members < Base
4
+
5
+ class Badges < Base
6
+ attr_accessor :member_id
7
+
8
+ def all(options = {})
9
+ get("members/#{self.member_id}/badges", options)
10
+ end
11
+
12
+ def given(options = {})
13
+ get("members/#{self.member_id}/badges/given", options)
14
+ end
15
+ end
16
+
17
+ def all(options = {})
18
+ get("members", options)
19
+ end
20
+
21
+ def find(id, options = {})
22
+ get("members/#{id}", options)
23
+ end
24
+
25
+ def badges
26
+ Badges.new(:client => @client, :member_id => self.id)
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -5,50 +5,69 @@ module Credly
5
5
 
6
6
  attr_accessor :options
7
7
 
8
- def initialize(options = Hash.new)
9
- @options = OpenStruct.new(Credly.options.merge(options))
10
- end
11
-
12
- def api
13
- Api.new(self)
8
+ def initialize(args = {})
9
+ @options = Credly.options
10
+ if args[:username] && args[:password]
11
+ @options[:access_token] = authenticate(args[:username], args[:password])
12
+ elsif args[:access_token]
13
+ @options[:access_token] = args[:access_token]
14
+ else
15
+ raise ArgumentError.new("Need either an 'access_token' or 'username' and 'password' parameters")
16
+ end
14
17
  end
15
18
 
16
19
  def authenticate(username, password)
17
20
  connection = new_connection
18
21
  connection.basic_auth(username, password)
19
22
  resp = connection.post(versioned_path('authenticate'))
20
- resp = OpenStruct.new(MultiJson.load(resp.body))
21
- if resp.status_code == 200
22
- options.auth_token = resp.data['token']
23
+ resp = MultiJson.load(resp.body)
24
+ if resp['meta']['status_code'] == 200
25
+ resp['data']['token']
23
26
  else
24
- resp
27
+ raise "The username or password was invalid\n#{resp}"
25
28
  end
26
29
  end
27
30
 
28
- def get(path, params = Hash.new, headers = Hash.new)
29
- super(versioned_path(path), {:access_token => options.auth_token}.merge(params), headers)
31
+ def access_token
32
+ options[:access_token]
33
+ end
34
+
35
+ def get(path, params = {}, headers = {})
36
+ super(versioned_path(path), {:access_token => access_token}.merge(params), headers)
30
37
  end
31
38
 
32
- def post(path, params = Hash.new, headers = Hash.new)
33
- super(versioned_path(path), {:access_token => options.auth_token}.merge(params), headers)
39
+ def post(path, params = {}, headers = {})
40
+ super(versioned_path(path), {:access_token => access_token}.merge(params), headers)
34
41
  end
35
42
 
36
- def put(path, params = Hash.new, headers = Hash.new)
37
- super(versioned_path(path), {:access_token => options.auth_token}.merge(params), headers)
43
+ def put(path, params = {}, headers = {})
44
+ super(versioned_path(path), {:access_token => access_token}.merge(params), headers)
38
45
  end
39
46
 
40
- def delete(path, params = Hash.new, headers = Hash.new)
41
- super(versioned_path(path), {:access_token => options.auth_token}.merge(params), headers)
47
+ def delete(path, params = {}, headers = {})
48
+ super(versioned_path(path), {:access_token => access_token}.merge(params), headers)
42
49
  end
43
50
 
44
51
  def base_url
45
- options.base_endpoint
52
+ options[:base_endpoint]
53
+ end
54
+
55
+ def badges(id = nil)
56
+ Api::Badges.new(:client => self, :id => id)
57
+ end
58
+
59
+ def member_badges(id = nil)
60
+ Api::MemberBadges.new(:client => self, :id => id)
61
+ end
62
+
63
+ def members(id = nil)
64
+ Api::Members.new(:client => self, :id => id)
46
65
  end
47
66
 
48
67
  private
49
68
 
50
69
  def versioned_path(path)
51
- [options.version, path].join('/')
70
+ [options[:version], path].join('/')
52
71
  end
53
72
 
54
73
  end
@@ -12,6 +12,7 @@ module Credly
12
12
  :user_agent => Credly.user_agent,
13
13
  }
14
14
  }
15
+
15
16
  Faraday.new(self.base_url, default_options) do |builder|
16
17
  builder.use Credly::Response::FollowRedirects
17
18
  builder.request :multipart
@@ -19,7 +20,7 @@ module Credly
19
20
  # builder.use Faraday::Request::Multipart
20
21
  # builder.use Faraday::Request::UrlEncoded
21
22
 
22
- builder.response :logger, ::Logger.new(STDOUT), :bodies => true if Credly.debugging?
23
+ builder.response :logger, ::Logger.new(STDOUT) if Credly.debugging?
23
24
  builder.adapter Faraday.default_adapter
24
25
  end
25
26
  end
@@ -28,19 +29,19 @@ module Credly
28
29
  @connection ||= new_connection
29
30
  end
30
31
 
31
- def get(path, params = Hash.new, headers = Hash.new)
32
+ def get(path, params = {}, headers = {})
32
33
  request(:get, path, params, headers)
33
34
  end
34
35
 
35
- def post(path, params = Hash.new, headers = Hash.new)
36
+ def post(path, params = {}, headers = {})
36
37
  request(:post, path, params, headers)
37
38
  end
38
39
 
39
- def put(path, params = Hash.new, headers = Hash.new)
40
+ def put(path, params = {}, headers = {})
40
41
  request(:put, path, params, headers)
41
42
  end
42
43
 
43
- def delete(path, params = Hash.new, headers = Hash.new)
44
+ def delete(path, params = {}, headers = {})
44
45
  request(:delete, path, params, headers)
45
46
  end
46
47
 
@@ -13,8 +13,6 @@ module Credly
13
13
  nil
14
14
  else
15
15
  response_hash = ::MultiJson.decode(body)
16
-
17
- #raise LearnSprout::RequestException, response_hash["message"] if response_hash["message"]
18
16
  end
19
17
  end
20
18
  end
@@ -1,4 +1,3 @@
1
1
  module Credly
2
- VERSION = '0.0.1'
3
-
2
+ VERSION = '0.0.2'
4
3
  end
@@ -2,75 +2,61 @@
2
2
 
3
3
  Credly is an Badging service. This is the the API client for the ruby client. You can find Credly's API at https://apidocs2.credly.com/credly.
4
4
 
5
- # Configuration
5
+ ## Install
6
6
 
7
- This is how you can configure the default values for Credly:
7
+ ```
8
+ gem 'credly'
9
+ ```
8
10
 
11
+ ## Quick Start
9
12
  ```ruby
10
- Credly.configuration do |config|
11
- # These are the default values
12
- config.base_endpoint = 'apistaging2.credly.com'
13
- config.version = 'v0.2'
14
- config.auth_token = nil
15
- end
13
+ client = Credly::Client.new(access_token: '26287568342')
14
+ # Or
15
+ client = Credly::Client.new(username: 'whatever', password: 'mypass')
16
+
17
+ client.badges.all
18
+ client.badges.find(1)
19
+ client.badges.categories.all
16
20
  ```
17
21
 
18
- You can also:
22
+ All API endpoints are accessible from the client instance. The endpoints methods are named after the remote endpoint. So, for example any action on 'https://apistaging2.credly.com/v0.2/members' will be using `client.members`.
23
+
24
+ Nested endpoints, like `/members/:id/badges` are also nested in the client
19
25
 
20
26
  ```ruby
21
- Credly.configuration.base_endpoint = 'apistaging2.credly.com/v0.2/'
22
- Credly.configuration.version = 'v0.2'
23
- Credly.configuration.auth_token = nil
27
+ client.members(id).badges.all(other_parameter: 'whatever')
24
28
  ```
25
29
 
26
- Those options will be the default ones for any `client.api` you create afterwards. Nonetheless, you can overwrite any of these options; just pass it as an argument when you instantiate the client:
30
+ Check https://github.com/haikulearning/credly-ruby/blob/master/spec/unit/api_spec.rb for examples.
27
31
 
28
- ```ruby
29
- client = client.api.new(auth_token: '26287568342')
30
32
 
31
- ```
33
+ ## Configuration
32
34
 
33
- Then you instantiate a client and use it to make calls:
34
- ```ruby
35
- client = client.api.new()
36
-
37
- client.api.badges.all
38
- => #<OpenStruct
39
- meta={"status_code"=>200, "status"=>"OK", "message"=>"", "more_info"=>nil},
40
- data=[
41
- { "id"=>1003,
42
- "title"=>"asadas",
43
- "short_description"=>"asdasda",
44
- "image_url"=>"https://credlyapp.s3.amazonaws.com/badges/6f7791d21e13ca7409146c2343fdf28d.png",
45
- "is_giveable"=>false,
46
- "created_at"=>"Thu, 04 Jul 2013 06:33:43 -0400",
47
- "creator_id"=>147,
48
- "resources"=>{"url"=>"https://apistaging2.credly.com/v0.2/badges/1003"}},
49
-
50
- { "id"=>1002,
51
- "title"=>"asadas",
52
- "short_description"=>"asdasda",
53
- "image_url"=>"https://credlyapp.s3.amazonaws.com/badges/6f7791d21e13ca7409146c2343fdf28d.png",
54
- "is_giveable"=>false,
55
- "created_at"=>"Thu, 04 Jul 2013 06:31:46 -0400",
56
- "creator_id"=>147,
57
- "resources"=>{"url"=>"https://apistaging2.credly.com/v0.2/badges/1002"}}
58
- ]
59
- >
35
+ This is how you can configure the default values for Credly:
60
36
 
37
+ ```ruby
38
+ Credly.configuration do |config|
39
+ # These are the default values
40
+ config.base_endpoint = 'apistaging2.credly.com'
41
+ config.version = 'v0.2'
42
+ config.access_token = nil
43
+ end
61
44
  ```
62
45
 
63
- All API endpoints are accessible from `client.api`. The endpoints methods are named after the remote endpoint. So, for example any action on 'https://apistaging2.credly.com/v0.2/members' will be using `client.api.members`.
64
-
65
- Nested endpoints, like `/members/:id/badges` are also nested in the client
46
+ You can also do:
66
47
 
67
48
  ```ruby
68
- client.api.members.badges
49
+ Credly.configuration.base_endpoint = 'apistaging2.credly.com/v0.2/'
50
+ Credly.configuration.version = 'v0.2'
51
+ Credly.configuration.access_token = nil
69
52
  ```
70
53
 
71
- In those cases, the `id` will be the first parameter on the method, as in:
54
+ Those options will be the default ones for any `client` you create afterwards. Nonetheless, you can overwrite any of these options; just pass it as an argument when you instantiate the client:
55
+
72
56
  ```ruby
73
- client.api.members.badges.all(1, { other_parameter: 'whatever' })
57
+ client = Credly::Client.new(access_token: '26287568342', base_endpoint: 'apistaging2.credly.com/', version: 'v0.2')
74
58
  ```
75
59
 
76
- Check https://github.com/haikulearning/credly-ruby/blob/master/spec/unit/api_spec.rb for examples.
60
+ ## License & Acknowledgments
61
+
62
+ The MIT License, for full details please see the LICENSE file.
@@ -1,3 +1,3 @@
1
1
  shared_context 'api' do
2
- let(:client) { Credly::Client.new(:auth_token => 'blablabla')}
2
+ let(:client) { Credly::Client.new(:access_token => 'blablabla')}
3
3
  end
@@ -3,31 +3,39 @@ require 'spec_helper'
3
3
  describe 'API' do
4
4
  include_context 'api'
5
5
 
6
+ describe "authentication" do
7
+ it "authenticates" do
8
+ pending
9
+ client = Credly::Client.new(:username => 'whatever', :password => 'password')
10
+ client.access_token.should_not be_nil
11
+ end
12
+ end
13
+
6
14
  describe 'Badges' do
7
15
  it 'list all badges' do
8
16
  expect_api_call(:get, 'badges', {})
9
- client.api.badges.all
17
+ client.badges.all
10
18
  end
11
19
 
12
20
  it 'create a badge' do
13
21
  expect_api_call(:post, 'badges', :title => 'my title')
14
- client.api.badges.create(:title => 'my title')
22
+ client.badges.create(:title => 'my title')
15
23
  end
16
24
 
17
25
  it "update a badge" do
18
26
  expect_api_call(:post, 'badges/1', {})
19
- client.api.badges.update(1, {})
27
+ client.badges.update(1, {})
20
28
  end
21
29
 
22
30
  it "find a badge" do
23
31
  expect_api_call(:get, 'badges/1', {})
24
- client.api.badges.find(1, {})
32
+ client.badges.find(1, {})
25
33
  end
26
34
 
27
35
  describe "Categories" do
28
36
  it "list categories" do
29
37
  expect_api_call(:get, 'badges/categories', {})
30
- client.api.badges.categories.all({})
38
+ client.badges.categories.all({})
31
39
  end
32
40
  end
33
41
  end
@@ -35,18 +43,18 @@ describe 'API' do
35
43
  describe "Member Badges" do
36
44
  it "create member badge" do
37
45
  expect_api_call(:post, 'member_badges', {})
38
- client.api.member_badges.create({})
46
+ client.member_badges.create({})
39
47
  end
40
48
 
41
49
  it "find a member badge " do
42
50
  expect_api_call(:get, 'member_badges/1', {})
43
- client.api.member_badges.find(1, {})
51
+ client.member_badges.find(1, {})
44
52
  end
45
53
 
46
54
  describe "Evidence" do
47
55
  it "list all evidence for a member_badge" do
48
56
  expect_api_call(:get, 'member_badges/1/evidence', {})
49
- client.api.member_badges.evidence.all(1, {})
57
+ client.member_badges(1).evidence.all({})
50
58
  end
51
59
  end
52
60
  end
@@ -54,23 +62,23 @@ describe 'API' do
54
62
  describe "Members" do
55
63
  it "list all members" do
56
64
  expect_api_call(:get, 'members', {})
57
- client.api.members.all({})
65
+ client.members.all({})
58
66
  end
59
67
 
60
68
  it "find a member" do
61
69
  expect_api_call(:get, 'members/1', {})
62
- client.api.members.find(1, {})
70
+ client.members.find(1, {})
63
71
  end
64
72
 
65
73
  describe "Badges" do
66
74
  it "list all badges of a member" do
67
75
  expect_api_call(:get, 'members/1/badges', {})
68
- client.api.members.badges.all(1, {})
76
+ client.members(1).badges.all({})
69
77
  end
70
78
 
71
79
  it "list all badges a member has given" do
72
80
  expect_api_call(:get, 'members/1/badges/given', {})
73
- client.api.members.badges.given(1, {})
81
+ client.members(1).badges.given({})
74
82
  end
75
83
  end
76
84
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gonzalo Rodríguez-Baltanás Díaz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-04 00:00:00.000000000 Z
11
+ date: 2013-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -258,18 +258,17 @@ files:
258
258
  - .gitignore
259
259
  - .rvmrc
260
260
  - Gemfile
261
- - Gemfile.lock
262
261
  - Guardfile
262
+ - LICENCE
263
263
  - Rakefile
264
264
  - credly.gemspec
265
265
  - lib/credly.rb
266
- - lib/credly/api.rb
267
266
  - lib/credly/api/badges.rb
268
267
  - lib/credly/api/base.rb
269
268
  - lib/credly/api/categories.rb
270
269
  - lib/credly/api/evidence.rb
271
- - lib/credly/api/member.rb
272
270
  - lib/credly/api/member_badges.rb
271
+ - lib/credly/api/members.rb
273
272
  - lib/credly/client.rb
274
273
  - lib/credly/connection.rb
275
274
  - lib/credly/requierable.rb
@@ -299,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
298
  version: '0'
300
299
  requirements: []
301
300
  rubyforge_project:
302
- rubygems_version: 2.0.3
301
+ rubygems_version: 2.0.6
303
302
  signing_key:
304
303
  specification_version: 4
305
304
  summary: ruby client for the Credly API
@@ -1,113 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- credly (0.0.1)
5
- activesupport
6
- faraday
7
- multi_json
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- activesupport (4.0.0)
13
- i18n (~> 0.6, >= 0.6.4)
14
- minitest (~> 4.2)
15
- multi_json (~> 1.3)
16
- thread_safe (~> 0.1)
17
- tzinfo (~> 0.3.37)
18
- atomic (1.1.10)
19
- awesome_print (1.1.0)
20
- coderay (1.0.9)
21
- columnize (0.3.6)
22
- debugger (1.6.0)
23
- columnize (>= 0.3.1)
24
- debugger-linecache (~> 1.2.0)
25
- debugger-ruby_core_source (~> 1.2.1)
26
- debugger-linecache (1.2.0)
27
- debugger-ruby_core_source (1.2.3)
28
- diff-lcs (1.2.4)
29
- fabrication (2.7.2)
30
- faraday (0.8.7)
31
- multipart-post (~> 1.1)
32
- ffi (1.9.0)
33
- formatador (0.2.4)
34
- fuubar (1.1.1)
35
- rspec (~> 2.0)
36
- rspec-instafail (~> 0.2.0)
37
- ruby-progressbar (~> 1.0)
38
- guard (1.8.1)
39
- formatador (>= 0.2.4)
40
- listen (>= 1.0.0)
41
- lumberjack (>= 1.0.2)
42
- pry (>= 0.9.10)
43
- thor (>= 0.14.6)
44
- guard-bundler (1.0.0)
45
- bundler (~> 1.0)
46
- guard (~> 1.1)
47
- guard-rspec (3.0.2)
48
- guard (>= 1.8)
49
- rspec (~> 2.13)
50
- i18n (0.6.4)
51
- json_spec (1.1.1)
52
- multi_json (~> 1.0)
53
- rspec (~> 2.0)
54
- listen (1.2.2)
55
- rb-fsevent (>= 0.9.3)
56
- rb-inotify (>= 0.9)
57
- rb-kqueue (>= 0.2)
58
- lumberjack (1.0.4)
59
- method_source (0.8.1)
60
- minitest (4.7.5)
61
- multi_json (1.7.7)
62
- multipart-post (1.2.0)
63
- pry (0.9.12.2)
64
- coderay (~> 1.0.5)
65
- method_source (~> 0.8)
66
- slop (~> 3.4)
67
- pry-debugger (0.2.2)
68
- debugger (~> 1.3)
69
- pry (~> 0.9.10)
70
- rake (10.1.0)
71
- rb-fchange (0.0.6)
72
- ffi
73
- rb-fsevent (0.9.3)
74
- rb-inotify (0.9.0)
75
- ffi (>= 0.5.0)
76
- rb-kqueue (0.2.0)
77
- ffi (>= 0.5.0)
78
- rspec (2.13.0)
79
- rspec-core (~> 2.13.0)
80
- rspec-expectations (~> 2.13.0)
81
- rspec-mocks (~> 2.13.0)
82
- rspec-core (2.13.1)
83
- rspec-expectations (2.13.0)
84
- diff-lcs (>= 1.1.3, < 2.0)
85
- rspec-instafail (0.2.4)
86
- rspec-mocks (2.13.1)
87
- ruby-progressbar (1.1.1)
88
- ruby_gntp (0.3.4)
89
- slop (3.4.5)
90
- thor (0.18.1)
91
- thread_safe (0.1.0)
92
- atomic
93
- tzinfo (0.3.37)
94
-
95
- PLATFORMS
96
- ruby
97
-
98
- DEPENDENCIES
99
- awesome_print
100
- credly!
101
- fabrication
102
- faraday
103
- fuubar
104
- guard-bundler
105
- guard-rspec
106
- json_spec
107
- pry-debugger
108
- rake
109
- rb-fchange
110
- rb-fsevent
111
- rb-inotify
112
- rspec
113
- ruby_gntp
@@ -1,33 +0,0 @@
1
- require 'forwardable'
2
-
3
- module Credly
4
- class Api
5
- extend Forwardable
6
-
7
- attr_accessor :client
8
-
9
- def_delegators :@client, :get, :post, :request, :put, :delete, :patch
10
-
11
- def initialize(client)
12
- @client = client
13
- end
14
-
15
- private
16
-
17
- def self.endpoint(name)
18
- define_method name do
19
- $endpoint_resource = name.to_s if ENV['testing']
20
- Api::const_get(name.to_s.camelize).new(:client => @client)
21
- end
22
- end
23
-
24
- def self.endpoints(*names)
25
- names.each { |name| endpoint(name) }
26
- end
27
-
28
- public
29
-
30
- endpoints :badges, :member_badges, :members
31
-
32
- end
33
- end
@@ -1,29 +0,0 @@
1
- module Credly
2
- class Api
3
- class Members < Base
4
-
5
- class Badges < Base
6
- def all(member_id, options = Hash.new)
7
- get("members/#{member_id}/badges", options)
8
- end
9
-
10
- def given(member_id, options = Hash.new)
11
- get("members/#{member_id}/badges/given", options)
12
- end
13
- end
14
-
15
- def all(options = Hash.new)
16
- get("members", options)
17
- end
18
-
19
- def find(id, options = Hash.new)
20
- get("members/#{id}", options)
21
- end
22
-
23
- def badges
24
- Badges.new(:client => @client)
25
- end
26
-
27
- end
28
- end
29
- end