authenticator-client 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a69ccae84065fcba5e7cef9403baaaf1fe304467
4
+ data.tar.gz: 0af8c0a607f41f51f875d2868f853031565c767d
5
+ SHA512:
6
+ metadata.gz: e0085a2d4bdfb54d1e55c2f4f8212eb0b6ba70da67e5fdb49e80f4ecea80b3c1e4d7af0e174b93c26f53de9a1a3d0b766e4d93b766648eb1e3b889a0cbdc5bb9
7
+ data.tar.gz: 57b4c784d33407da03c91c2405bfd38c81af6df12e416274c450fd91b89c672619da51dc10aedde9e86fa2f751d02055dcf45fe7d1f7ec45f42f9ad119099c49
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in authenticator-client.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 johnmcconnell
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Authenticator::Client
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'authenticator-client'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install authenticator-client
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/authenticator-client/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ task default: :spec
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'authenticator/client/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "authenticator-client"
8
+ spec.version = Authenticator::Client::VERSION
9
+ spec.authors = ["johnmcconnell"]
10
+ spec.email = ["johnnyillinois@gmail.com"]
11
+ spec.summary = %q{This is a rest client for account authenticator.}
12
+ spec.description = %q{This is a rest client for account authenticator.}
13
+ spec.homepage = "https://github.com/johnmcconnell/authenticator-client"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'rest-client', '~> 1.7.2'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "rspec-collection_matchers"
27
+ spec.add_development_dependency "vcr"
28
+ spec.add_development_dependency "webmock"
29
+ end
@@ -0,0 +1,20 @@
1
+ require "authenticator/client/version"
2
+
3
+ base_dir = File.join(File.dirname(__FILE__), 'client')
4
+
5
+ Dir["#{base_dir + File::SEPARATOR}*.rb"].each do |file|
6
+ require file
7
+ end
8
+
9
+ module Authenticator
10
+ module Client
11
+ @@configs = {}
12
+ def self.register_config(key, config)
13
+ @@configs[key] = config
14
+ end
15
+
16
+ def self.new(key)
17
+ Base.new(@@configs[key])
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Authenticator
2
+ module Client
3
+ class Account
4
+ attr_accessor :id, :username, :password, :created_at, :updated_at
5
+ def initialize(username, password)
6
+ @username = username
7
+ @password = password
8
+ end
9
+
10
+ def to_params
11
+ {
12
+ account: {
13
+ username: username,
14
+ password: password
15
+ }
16
+ }
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,92 @@
1
+ require 'rest_client'
2
+
3
+ module Authenticator
4
+ module Client
5
+ class Base
6
+ attr_reader :api_key, :api_password, :host
7
+
8
+ def initialize(config)
9
+ @api_key = config[:api_key]
10
+ @api_password = config[:api_password]
11
+ @host = config[:host]
12
+ validate_variables
13
+ end
14
+
15
+ def all
16
+ uri = account_path
17
+ RestClient.get uri, params: auth_params
18
+ end
19
+
20
+ def show(id)
21
+ uri = account_path(id)
22
+ RestClient.get uri, params: auth_params
23
+ end
24
+
25
+ def create(account)
26
+ uri = account_path
27
+ RestClient.post(
28
+ uri,
29
+ auth_params.merge(account.to_params).to_json,
30
+ content_type: :json,
31
+ accept: :json
32
+ )
33
+ end
34
+
35
+ def authenticate(account)
36
+ uri = authenticate_path
37
+ RestClient.post(
38
+ uri,
39
+ auth_params.merge(account.to_params).to_json,
40
+ content_type: :json,
41
+ accept: :json
42
+ )
43
+ end
44
+
45
+ def update(id, account)
46
+ uri = account_path(id)
47
+ RestClient.put(
48
+ uri,
49
+ auth_params.merge(account.to_params).to_json,
50
+ content_type: :json,
51
+ accept: :json
52
+ )
53
+ end
54
+
55
+ def destroy(id)
56
+ uri = account_path(id)
57
+ RestClient.delete(
58
+ uri, params: auth_params
59
+ )
60
+ end
61
+
62
+ protected
63
+
64
+ def authenticate_path
65
+ "#{host}/api/v1/authentications/authenticate"
66
+ end
67
+
68
+ def account_path(id = nil)
69
+ if id.nil?
70
+ "#{host}/api/v1/accounts"
71
+ else
72
+ "#{host}/api/v1/accounts/#{id}"
73
+ end
74
+ end
75
+
76
+ def auth_params
77
+ {
78
+ api_key: api_key,
79
+ api_password: api_password
80
+ }
81
+ end
82
+
83
+ private
84
+
85
+ def validate_variables
86
+ fail 'host must be set' if host.nil?
87
+ fail 'api_key must be set' if api_key.nil?
88
+ fail 'api_password must be set' if api_key.nil?
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,5 @@
1
+ module Authenticator
2
+ module Client
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,110 @@
1
+ require 'spec_helper'
2
+ require 'rspec/collection_matchers'
3
+ require 'authenticator/client'
4
+ require 'vcr'
5
+
6
+ VCR.configure do |c|
7
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
8
+ c.hook_into :webmock
9
+ end
10
+
11
+ describe Authenticator::Client::Base do
12
+ let(:config) do
13
+ {
14
+ api_key: '124ecd49-07fd-4553-a5cd-0178b7fa8b3f',
15
+ api_password: 'IIoclO7kmQqJ1wixWrAuOA',
16
+ host: 'http://account-authenticator.herokuapp.com'
17
+ }
18
+ end
19
+
20
+ let(:account) do
21
+ Authenticator::Client::Account.new('new_username', 'new_password')
22
+ end
23
+
24
+ let(:new_account) do
25
+ Authenticator::Client::Account.new('new_username_1', 'new_password_1')
26
+ end
27
+
28
+ let(:destroy_account) do
29
+ Authenticator::Client::Account.new('new_username_2', 'new_password_2')
30
+ end
31
+
32
+ let(:updated_account) do
33
+ Authenticator::Client::Account.new('updated_username', 'updated_password')
34
+ end
35
+
36
+ subject do
37
+ Authenticator::Client.register_config(:test, config)
38
+ Authenticator::Client.new(:test)
39
+ end
40
+
41
+ describe '#all' do
42
+ it 'fetches all the accounts' do
43
+ VCR.use_cassette('all_success') do
44
+ response = JSON.parse(subject.all)
45
+
46
+ expect(response['accounts']).not_to be nil
47
+ end
48
+ end
49
+ end
50
+
51
+ describe '#authenticate' do
52
+ it 'creates an account' do
53
+ VCR.use_cassette('authenticate_success') do
54
+ response = JSON.parse(
55
+ subject.authenticate(account)
56
+ )
57
+
58
+ expect(response['authenticated']).to eq true
59
+ end
60
+ end
61
+ end
62
+
63
+ describe '#create' do
64
+ it 'creates an account' do
65
+ VCR.use_cassette('create_success') do
66
+ response = JSON.parse(
67
+ subject.create(account)
68
+ )
69
+
70
+ expect(response['username']).to eq 'new_username'
71
+ expect(response['id']).not_to be nil
72
+ expect(response['created_at']).not_to be nil
73
+ expect(response['updated_at']).not_to be nil
74
+ end
75
+ end
76
+ end
77
+
78
+ describe '#show' do
79
+ it 'fetches the account' do
80
+ VCR.use_cassette('show_success') do
81
+ response = JSON.parse(subject.show(6))
82
+
83
+ expect(response['username']).to eq 'new_username'
84
+ end
85
+ end
86
+ end
87
+
88
+ describe '#update' do
89
+ it 'updates the account' do
90
+ VCR.use_cassette('update_success') do
91
+ id = JSON.parse(subject.create(new_account))['id']
92
+ response = JSON.parse(subject.update(id, updated_account))
93
+
94
+ expect(response['username']).to eq updated_account.username
95
+ expect(response['id']).to eq id
96
+ end
97
+ end
98
+ end
99
+
100
+ describe '#destroy' do
101
+ it 'destroys the account' do
102
+ VCR.use_cassette('destroy_success') do
103
+ id = JSON.parse(subject.create(destroy_account))['id']
104
+ response = JSON.parse(subject.destroy(id))
105
+
106
+ expect(response['id']).to eq id
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+ require 'rspec/collection_matchers'
3
+ require 'authenticator/client'
4
+ require 'vcr'
5
+
6
+ VCR.configure do |c|
7
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
8
+ c.hook_into :webmock
9
+ end
10
+
11
+ describe Authenticator::Client do
12
+ let(:config) do
13
+ {
14
+ api_key: '124ecd49-07fd-4553-a5cd-0178b7fa8b3f',
15
+ api_password: 'IIoclO7kmQqJ1wixWrAuOA',
16
+ host: 'http://account-authenticator.herokuapp.com'
17
+ }
18
+ end
19
+
20
+ describe '::register' do
21
+ it 'registers a configuration to be used when invoked with ::new' do
22
+ described_class.register_config(:test, config)
23
+ client = described_class.new(:test)
24
+ expect(client.host).to eq config[:host]
25
+ expect(client.api_key).to eq config[:api_key]
26
+ expect(client.api_password).to eq config[:api_password]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://account-authenticator.herokuapp.com/api/v1/accounts?api_key=124ecd49-07fd-4553-a5cd-0178b7fa8b3f&api_password=IIoclO7kmQqJ1wixWrAuOA
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - Cowboy
23
+ Date:
24
+ - Sun, 04 Jan 2015 20:36:27 GMT
25
+ Connection:
26
+ - keep-alive
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - '"d750f6d7ca4471b89f25e4d5c7fa8d78"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 0c59d284-8ebb-4bbc-9077-a4485d9a5762
41
+ X-Runtime:
42
+ - '0.102701'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ Via:
46
+ - 1.1 vegur
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"accounts":[]}'
50
+ http_version:
51
+ recorded_at: Sun, 04 Jan 2015 20:36:28 GMT
52
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://account-authenticator.herokuapp.com/api/v1/authentications/authenticate
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"api_key":"124ecd49-07fd-4553-a5cd-0178b7fa8b3f","api_password":"IIoclO7kmQqJ1wixWrAuOA","account":{"username":"new_username","password":"new_password"}}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '154'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Date:
28
+ - Mon, 05 Jan 2015 01:23:42 GMT
29
+ Connection:
30
+ - keep-alive
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Xss-Protection:
34
+ - 1; mode=block
35
+ X-Content-Type-Options:
36
+ - nosniff
37
+ Content-Type:
38
+ - application/json; charset=utf-8
39
+ Etag:
40
+ - '"29a332b9c56931be8b665c71c76164f8"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ Set-Cookie:
44
+ - request_method=POST; path=/
45
+ X-Request-Id:
46
+ - aa1a198c-8128-4be7-a69a-6bfafd673aac
47
+ X-Runtime:
48
+ - '0.387137'
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"authenticated":true}'
56
+ http_version:
57
+ recorded_at: Mon, 05 Jan 2015 01:09:52 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://account-authenticator.herokuapp.com/api/v1/accounts
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"api_key":"124ecd49-07fd-4553-a5cd-0178b7fa8b3f","api_password":"IIoclO7kmQqJ1wixWrAuOA","account":{"username":"new_username","password":"new_password"}}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '154'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Date:
28
+ - Sun, 04 Jan 2015 20:36:27 GMT
29
+ Connection:
30
+ - keep-alive
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Xss-Protection:
34
+ - 1; mode=block
35
+ X-Content-Type-Options:
36
+ - nosniff
37
+ Content-Type:
38
+ - application/json; charset=utf-8
39
+ Etag:
40
+ - '"f26adbb79ceaf5aaa609ed1819b600b6"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ Set-Cookie:
44
+ - request_method=POST; path=/
45
+ X-Request-Id:
46
+ - b554584e-ac2f-45ee-859e-d89f414c7aed
47
+ X-Runtime:
48
+ - '0.201978'
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"id":6,"username":"new_username","created_at":"2015-01-04T20:36:28.339Z","updated_at":"2015-01-04T20:36:28.339Z"}'
56
+ http_version:
57
+ recorded_at: Sun, 04 Jan 2015 20:36:28 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,109 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://account-authenticator.herokuapp.com/api/v1/accounts
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"api_key":"124ecd49-07fd-4553-a5cd-0178b7fa8b3f","api_password":"IIoclO7kmQqJ1wixWrAuOA","account":{"username":"new_username_2","password":"new_password_2"}}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '158'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Date:
28
+ - Sun, 04 Jan 2015 20:48:55 GMT
29
+ Connection:
30
+ - keep-alive
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Xss-Protection:
34
+ - 1; mode=block
35
+ X-Content-Type-Options:
36
+ - nosniff
37
+ Content-Type:
38
+ - application/json; charset=utf-8
39
+ Etag:
40
+ - '"03258793b9ebad43ea73e9565d861f80"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ Set-Cookie:
44
+ - request_method=POST; path=/
45
+ X-Request-Id:
46
+ - a764b58c-eda2-4770-9ef3-87fb2bf7854c
47
+ X-Runtime:
48
+ - '0.201380'
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"id":10,"username":"new_username_2","created_at":"2015-01-04T20:48:55.695Z","updated_at":"2015-01-04T20:48:55.695Z"}'
56
+ http_version:
57
+ recorded_at: Sun, 04 Jan 2015 20:48:55 GMT
58
+ - request:
59
+ method: delete
60
+ uri: http://account-authenticator.herokuapp.com/api/v1/accounts/10?api_key=124ecd49-07fd-4553-a5cd-0178b7fa8b3f&api_password=IIoclO7kmQqJ1wixWrAuOA
61
+ body:
62
+ encoding: US-ASCII
63
+ string: ''
64
+ headers:
65
+ Accept:
66
+ - "*/*; q=0.5, application/xml"
67
+ Accept-Encoding:
68
+ - gzip, deflate
69
+ User-Agent:
70
+ - Ruby
71
+ response:
72
+ status:
73
+ code: 200
74
+ message: OK
75
+ headers:
76
+ Server:
77
+ - Cowboy
78
+ Date:
79
+ - Sun, 04 Jan 2015 20:48:55 GMT
80
+ Connection:
81
+ - keep-alive
82
+ X-Frame-Options:
83
+ - SAMEORIGIN
84
+ X-Xss-Protection:
85
+ - 1; mode=block
86
+ X-Content-Type-Options:
87
+ - nosniff
88
+ Content-Type:
89
+ - application/json; charset=utf-8
90
+ Etag:
91
+ - '"db2883d5f032d326e56b7f4d896e51e9"'
92
+ Cache-Control:
93
+ - max-age=0, private, must-revalidate
94
+ Set-Cookie:
95
+ - request_method=DELETE; path=/
96
+ X-Request-Id:
97
+ - a4863ea3-30e9-48b1-91c9-628a1b10a858
98
+ X-Runtime:
99
+ - '0.119341'
100
+ Transfer-Encoding:
101
+ - chunked
102
+ Via:
103
+ - 1.1 vegur
104
+ body:
105
+ encoding: UTF-8
106
+ string: '{"id":10}'
107
+ http_version:
108
+ recorded_at: Sun, 04 Jan 2015 20:48:55 GMT
109
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://account-authenticator.herokuapp.com/api/v1/accounts/6?api_key=124ecd49-07fd-4553-a5cd-0178b7fa8b3f&api_password=IIoclO7kmQqJ1wixWrAuOA
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - Cowboy
23
+ Date:
24
+ - Sun, 04 Jan 2015 20:37:35 GMT
25
+ Connection:
26
+ - keep-alive
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - '"f26adbb79ceaf5aaa609ed1819b600b6"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 31c54ba5-3226-4433-9950-ddd9fadc1c64
41
+ X-Runtime:
42
+ - '0.105063'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ Via:
46
+ - 1.1 vegur
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"id":6,"username":"new_username","created_at":"2015-01-04T20:36:28.339Z","updated_at":"2015-01-04T20:36:28.339Z"}'
50
+ http_version:
51
+ recorded_at: Sun, 04 Jan 2015 20:37:35 GMT
52
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,113 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://account-authenticator.herokuapp.com/api/v1/accounts
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"api_key":"124ecd49-07fd-4553-a5cd-0178b7fa8b3f","api_password":"IIoclO7kmQqJ1wixWrAuOA","account":{"username":"new_username_1","password":"new_password_1"}}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '158'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Date:
28
+ - Sun, 04 Jan 2015 20:36:28 GMT
29
+ Connection:
30
+ - keep-alive
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Xss-Protection:
34
+ - 1; mode=block
35
+ X-Content-Type-Options:
36
+ - nosniff
37
+ Content-Type:
38
+ - application/json; charset=utf-8
39
+ Etag:
40
+ - '"f21a93c307ee794341d6e751a83b5c44"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ Set-Cookie:
44
+ - request_method=POST; path=/
45
+ X-Request-Id:
46
+ - 60e75ec5-53eb-4552-8e86-29f2271351ee
47
+ X-Runtime:
48
+ - '0.199750'
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"id":7,"username":"new_username_1","created_at":"2015-01-04T20:36:28.949Z","updated_at":"2015-01-04T20:36:28.949Z"}'
56
+ http_version:
57
+ recorded_at: Sun, 04 Jan 2015 20:36:28 GMT
58
+ - request:
59
+ method: put
60
+ uri: http://account-authenticator.herokuapp.com/api/v1/accounts/7
61
+ body:
62
+ encoding: UTF-8
63
+ string: '{"api_key":"124ecd49-07fd-4553-a5cd-0178b7fa8b3f","api_password":"IIoclO7kmQqJ1wixWrAuOA","account":{"username":"updated_username","password":"updated_password"}}'
64
+ headers:
65
+ Accept:
66
+ - application/json
67
+ Accept-Encoding:
68
+ - gzip, deflate
69
+ Content-Type:
70
+ - application/json
71
+ Content-Length:
72
+ - '162'
73
+ User-Agent:
74
+ - Ruby
75
+ response:
76
+ status:
77
+ code: 200
78
+ message: OK
79
+ headers:
80
+ Server:
81
+ - Cowboy
82
+ Date:
83
+ - Sun, 04 Jan 2015 20:36:28 GMT
84
+ Connection:
85
+ - keep-alive
86
+ X-Frame-Options:
87
+ - SAMEORIGIN
88
+ X-Xss-Protection:
89
+ - 1; mode=block
90
+ X-Content-Type-Options:
91
+ - nosniff
92
+ Content-Type:
93
+ - application/json; charset=utf-8
94
+ Etag:
95
+ - '"80904310aa88a944d24696f6d4c81fa1"'
96
+ Cache-Control:
97
+ - max-age=0, private, must-revalidate
98
+ Set-Cookie:
99
+ - request_method=PUT; path=/
100
+ X-Request-Id:
101
+ - c82ee34e-2392-4999-a65b-e646f09a8495
102
+ X-Runtime:
103
+ - '0.253034'
104
+ Transfer-Encoding:
105
+ - chunked
106
+ Via:
107
+ - 1.1 vegur
108
+ body:
109
+ encoding: UTF-8
110
+ string: '{"id":7,"username":"updated_username","created_at":"2015-01-04T20:36:28.949Z","updated_at":"2015-01-04T20:36:29.353Z"}'
111
+ http_version:
112
+ recorded_at: Sun, 04 Jan 2015 20:36:29 GMT
113
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,6 @@
1
+ require 'authenticator/client'
2
+ require 'vcr'
3
+
4
+ class SpecHelper
5
+ end
6
+
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: authenticator-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - johnmcconnell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.7.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.7.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-collection_matchers
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: This is a rest client for account authenticator.
112
+ email:
113
+ - johnnyillinois@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - Gemfile
120
+ - LICENSE.txt
121
+ - README.md
122
+ - Rakefile
123
+ - authenticator-client.gemspec
124
+ - lib/authenticator/client.rb
125
+ - lib/authenticator/client/account.rb
126
+ - lib/authenticator/client/base.rb
127
+ - lib/authenticator/client/version.rb
128
+ - spec/authenticator/client/base_spec.rb
129
+ - spec/authenticator/client_spec.rb
130
+ - spec/fixtures/vcr_cassettes/all_success.yml
131
+ - spec/fixtures/vcr_cassettes/authenticate_success.yml
132
+ - spec/fixtures/vcr_cassettes/create_success.yml
133
+ - spec/fixtures/vcr_cassettes/destroy_success.yml
134
+ - spec/fixtures/vcr_cassettes/show_success.yml
135
+ - spec/fixtures/vcr_cassettes/update_success.yml
136
+ - spec/spec_helper.rb
137
+ homepage: https://github.com/johnmcconnell/authenticator-client
138
+ licenses:
139
+ - MIT
140
+ metadata: {}
141
+ post_install_message:
142
+ rdoc_options: []
143
+ require_paths:
144
+ - lib
145
+ required_ruby_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ requirements: []
156
+ rubyforge_project:
157
+ rubygems_version: 2.2.2
158
+ signing_key:
159
+ specification_version: 4
160
+ summary: This is a rest client for account authenticator.
161
+ test_files:
162
+ - spec/authenticator/client/base_spec.rb
163
+ - spec/authenticator/client_spec.rb
164
+ - spec/fixtures/vcr_cassettes/all_success.yml
165
+ - spec/fixtures/vcr_cassettes/authenticate_success.yml
166
+ - spec/fixtures/vcr_cassettes/create_success.yml
167
+ - spec/fixtures/vcr_cassettes/destroy_success.yml
168
+ - spec/fixtures/vcr_cassettes/show_success.yml
169
+ - spec/fixtures/vcr_cassettes/update_success.yml
170
+ - spec/spec_helper.rb