fulcrum 0.9.0 → 0.9.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e109e3981651935f824c5685b7e40ff48cf623a8e446ebf2d2523f5c0bf0901a
4
- data.tar.gz: 7b0db440781edb8b8e20d07172faa41253791a050200a52ff5659fd3d04c2bab
3
+ metadata.gz: a6da67d577a8e64b2f9a92ea5360b370e78f1fb253a1e1029f07b2c2c756fc05
4
+ data.tar.gz: 65684be4fc3cd0ec36b8f9a17b97d42e2f4e2664c8b29d4e611e321e6a8f150d
5
5
  SHA512:
6
- metadata.gz: 5d5c671acf8d1b0e23dac08eddbe724eed9f133e79028b455e12c10fe7e9b88c1bf3848e8c123883c97c429f29e08f9fe9439fd978ae9064ba8080ef48767881
7
- data.tar.gz: 4fcc76118fb41b6788a79786f257de432008642f6e94ee3f44d5c799cd5b028478b6ae08f736aa6f18626d6d019b97d8858395ad2307c8efdc40011423e29a14
6
+ metadata.gz: a78d0a12e1a5c7a1f57de8556271b3ad0733fdda72fb0ea3d2d4e41284c1b3fc255a7c03686a0cca22d3c12f59ef0edb4cb1145f36bec3ffb31cfc0bb21aac24
7
+ data.tar.gz: a9107b8ce100e57f2b0a7958519b4b3781deb32b36f72378ff09f918e400ab8a0b653b0b29424e3fe5e6bb3640715650124e390ebf95b908f682530a9e361366
@@ -2,9 +2,7 @@ require 'faraday'
2
2
  require 'faraday_middleware'
3
3
 
4
4
  module Fulcrum
5
-
6
5
  class Client
7
-
8
6
  DEFAULT_URL = 'https://api.fulcrumapp.com/api/v2'
9
7
 
10
8
  DEFAULT_USER_AGENT = "Fulcrum Ruby API Client, Version #{Fulcrum::VERSION}"
@@ -62,6 +60,7 @@ module Fulcrum
62
60
  connection.basic_auth(username, password)
63
61
 
64
62
  resp = connection.get('users.json')
63
+
65
64
  user = resp.body['user']
66
65
  user['contexts'] = user['contexts'].map{|c| c.except!('api_token')}
67
66
 
@@ -82,8 +81,8 @@ module Fulcrum
82
81
 
83
82
  def self.create_connection(url, key = nil)
84
83
  Faraday.new(url) do |connection|
85
- connection.request :multipart
86
- connection.request :json
84
+ connection.request :multipart
85
+ connection.request :json
87
86
 
88
87
  connection.response :raise_error
89
88
  connection.response :json, content_type: 'application/json'
@@ -1,3 +1,3 @@
1
1
  module Fulcrum
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -23,14 +23,15 @@ describe Fulcrum::Client do
23
23
  end
24
24
 
25
25
  it 'can get_user' do
26
- url = 'https://fred%40flinstones.com:secret@api.fulcrumapp.com/api/v2/users.json'
27
26
  response = '{"user":{"first_name":"Jason","last_name":"Sanford","email":"jason@fulcrumapp.com","image_small":"https://fulcrumapp-dev.s3.amazonaws.com/user-images/small_abc.jpg","image_large":"https://fulcrumapp-dev.s3.amazonaws.com/user-images/large_abc.jpg","id":"49d06ce5-1457-476c-9cb4-fd9d41ea43ef","contexts":[{"name":"Team Jason","id":"e09c1a03-819d-47d6-aebc-f8712d292b57","api_token":"abc123","image_small":"https://fulcrumapp-dev.s3.amazonaws.com/organization-images/small_abc.jpg","image_large":"https://fulcrumapp-dev.s3.amazonaws.com/organization-images/large_abc.jpg","type":"organization","role":{},"domain":null,"plan":{}}],"access":{"allowed":true}}}'
28
27
 
29
- stub_request(:get, url)
30
- .to_return(status: 200, body: response,
31
- headers: {"Content-Type" => "application/json"})
28
+ stub_request(:get, "https://api.fulcrumapp.com/api/v2/users.json")
29
+ .with(
30
+ headers: {
31
+ 'Authorization' => 'Basic ZnJlZEBmbGluc3RvbmVzLmNvbTpzZWNyZXQ='
32
+ }
33
+ ).to_return(status: 200, body: response, headers: { 'Content-Type'=>'application/json' })
32
34
 
33
- sql = 'select name from tables limit 1;'
34
35
  user = Fulcrum::Client.get_user('fred@flinstones.com', 'secret')
35
36
 
36
37
  expect(user['contexts'].length).to eq(1)
@@ -38,14 +39,16 @@ describe Fulcrum::Client do
38
39
  end
39
40
 
40
41
  it 'can create_authorization' do
41
- url = 'https://fred%40flinstones.com:secret@api.fulcrumapp.com/api/v2/authorizations.json'
42
42
  body = '{"authorization":{"organization_id":"abc-123","note":"Tess Ting","timeout":null,"user_id":null}}'
43
43
  response = '{"authorization":{"note":"Tess Ting","expires_at":null,"timeout":null,"token_last_8":"46c5cb33","last_ip_address":null,"last_user_agent":null,"token":"ac493349cd4de0c376185c1d347d24ce5a3867bd3e04397bb875ed6b9b0546b768caa3bf46c5cb33","created_at":"2019-04-12T13:25:28Z","updated_at":"2019-04-12T13:25:28Z","id":"f1d84caa-da28-4fc5-a341-44bb9efa6266","last_used_at":null,"user_id":"4f1cfa091441405373000443"}}'
44
44
 
45
- stub_request(:post, url)
46
- .with(body: body)
47
- .to_return(status: 200, body: response,
48
- headers: {"Content-Type" => "application/json"})
45
+ stub_request(:post, "https://api.fulcrumapp.com/api/v2/authorizations.json").
46
+ with(
47
+ body: body,
48
+ headers: {
49
+ 'Authorization' => 'Basic ZnJlZEBmbGluc3RvbmVzLmNvbTpzZWNyZXQ='
50
+ }
51
+ ).to_return(status: 200, body: response, headers: { 'Content-Type'=>'application/json' })
49
52
 
50
53
  authorization = Fulcrum::Client.create_authorization('fred@flinstones.com', 'secret', 'abc-123', 'Tess Ting')
51
54
 
@@ -144,8 +144,6 @@ module Support
144
144
  object = resource.delete(resource_id)
145
145
 
146
146
  expect(client.response.status).to eq(204)
147
-
148
- expect(object).to be_a(Hash)
149
147
  end
150
148
  end
151
149
  end
data/spec/spec_helper.rb CHANGED
@@ -2,5 +2,4 @@ require 'rspec'
2
2
  require 'webmock/rspec'
3
3
  require 'fulcrum'
4
4
  require 'client_helper'
5
- require 'resource_examples'
6
-
5
+ require 'resource_examples'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fulcrum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fulcrum