spartacus 0.1.1 → 0.1.2

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 +12 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f97f5dd4b1b84144ff039fdf5cc5311b3ab006e
4
- data.tar.gz: f26b7eba15f6f2654b8e9576e4b54a5bbac718f1
3
+ metadata.gz: 801c55dbf9d465941639685779acb667d62e22fb
4
+ data.tar.gz: 9df8b4141dcd69f6206a5c90ab2b735b70fc01f9
5
5
  SHA512:
6
- metadata.gz: de92c841f25405058f9a749ec8008df37a2888cca5c9b2769195d5e1e801c417f26e1d730b98188eaf6e8f384114da7964d04a1e0d016c0b2a3a06e7b34c2f87
7
- data.tar.gz: 4c3eec30d95fca166b7f7c23910899f8b9574500e42bff3ee338a1ed72c0799708fb85fe33f0d142998151035e42f071a33f2d349de4193886e803d2131762b4
6
+ metadata.gz: c866e77cbc02388f601d96fe80bc17f39be0d976698ed6cba72ff422af655eec2d87db24be3a0e824f72bebec4def7d8eab5681e2a67d7149a3774af45dd53df
7
+ data.tar.gz: e2634bf8eb8255d93f48586030e87cc17a9c1c0342f92de71de2f906b33df27e527139ff2aa5571040578bd92b924451796495cb3954eee1b8213f5621932f9e
data/lib/spartacus.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'httparty'
2
+ require 'json'
2
3
 
3
4
  Dir[File.dirname(__FILE__) + '/client/*.rb'].each {|file| require file }
4
5
 
@@ -8,8 +9,17 @@ class Spartacus
8
9
  include Users
9
10
  include RoadmapSections
10
11
 
11
- def initialize(api_jwt, api_base_path="https://www.bloc.io/api/v1")
12
- @api_jwt = api_jwt
12
+ def initialize(email, password, api_base_path="https://www.bloc.io/api/v1")
13
13
  @api_base_path = api_base_path
14
+ url = "#{@api_base_path}/sessions"
15
+
16
+ response = self.class.post(url, query: { email: email, password: password } )
17
+
18
+ if success?(response.code)
19
+ response_hash = JSON.parse(response.body)
20
+ @auth_token = response_hash["auth_token"]
21
+ else
22
+ raise response.body
23
+ end
14
24
  end
15
25
  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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Neely