subscriptor_client 0.0.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 (30) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.travis.yml +22 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +31 -0
  7. data/Rakefile +6 -0
  8. data/lib/subscriptor_client/base.rb +17 -0
  9. data/lib/subscriptor_client/entities_client.rb +59 -0
  10. data/lib/subscriptor_client/subscriptions_client.rb +56 -0
  11. data/lib/subscriptor_client/version.rb +3 -0
  12. data/lib/subscriptor_client.rb +27 -0
  13. data/spec/fixtures/vcr_cassettes/add_credits_success.yml +58 -0
  14. data/spec/fixtures/vcr_cassettes/create_success.yml +58 -0
  15. data/spec/fixtures/vcr_cassettes/destroy_success.yml +54 -0
  16. data/spec/fixtures/vcr_cassettes/index_success.yml +52 -0
  17. data/spec/fixtures/vcr_cassettes/show_success.yml +52 -0
  18. data/spec/fixtures/vcr_cassettes/subscriptions/add_credits_success.yml +58 -0
  19. data/spec/fixtures/vcr_cassettes/subscriptions/create_success.yml +58 -0
  20. data/spec/fixtures/vcr_cassettes/subscriptions/destroy_success.yml +54 -0
  21. data/spec/fixtures/vcr_cassettes/subscriptions/index_success.yml +52 -0
  22. data/spec/fixtures/vcr_cassettes/subscriptions/remove_credits_success.yml +58 -0
  23. data/spec/fixtures/vcr_cassettes/subscriptions/show_success.yml +52 -0
  24. data/spec/fixtures/vcr_cassettes/subscriptions/update_success.yml +58 -0
  25. data/spec/spec_helper.rb +14 -0
  26. data/spec/subscriptor_client/base_spec.rb +13 -0
  27. data/spec/subscriptor_client/entities_client_spec.rb +74 -0
  28. data/spec/subscriptor_client/subscriptions_client_spec.rb +106 -0
  29. data/subscriptor_client.gemspec +33 -0
  30. metadata +228 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e1adea3712b3b1607d9d298e85a4d1e5b2050f29
