spartacus 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/spartacus.rb +6 -44
  3. metadata +29 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7feabd1e1e1466431ef31c0d205da9e1a7588f0
4
- data.tar.gz: bdc0f12645d59d205c837af63324562987404d3d
3
+ metadata.gz: ea13022a23d726f96e7cc9e2efa4f831a14ed113
4
+ data.tar.gz: 82fef92d994c5297c26da65d1f5e24d8ee6db476
5
5
  SHA512:
6
- metadata.gz: 361b45bb70af9cf5e1ce1d6eccba08791a90b3b13a2e1a6fd275fb4ac1559b2621e9d16ec97da2764256d379dba8c59b12ee8d60b13013dcffe1bfd5fa567f3a
7
- data.tar.gz: 0df38adfe009305d564e74965709999b227102560662d3c5e3357b21d787c62b63be8ab0b600f3af7ae13ff94a9ef6c0ed7e6281277ff6db2075760c55df7734
6
+ metadata.gz: 157a88641075364b437f3126dd93479db4e6f6ea7dd21a7d066bd07b79131764853db5fd9f860c228a80b5d63b61b2dd566f07376f3683314abec502560855e0
7
+ data.tar.gz: 1e252c9d19b6bfc2f296419926079b17018082a717da22bea34161106e1f41c7289b456e9680ff066e15f94ad51af21bcb04e2c0dfc810f3aa9b2e4cef7844e0
data/lib/spartacus.rb CHANGED
@@ -1,53 +1,15 @@
1
1
  require 'httparty'
2
2
 
3
+ Dir[File.dirname(__FILE__) + '/client/*.rb'].each {|file| require file }
4
+
3
5
  class Spartacus
4
6
  include HTTParty
7
+ include Checkpoints
8
+ include Users
9
+ include RoadmapSections
5
10
 
6
11
  def initialize(api_jwt, api_base_path="https://www.bloc.io/api/v1")
7
12
  @api_jwt = api_jwt
8
- @api_base_path = api_base_path
9
- end
10
-
11
- # Handle API timouts
12
- def handle_timeouts
13
- begin
14
- yield
15
- rescue Net::OpenTimeout, Net::ReadTimeout
16
- {}
17
- end
18
- end
19
-
20
- # Update a checkpoint
21
- #
22
- # @param id [Integer] A checkpoint id
23
- # @param options [Hash] A customizable set of options.
24
- # @option options [String] :name Checkpoint name.
25
- # @option options [String] :summary Checkpoint summary.
26
- # @option options [String] :body Checkpoint body.
27
- # @option options [String] :assignment Checkpoint assignment.
28
- # @option options [Integer] :points Checkpoint point.
29
- # @option options [String] :body_and_assignment Checkpoint body and Assignment
30
- # @return [HTTParty::Response] The updated checkpoint
31
- # @example Update a checkpoint
32
- # SpartacusClient.new.update_checkpoint(129, {name: 'Real Cool Checkpoint'})
33
- def update_checkpoint(id, options={})
34
- accepted_params = ['name', 'summary', 'body', 'assignment', 'points', 'body_and_assignment']
35
- checkpoint_params = options.select {|k, v| accepted_params.include?(k) }
36
- update_checkpoint_url = "#{@api_base_path}/checkpoints/#{id}"
37
-
38
- handle_timeouts do
39
- self.class.put(update_checkpoint_url,
40
- headers: auth_header,
41
- query: { checkpoint: checkpoint_params })
42
- end
43
- end
44
-
45
- private
46
-
47
- # Set the API Authorization Header
48
- #
49
- # @return [Hash] The authorization header
50
- def auth_header
51
- { "authorization" => @api_jwt }
13
+ @api_base_path = api_base_path
52
14
  end
53
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spartacus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Neely
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.13.7
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
27
55
  description: A client for the Bloc API
28
56
  email: ben@bloc.to
29
57
  executables: []