4
+ data.tar.gz: cef4c9fbb2d5820b2cf6329ef44e9c3a9c68f975
5
+ SHA512:
6
+ metadata.gz: 6edd814a24dc8236b4d786e5fa9886b83edec87add2b5bd11173f51a7d3f2dec537d93581e69ebd283b01c27a6ff203b1358d4b23bcde68381f553475d3cc1f3
7
+ data.tar.gz: b87cffdbba05d6300a5851f23259a8af58526742fcb3bac513168e7a394b6faca173875bf8098d360a462f32b7899e80c21d145afe74628c991cdb650e8d5df9
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/.travis.yml ADDED
@@ -0,0 +1,22 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.1.0
5
+
6
+ gemfile:
7
+ - Gemfile
8
+
9
+ cache: bundler
10
+
11
+ env:
12
+ matrix:
13
+ - TEST_SUITE="spec"
14
+
15
+
16
+ before_script: "bundle update"
17
+
18
+ script:
19
+ - bundle exec rake $TEST_SUITE
20
+
21
+ notifications:
22
+ email: false
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in subscriptor_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
+ # SubscriptorClient
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 'subscriptor_client'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install subscriptor_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]/subscriptor_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,17 @@
1
+ require 'attr_init'
2
+ require 'subscriptor_client/entities_client'
3
+ require 'subscriptor_client/subscriptions_client'
4
+
5
+ module SubscriptorClient
6
+ class Base
7
+ reader_struct :config
8
+
9
+ def entities
10
+ @entities ||= EntitiesClient.new(config)
11
+ end
12
+
13
+ def subscriptions
14
+ @subscriptions ||= SubscriptionsClient.new(config)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,59 @@
1
+ require 'rest_client'
2
+ require 'json_client'
3
+
4
+ module SubscriptorClient
5
+ class EntitiesClient < JsonClient::Base
6
+ requests do |r|
7
+ r.on :index, use: JsonClient::BaseRequests::Index.new
8
+ r.on :show, use: JsonClient::BaseRequests::Show.new
9
+ r.on :create, use: JsonClient::BaseRequests::Create.new
10
+ r.on :destroy, use: JsonClient::BaseRequests::Destroy.new
11
+ r.on :update, :add_credits, :remove_credits,
12
+ use: JsonClient::BaseRequests::Update.new
13
+ end
14
+
15
+ responses do |r|
16
+ r.on :index, use: JsonClient::BaseResponses::Index
17
+ r.on :show, use: JsonClient::BaseResponses::Show
18
+ r.on :create, use: JsonClient::BaseResponses::Create
19
+ r.on :destroy, use: JsonClient::BaseResponses::Destroy
20
+ r.on :update, :add_credits, :remove_credits,
21
+ use: JsonClient::BaseResponses::Update
22
+ end
23
+
24
+ serializers do |r|
25
+ r.on :create, :update, :destroy, :add_credits, :remove_credits,
26
+ use: JsonClient::ModelSerializer.new(model_name: 'entity')
27
+ r.on :index, :show,
28
+ use: JsonClient::EmptySerializer.new
29
+ end
30
+
31
+ def initialize(config)
32
+ super(
33
+ JsonClient::Pather.new(config[:host], 'api/v1', 'entities'),
34
+ config
35
+ )
36
+ end
37
+
38
+ def create
39
+ super({})
40
+ end
41
+
42
+ def update(*args)
43
+ method_missing(:update, *args)
44
+ end
45
+
46
+ def add_credits(id, params)
47
+ request = requests.add_credits
48
+ params = serializers.add_credits.serialize(params)
49
+ path = extended_path('add_credits', id)
50
+ responses.add_credits.new(fetch(path, request, params))
51
+ end
52
+
53
+ protected
54
+
55
+ def extended_path(ext, id = nil)
56
+ "#{pather.path(id)}/#{ext}"
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,56 @@
1
+ require 'rest_client'
2
+ require 'json_client'
3
+
4
+ module SubscriptorClient
5
+ class SubscriptionsClient < JsonClient::Base
6
+ requests do |r|
7
+ r.on :index, use: JsonClient::BaseRequests::Index.new
8
+ r.on :show, use: JsonClient::BaseRequests::Show.new
9
+ r.on :create, use: JsonClient::BaseRequests::Create.new
10
+ r.on :destroy, use: JsonClient::BaseRequests::Destroy.new
11
+ r.on :update, :add_credits, :remove_credits,
12
+ use: JsonClient::BaseRequests::Update.new
13
+ end
14
+
15
+ responses do |r|
16
+ r.on :index, use: JsonClient::BaseResponses::Index
17
+ r.on :show, use: JsonClient::BaseResponses::Show
18
+ r.on :create, use: JsonClient::BaseResponses::Create
19
+ r.on :destroy, use: JsonClient::BaseResponses::Destroy
20
+ r.on :update, :add_credits, :remove_credits,
21
+ use: JsonClient::BaseResponses::Update
22
+ end
23
+
24
+ serializers do |r|
25
+ r.on :create, :update, :destroy, :add_credits, :remove_credits,
26
+ use: JsonClient::ModelSerializer.new(model_name: 'subscription')
27
+ r.on :index, :show,
28
+ use: JsonClient::EmptySerializer.new
29
+ end
30
+
31
+ def initialize(config)
32
+ super(
33
+ JsonClient::Pather.new(config[:host], 'api/v1', 'subscriptions'),
34
+ config
35
+ )
36
+ end
37
+
38
+ def add_credits(id, params)
39
+ request = requests.add_credits
40
+ path = extended_path('add_credits', id)
41
+ responses.add_credits.new(fetch(path, request, params))
42
+ end
43
+
44
+ def remove_credits(id, params)
45
+ request = requests.add_credits
46
+ path = extended_path('remove_credits', id)
47
+ responses.add_credits.new(fetch(path, request, params))
48
+ end
49
+
50
+ protected
51
+
52
+ def extended_path(ext, id = nil)
53
+ "#{pather.path(id)}/#{ext}"
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,3 @@
1
+ module SubscriptorClient
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,27 @@
1
+ require 'subscriptor_client/version'
2
+ require 'subscriptor_client/base'
3
+
4
+ module SubscriptorClient
5
+ @@configs = {}
6
+ @@stubbed_params = nil
7
+
8
+ def self.register_config(key, config)
9
+ @@configs[key] = config
10
+ end
11
+
12
+ def self.new(key)
13
+ Base.new(config: @@configs[key])
14
+ end
15
+
16
+ def self.configs
17
+ @@configs
18
+ end
19
+
20
+ def self.reset!
21
+ @@stubbed_params = nil
22
+ end
23
+
24
+ def self.authenticate_with!(account)
25
+ @@stubbed_params = account
26
+ end
27
+ end
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://subscriptor.herokuapp.com/api/v1/entities/4/add_credits
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"api_key":"5","api_password":"subscriptor_test","entity":{"credits":2}}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '72'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Date:
28
+ - Sat, 17 Jan 2015 22:43:08 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
+ - '"07bd9151e9714570773fce1cb33341fb"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ Set-Cookie:
44
+ - request_method=PUT; path=/
45
+ X-Request-Id:
46
+ - 1e87e951-fecb-4bc3-9e1e-3ccbfe36fb63
47
+ X-Runtime:
48
+ - '0.236504'
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"id":4,"created_at":"2015-01-17T21:10:30.754Z","updated_at":"2015-01-17T21:32:00.848Z","credits_remaining":4,"active_subscription":{"id":2,"credits":4,"created_at":"2015-01-17T22:28:06.375Z","updated_at":"2015-01-17T22:43:08.831Z","credits_remaining":4}}'
56
+ http_version:
57
+ recorded_at: Sat, 17 Jan 2015 22:43:08 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://subscriptor.herokuapp.com/api/v1/entities
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"api_key":"5","api_password":"subscriptor_test"}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '49'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Date:
28
+ - Sat, 17 Jan 2015 20:44:52 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
+ - '"41cadc342904ee90437b55db099b7505"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ Set-Cookie:
44
+ - request_method=POST; path=/
45
+ X-Request-Id:
46
+ - 425b47ea-b9fd-4477-98de-d2b6439a5d81
47
+ X-Runtime:
48
+ - '0.426457'
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"id":1,"created_at":"2015-01-17T20:44:53.735Z","updated_at":"2015-01-17T20:44:53.735Z","credits_remaining":null}'
56
+ http_version:
57
+ recorded_at: Sat, 17 Jan 2015 20:44:54 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: http://subscriptor.herokuapp.com/api/v1/entities/1?api_key=5&api_password=subscriptor_test
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
+ - Sat, 17 Jan 2015 20:45:39 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
+ - '"d2ce28b9a7fd7e4407e2b0fd499b7fe4"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ Set-Cookie:
40
+ - request_method=DELETE; path=/
41
+ X-Request-Id:
42
+ - b5b42733-f8bf-42ec-9905-184935818b49
43
+ X-Runtime:
44
+ - '0.231555'
45
+ Transfer-Encoding:
46
+ - chunked
47
+ Via:
48
+ - 1.1 vegur
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"id":1}'
52
+ http_version:
53
+ recorded_at: Sat, 17 Jan 2015 20:45:40 GMT
54
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://subscriptor.herokuapp.com/api/v1/entities?api_key=5&api_password=subscriptor_test
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
+ - Sat, 17 Jan 2015 20:44:01 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
+ - '"273408ef8356de20281376a3f2305dff"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 21460d3a-4e23-44e3-84ec-5a4a2ea4929d
41
+ X-Runtime:
42
+ - '0.222761'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ Via:
46
+ - 1.1 vegur
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"entities":[]}'
50
+ http_version:
51
+ recorded_at: Sat, 17 Jan 2015 20:44:02 GMT
52
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://subscriptor.herokuapp.com/api/v1/entities/1?api_key=5&api_password=subscriptor_test
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
+ - Sat, 17 Jan 2015 20:45:38 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
+ - '"41cadc342904ee90437b55db099b7505"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 38444fe2-7051-4e42-835e-871c8ff507c6
41
+ X-Runtime:
42
+ - '0.238753'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ Via:
46
+ - 1.1 vegur
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"id":1,"created_at":"2015-01-17T20:44:53.735Z","updated_at":"2015-01-17T20:44:53.735Z","credits_remaining":null}'
50
+ http_version:
51
+ recorded_at: Sat, 17 Jan 2015 20:45:40 GMT
52
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://subscriptor.herokuapp.com/api/v1/subscriptions/2/add_credits
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"api_key":"5","api_password":"subscriptor_test","credits":2}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '61'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Date:
28
+ - Sat, 17 Jan 2015 22:30:37 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
+ - '"bc14f1553ae497fee5e8e9f7415014b2"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ Set-Cookie:
44
+ - request_method=PUT; path=/
45
+ X-Request-Id:
46
+ - cd819a7e-e081-43a9-b005-13eccaf601b9
47
+ X-Runtime:
48
+ - '0.248465'
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"credits_remaining":4,"id":2,"entity_id":4,"credits":4,"created_at":"2015-01-17T22:28:06.375Z","updated_at":"2015-01-17T22:30:38.490Z"}'
56
+ http_version:
57
+ recorded_at: Sat, 17 Jan 2015 22:30:38 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://subscriptor.herokuapp.com/api/v1/subscriptions
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"api_key":"5","api_password":"subscriptor_test","credits":0,"entity_id":4}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '75'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Date:
28
+ - Sat, 17 Jan 2015 21:32:45 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
+ - '"33409e3edade6c26ff08594d783f276a"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ Set-Cookie:
44
+ - request_method=POST; path=/
45
+ X-Request-Id:
46
+ - e64285f0-4f57-47e6-b46f-68c8894ae36e
47
+ X-Runtime:
48
+ - '0.335263'
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"credits_remaining":0,"id":1,"entity_id":4,"credits":0,"created_at":"2015-01-17T21:32:45.445Z","updated_at":"2015-01-17T21:32:45.445Z"}'
56
+ http_version:
57
+ recorded_at: Sat, 17 Jan 2015 21:32:45 GMT
58
+ recorded_with: VCR 2.9.3