gro_social 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +73 -0
- data/Rakefile +7 -0
- data/gro_social.gemspec +31 -0
- data/lib/gro_social/client.rb +66 -0
- data/lib/gro_social/user.rb +15 -0
- data/lib/gro_social/users.rb +15 -0
- data/lib/gro_social/version.rb +3 -0
- data/lib/gro_social.rb +11 -0
- data/spec/gro_social/client_spec.rb +147 -0
- data/spec/gro_social/user_spec.rb +64 -0
- data/spec/gro_social/users_spec.rb +35 -0
- data/spec/gro_social_spec.rb +7 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/vcr_helper.rb +12 -0
- data/vcr_cassettes/.keep +0 -0
- data/vcr_cassettes/GroSocial_Client/_request/with_invalid_credentials/raises_an_error.yml +39 -0
- data/vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_a_single_User/does_not_raise_an_error.yml +40 -0
- data/vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_a_single_User/returns_a_parsed_JSON_response.yml +40 -0
- data/vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_all_Users/does_not_raise_an_error.yml +56 -0
- data/vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_all_Users/returns_a_parsed_JSON_response.yml +56 -0
- data/vcr_cassettes/GroSocial_Users/_/returns_a_GroSocial_User_when_one_exists.yml +40 -0
- data/vcr_cassettes/GroSocial_Users/_/returns_nil_when_a_User_does_not_exist.yml +39 -0
- metadata +213 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1b578a59a7d7c43b325f7044b7627907812a3c50
|
4
|
+
data.tar.gz: 6e63949a4e84d4524c1b22e45408d8b8f774a90f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7243e7cd5067cb31eeb8e7cc85d1ef3bdf13ae9304bc21cf80b3094d02d418fec2df7df7ca2c62c707563dd31214e911d587b1b4c3d765a76ef5789a16aac4b6
|
7
|
+
data.tar.gz: 7cba85e96c4bfd8214cb2cf5fb7df5f5e47c4e50c0e79a2e94ad1db003a4f9bd119b1a5ac6924016f35934c59703acd7d99898f09964e025e879f305ba36c04c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gro_social
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.2.0
|
data/.travis.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
rvm:
|
4
|
+
- 2.2.0
|
5
|
+
- 2.1.5
|
6
|
+
- 2.1.4
|
7
|
+
- 2.1.3
|
8
|
+
- 2.0.0
|
9
|
+
- 1.9.3
|
10
|
+
env:
|
11
|
+
- GROSOCIAL_KEY=fake GROSOCIAL_PASSWORD=secret
|
12
|
+
addons:
|
13
|
+
code_climate:
|
14
|
+
repo_token: 0b330b04e7f7154dd0989cea7a6b8e9e251e47bdf6a01d7276b6f5fd1e7fe905
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 James Thompson
|
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,73 @@
|
|
1
|
+
# GroSocial
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/github/BaseCampOps/gro_social/badges/gpa.svg)](https://codeclimate.com/github/BaseCampOps/gro_social)
|
4
|
+
[![Test Coverage](https://codeclimate.com/github/BaseCampOps/gro_social/badges/coverage.svg)](https://codeclimate.com/github/BaseCampOps/gro_social)
|
5
|
+
[![Build Status](https://travis-ci.org/BaseCampOps/gro_social.svg)](https://travis-ci.org/BaseCampOps/gro_social)
|
6
|
+
|
7
|
+
The gro_social gem provides a Ruby interface to the [GroSocial REST API](https://api.grosocial.com/documentation).
|
8
|
+
The gem is intended to be lightweight with simple wrappers around the exposed
|
9
|
+
resources.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'gro_social'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install gro_social
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
First you need to set your API credentials with the GroSocial::Client.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
GroSocial::Client.api_key = 'YOUR_KEY'
|
33
|
+
GroSocial::Client.api_password = 'SECRET'
|
34
|
+
```
|
35
|
+
|
36
|
+
You can enable test mode for the client in a similar fashion.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
GroSocial::Client.test_mode = true
|
40
|
+
```
|
41
|
+
|
42
|
+
Once these configuration options are set appropriately you are ready to simply
|
43
|
+
interact with the supported resources.
|
44
|
+
|
45
|
+
### Users
|
46
|
+
|
47
|
+
There are two classes that you will work with in regards to users:
|
48
|
+
`GroSocial::Users` and `GroSocial::User`. `GroSocial::Users` represents the
|
49
|
+
class you will use to locate specific users or iterate over them.
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
user = GroSocial::Users[1234] # GroSocial::User
|
53
|
+
|
54
|
+
user.id # '1234'
|
55
|
+
user.firstname # 'John'
|
56
|
+
user.lastname # 'Doe'
|
57
|
+
```
|
58
|
+
|
59
|
+
### Subscriptions
|
60
|
+
|
61
|
+
TODO: Document the GroSocial::Subscription API
|
62
|
+
|
63
|
+
### Future-Proofing
|
64
|
+
|
65
|
+
TODO: Document how to access resources directly via GroSocial::Client.request
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
1. Fork it ( https://github.com/[my-github-username]/gro_social/fork )
|
70
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
71
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
72
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/gro_social.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gro_social/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'gro_social'
|
8
|
+
spec.version = GroSocial::VERSION
|
9
|
+
spec.authors = ['James Thompson']
|
10
|
+
spec.email = %w{james@buypd.com}
|
11
|
+
spec.summary = %q{Ruby client for GroSocial's REST API}
|
12
|
+
spec.description = %q{A simple Ruby client for GroSocial's REST API}
|
13
|
+
spec.homepage = 'https://github.com/BaseCampOps/gro_social'
|
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|vcr_cassettes)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'json', '~> 1.8.0'
|
22
|
+
spec.add_dependency 'typhoeus', '~> 0.7.0'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec'
|
27
|
+
spec.add_development_dependency 'simplecov'
|
28
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
29
|
+
spec.add_development_dependency 'vcr', '~> 2.9.3'
|
30
|
+
spec.add_development_dependency 'webmock'
|
31
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
require 'typhoeus'
|
3
|
+
|
4
|
+
module GroSocial
|
5
|
+
class Client
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
def self.api_key=(key)
|
9
|
+
self.instance.instance_variable_set(:@api_key, key.to_s)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.api_key
|
13
|
+
self.instance.instance_variable_get(:@api_key)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.api_password=(password)
|
17
|
+
self.instance.instance_variable_set(:@api_password, password.to_s)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.api_password
|
21
|
+
self.instance.instance_variable_get(:@api_password)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.api_url
|
25
|
+
test_mode ? 'https://apidev.grosocial.com' : 'https://api.grosocial.com'
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.request(resource_name, http_verb, options = {})
|
29
|
+
url = build_resource_url(resource_name, options)
|
30
|
+
response = Typhoeus.send(http_verb.to_s.downcase.to_sym, url, options_for_typhoeus(options[:typhoeus]))
|
31
|
+
parsed_results = JSON.parse(response.response_body)
|
32
|
+
raise RuntimeError, 'GroSocial credentials not accepted' if parsed_results['result']['http_status']['code'] == 401
|
33
|
+
parsed_results
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.test_mode=(value)
|
37
|
+
self.instance.instance_variable_set(:@test_mode, (value ? true : false))
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.test_mode
|
41
|
+
self.instance.instance_variable_get(:@test_mode)
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def self.build_resource_url(resource_name, options)
|
47
|
+
url = "#{api_url}/#{resource_name.downcase}"
|
48
|
+
url += "/#{options[:id]}" if options[:id]
|
49
|
+
|
50
|
+
url += "?key=#{api_key}&p=#{api_password}"
|
51
|
+
|
52
|
+
# unless options[:query_params].nil?
|
53
|
+
# options[:query_params].each do |query_param, value|
|
54
|
+
# url += "&#{query_param}=#{value}"
|
55
|
+
# end
|
56
|
+
# end
|
57
|
+
|
58
|
+
url
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.options_for_typhoeus(options = {})
|
62
|
+
options = {} if options.nil?
|
63
|
+
{}.merge(options)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module GroSocial
|
2
|
+
class User
|
3
|
+
attr_accessor :id, :firstname, :lastname, :email, :phone, :created, :custom1, :custom2, :custom3, :alertmessage
|
4
|
+
|
5
|
+
def initialize(attributes = {})
|
6
|
+
attributes.each do |attr_name, value|
|
7
|
+
begin
|
8
|
+
self.send(:"#{attr_name}=", value)
|
9
|
+
rescue NoMethodError
|
10
|
+
next
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module GroSocial
|
2
|
+
class Users
|
3
|
+
include Enumerable
|
4
|
+
|
5
|
+
def self.[](id)
|
6
|
+
result = GroSocial::Client.request('Users', :get, {id: id.to_s})
|
7
|
+
return nil if result['result']['user'].nil?
|
8
|
+
GroSocial::User.new(result['result']['user'])
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.each(&block)
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/gro_social.rb
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vcr_helper'
|
3
|
+
|
4
|
+
RSpec.describe GroSocial::Client do
|
5
|
+
before(:each) { Singleton.__init__(GroSocial::Client) }
|
6
|
+
|
7
|
+
describe '.api_key' do
|
8
|
+
it 'responds' do
|
9
|
+
expect(GroSocial::Client).to respond_to(:api_key)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '.api_key=' do
|
14
|
+
it 'responds' do
|
15
|
+
expect(GroSocial::Client).to respond_to(:api_key=)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'sets api_key value' do
|
19
|
+
GroSocial::Client.api_key = 'secret'
|
20
|
+
expect(GroSocial::Client.api_key).to eq('secret')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.api_password' do
|
25
|
+
it 'responds' do
|
26
|
+
expect(GroSocial::Client).to respond_to(:api_password)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '.api_password=' do
|
31
|
+
it 'responds' do
|
32
|
+
expect(GroSocial::Client).to respond_to(:api_password=)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'sets api_password value' do
|
36
|
+
GroSocial::Client.api_password = 'secret'
|
37
|
+
expect(GroSocial::Client.api_password).to eq('secret')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '.request' do
|
42
|
+
it 'responds' do
|
43
|
+
expect(GroSocial::Client).to respond_to(:request)
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'with invalid credentials' do
|
47
|
+
before(:each) do
|
48
|
+
GroSocial::Client.test_mode = true
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'raises an error', :vcr do
|
52
|
+
expect {
|
53
|
+
GroSocial::Client.request('Users', :get)
|
54
|
+
}.to raise_error(RuntimeError, 'GroSocial credentials not accepted')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'with options to GET all Users' do
|
59
|
+
before(:each) do
|
60
|
+
GroSocial::Client.test_mode = true
|
61
|
+
GroSocial::Client.api_key = ENV['GROSOCIAL_KEY']
|
62
|
+
GroSocial::Client.api_password = ENV['GROSOCIAL_PASSWORD']
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'does not raise an error', :vcr do
|
66
|
+
expect {
|
67
|
+
GroSocial::Client.request('Users', :get)
|
68
|
+
}.to_not raise_error
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'returns a parsed JSON response', :vcr do
|
72
|
+
result = GroSocial::Client.request('Users', :get)
|
73
|
+
expect(result).to be_a(Hash)
|
74
|
+
expect(result['result']).to_not be_nil
|
75
|
+
expect(result['result']['users']).to_not be_nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'with options to GET a single User' do
|
80
|
+
before(:each) do
|
81
|
+
GroSocial::Client.test_mode = true
|
82
|
+
GroSocial::Client.api_key = ENV['GROSOCIAL_KEY']
|
83
|
+
GroSocial::Client.api_password = ENV['GROSOCIAL_PASSWORD']
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'does not raise an error', :vcr do
|
87
|
+
expect {
|
88
|
+
GroSocial::Client.request('Users', :get, {id: '20183'})
|
89
|
+
}.to_not raise_error
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'returns a parsed JSON response', :vcr do
|
93
|
+
result = GroSocial::Client.request('Users', :get, {id: '20183'})
|
94
|
+
expect(result).to be_a(Hash)
|
95
|
+
expect(result['result']).to_not be_nil
|
96
|
+
expect(result['result']['user']).to_not be_nil
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe '.api_url' do
|
102
|
+
it 'responds' do
|
103
|
+
expect(GroSocial::Client).to respond_to(:api_url)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe '.test_mode=' do
|
108
|
+
it 'responds' do
|
109
|
+
expect(GroSocial::Client).to respond_to(:test_mode=)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'sets test_mode value' do
|
113
|
+
GroSocial::Client.test_mode = true
|
114
|
+
expect(GroSocial::Client.test_mode).to be_truthy
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe '.test_mode' do
|
119
|
+
it 'responds' do
|
120
|
+
expect(GroSocial::Client).to respond_to(:test_mode)
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'defaults to false' do
|
124
|
+
expect(GroSocial::Client.test_mode).to be_falsey
|
125
|
+
end
|
126
|
+
|
127
|
+
context 'when set to true' do
|
128
|
+
before(:each) do
|
129
|
+
GroSocial::Client.test_mode = true
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'causes .api_url to return \'https://apidev.grosocial.com\'' do
|
133
|
+
expect(GroSocial::Client.api_url).to eq('https://apidev.grosocial.com')
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context 'when set to false' do
|
138
|
+
before(:each) do
|
139
|
+
GroSocial::Client.test_mode = false
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'causes .api_url to return \'https://api.grosocial.com\'' do
|
143
|
+
expect(GroSocial::Client.api_url).to eq('https://api.grosocial.com')
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe GroSocial::User do
|
4
|
+
let(:now) { DateTime.now }
|
5
|
+
|
6
|
+
%w{id firstname lastname email phone created custom1 custom2 custom3 alertmessage}.each do |field|
|
7
|
+
it { expect(subject).to respond_to(field.to_sym) }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '.new' do
|
11
|
+
let(:subject) { GroSocial::User.new(attributes) }
|
12
|
+
|
13
|
+
context 'with valid attributes' do
|
14
|
+
let(:attributes) { {
|
15
|
+
id: '123',
|
16
|
+
firstname: 'John',
|
17
|
+
lastname: 'Doe',
|
18
|
+
email: 'jdoe@example.com',
|
19
|
+
phone: '(555) 123-4567',
|
20
|
+
created: now.to_s,
|
21
|
+
custom1: '123',
|
22
|
+
custom2: '456',
|
23
|
+
custom3: '789',
|
24
|
+
alertmessage: 'ALERT!'
|
25
|
+
} }
|
26
|
+
|
27
|
+
it 'sets attributes correctly' do
|
28
|
+
expect(subject.id).to eq('123')
|
29
|
+
expect(subject.firstname).to eq('John')
|
30
|
+
expect(subject.lastname).to eq('Doe')
|
31
|
+
expect(subject.email).to eq('jdoe@example.com')
|
32
|
+
expect(subject.phone).to eq('(555) 123-4567')
|
33
|
+
expect(subject.created).to eq(now.to_s)
|
34
|
+
expect(subject.custom1).to eq('123')
|
35
|
+
expect(subject.custom2).to eq('456')
|
36
|
+
expect(subject.custom3).to eq('789')
|
37
|
+
expect(subject.alertmessage).to eq('ALERT!')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'with unknown attributes' do
|
42
|
+
let(:attributes) { {
|
43
|
+
id: '123',
|
44
|
+
firstname: 'John',
|
45
|
+
lastname: 'Doe',
|
46
|
+
unknown: 'ALERT!',
|
47
|
+
|
48
|
+
} }
|
49
|
+
|
50
|
+
it 'sets known attributes correctly' do
|
51
|
+
expect(subject.id).to eq('123')
|
52
|
+
expect(subject.firstname).to eq('John')
|
53
|
+
expect(subject.lastname).to eq('Doe')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'ignores unknown attributes' do
|
57
|
+
expect { subject }.to_not raise_error
|
58
|
+
expect(subject.instance_variable_get(:@unknown)).to be_nil
|
59
|
+
expect(subject).to_not respond_to(:unknown)
|
60
|
+
expect(subject).to_not respond_to(:unknown=)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe GroSocial::Users do
|
4
|
+
before(:each) do
|
5
|
+
GroSocial::Client.test_mode = true
|
6
|
+
GroSocial::Client.api_key = ENV['GROSOCIAL_KEY']
|
7
|
+
GroSocial::Client.api_password = ENV['GROSOCIAL_PASSWORD']
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '.[]' do
|
11
|
+
it 'responds' do
|
12
|
+
expect(GroSocial::Users).to respond_to(:[])
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns a GroSocial::User when one exists', :vcr do
|
16
|
+
expect(GroSocial::Users['20183']).to be_a_kind_of(GroSocial::User)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'returns nil when a User does not exist', :vcr do
|
20
|
+
expect(GroSocial::Users['0']).to eq(nil)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.each' do
|
25
|
+
it 'responds' do
|
26
|
+
expect(GroSocial::Users).to respond_to(:each)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'returns GroSocial::User instances' do
|
30
|
+
# GroSocial::Users.each do |user|
|
31
|
+
# expect(user).to be_a_kind_of(GroSocial::User)
|
32
|
+
# end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
if ENV['CI']
|
2
|
+
require "codeclimate-test-reporter"
|
3
|
+
CodeClimate::TestReporter.start
|
4
|
+
else
|
5
|
+
require 'simplecov'
|
6
|
+
SimpleCov.start do
|
7
|
+
add_filter '/spec/'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
12
|
+
require 'gro_social'
|
data/spec/vcr_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
|
3
|
+
VCR.configure do |c|
|
4
|
+
c.cassette_library_dir = 'vcr_cassettes'
|
5
|
+
c.hook_into :webmock
|
6
|
+
c.allow_http_connections_when_no_cassette = true
|
7
|
+
|
8
|
+
c.configure_rspec_metadata!
|
9
|
+
|
10
|
+
c.filter_sensitive_data('<API_KEY>') { ENV['GROSOCIAL_KEY'] }
|
11
|
+
c.filter_sensitive_data('<API_PASSWORD>') { ENV['GROSOCIAL_PASSWORD'] }
|
12
|
+
end
|
data/vcr_cassettes/.keep
ADDED
File without changes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apidev.grosocial.com/users?key=&p=
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Date:
|
18
|
+
- Tue, 20 Jan 2015 23:50:13 GMT
|
19
|
+
Server:
|
20
|
+
- Apache/2.2.14 (Ubuntu)
|
21
|
+
Set-Cookie:
|
22
|
+
- CAKEPHP=cco7ia6abs512nt3vgv03ab8v0; expires=Wed, 21-Jan-2015 03:10:14 GMT;
|
23
|
+
path=/; secure
|
24
|
+
P3p:
|
25
|
+
- CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
|
26
|
+
Pragma:
|
27
|
+
- no-cache
|
28
|
+
Cache-Control:
|
29
|
+
- no-store, no-cache, max-age=0, must-revalidate
|
30
|
+
Content-Length:
|
31
|
+
- '64'
|
32
|
+
Content-Type:
|
33
|
+
- text/x-json
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: '{"result":{"http_status":{"code":401,"message":"Unauthorized"}}}'
|
37
|
+
http_version:
|
38
|
+
recorded_at: Tue, 20 Jan 2015 23:50:14 GMT
|
39
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apidev.grosocial.com/users/20183?key=<API_KEY>&p=<API_PASSWORD>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Date:
|
18
|
+
- Tue, 20 Jan 2015 23:48:04 GMT
|
19
|
+
Server:
|
20
|
+
- Apache/2.2.14 (Ubuntu)
|
21
|
+
Set-Cookie:
|
22
|
+
- CAKEPHP=e11v7c634rgvh9jfquokacf0c0; expires=Wed, 21-Jan-2015 03:08:04 GMT;
|
23
|
+
path=/; secure
|
24
|
+
P3p:
|
25
|
+
- CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
|
26
|
+
Pragma:
|
27
|
+
- no-cache
|
28
|
+
Cache-Control:
|
29
|
+
- no-store, no-cache, max-age=0, must-revalidate
|
30
|
+
Content-Length:
|
31
|
+
- '341'
|
32
|
+
Content-Type:
|
33
|
+
- text/x-json
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: '{"result":{"http_status":{"code":200,"message":"Success"},"user":{"User":{"id":"20183","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs5@myebiz.com","phone":null,"created":"2013-11-15
|
37
|
+
18:15:20","custom1":"","custom2":"","custom3":"","alertmessage":""}},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20183"}}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Tue, 20 Jan 2015 23:48:04 GMT
|
40
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apidev.grosocial.com/users/20183?key=<API_KEY>&p=<API_PASSWORD>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Date:
|
18
|
+
- Tue, 20 Jan 2015 23:48:04 GMT
|
19
|
+
Server:
|
20
|
+
- Apache/2.2.14 (Ubuntu)
|
21
|
+
Set-Cookie:
|
22
|
+
- CAKEPHP=k72bv7gmj7oeme2ehj6b3j5472; expires=Wed, 21-Jan-2015 03:08:04 GMT;
|
23
|
+
path=/; secure
|
24
|
+
P3p:
|
25
|
+
- CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
|
26
|
+
Pragma:
|
27
|
+
- no-cache
|
28
|
+
Cache-Control:
|
29
|
+
- no-store, no-cache, max-age=0, must-revalidate
|
30
|
+
Content-Length:
|
31
|
+
- '341'
|
32
|
+
Content-Type:
|
33
|
+
- text/x-json
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: '{"result":{"http_status":{"code":200,"message":"Success"},"user":{"User":{"id":"20183","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs5@myebiz.com","phone":null,"created":"2013-11-15
|
37
|
+
18:15:20","custom1":"","custom2":"","custom3":"","alertmessage":""}},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20183"}}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Tue, 20 Jan 2015 23:48:04 GMT
|
40
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apidev.grosocial.com/users?key=<API_KEY>&p=<API_PASSWORD>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Date:
|
18
|
+
- Tue, 20 Jan 2015 23:50:14 GMT
|
19
|
+
Server:
|
20
|
+
- Apache/2.2.14 (Ubuntu)
|
21
|
+
Set-Cookie:
|
22
|
+
- CAKEPHP=2vftm25jju8tuci9ijih913to0; expires=Wed, 21-Jan-2015 03:10:14 GMT;
|
23
|
+
path=/; secure
|
24
|
+
P3p:
|
25
|
+
- CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
|
26
|
+
Pragma:
|
27
|
+
- no-cache
|
28
|
+
Cache-Control:
|
29
|
+
- no-store, no-cache, max-age=0, must-revalidate
|
30
|
+
Content-Length:
|
31
|
+
- '4808'
|
32
|
+
Content-Type:
|
33
|
+
- text/x-json
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: '{"result":{"http_status":{"code":200,"message":"Success"},"users":[{"User":{"id":"20178","firstname":"Thomas","lastname":"Mebtester","email":"tpryor@myebiz.com","phone":null,"created":"2013-11-14
|
37
|
+
21:22:43","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20178"},{"User":{"id":"20180","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs2@myebiz.com","phone":null,"created":"2013-11-15
|
38
|
+
17:01:20","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20180"},{"User":{"id":"20181","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs3@myebiz.com","phone":null,"created":"2013-11-15
|
39
|
+
17:02:54","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20181"},{"User":{"id":"20182","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs4@myebiz.com","phone":null,"created":"2013-11-15
|
40
|
+
18:14:16","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20182"},{"User":{"id":"20183","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs5@myebiz.com","phone":null,"created":"2013-11-15
|
41
|
+
18:15:20","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20183"},{"User":{"id":"20185","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs6@gmail.com","phone":null,"created":"2013-11-20
|
42
|
+
20:06:54","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20185"},{"User":{"id":"20505","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+test1@gmail.com","phone":null,"created":"2014-02-27
|
43
|
+
21:58:35","custom1":"Re","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20505"},{"User":{"id":"20507","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+test2@gmail.com","phone":null,"created":"2014-02-28
|
44
|
+
16:09:54","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20507"},{"User":{"id":"20508","firstname":"Tester","lastname":"Mebtester","email":"mebtester+test3@gmail.com","phone":null,"created":"2014-02-28
|
45
|
+
16:10:25","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20508"},{"User":{"id":"20509","firstname":"Tester","lastname":"Mebtester","email":"mebtester+test4@gmail.com","phone":null,"created":"2014-02-28
|
46
|
+
16:12:29","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20509"},{"User":{"id":"20517","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+gromerge1@gmail.com","phone":null,"created":"2014-03-10
|
47
|
+
20:25:24","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20517"},{"User":{"id":"20520","firstname":"Test","lastname":"TestingSBP","email":"mebtester+SBP31014@gmail.com","phone":null,"created":"2014-03-11
|
48
|
+
15:02:28","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20520"},{"User":{"id":"20521","firstname":"SBP","lastname":"TESTING","email":"mebtester+spbtest555@gmail.com","phone":null,"created":"2014-03-11
|
49
|
+
19:02:23","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20521"},{"User":{"id":"20657","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+ipsbp1@gmail.com","phone":null,"created":"2014-10-30
|
50
|
+
02:46:45","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20657"},{"User":{"id":"20660","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+pmiprint1@gmail.com","phone":null,"created":"2014-10-31
|
51
|
+
03:15:07","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20660"},{"User":{"id":"20695","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+printmerge1@gmail.com","phone":null,"created":"2014-11-23
|
52
|
+
03:27:22","custom1":"Re","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20695"},{"User":{"id":"20708","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+sbpre10@gmail.com","phone":null,"created":"2014-12-26
|
53
|
+
13:40:13","custom1":"Re","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20708"}]}}'
|
54
|
+
http_version:
|
55
|
+
recorded_at: Tue, 20 Jan 2015 23:50:14 GMT
|
56
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apidev.grosocial.com/users?key=<API_KEY>&p=<API_PASSWORD>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Date:
|
18
|
+
- Tue, 20 Jan 2015 23:50:14 GMT
|
19
|
+
Server:
|
20
|
+
- Apache/2.2.14 (Ubuntu)
|
21
|
+
Set-Cookie:
|
22
|
+
- CAKEPHP=kvb8ejmltci7j2jtevbvrkcjk7; expires=Wed, 21-Jan-2015 03:10:14 GMT;
|
23
|
+
path=/; secure
|
24
|
+
P3p:
|
25
|
+
- CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
|
26
|
+
Pragma:
|
27
|
+
- no-cache
|
28
|
+
Cache-Control:
|
29
|
+
- no-store, no-cache, max-age=0, must-revalidate
|
30
|
+
Content-Length:
|
31
|
+
- '4808'
|
32
|
+
Content-Type:
|
33
|
+
- text/x-json
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: '{"result":{"http_status":{"code":200,"message":"Success"},"users":[{"User":{"id":"20178","firstname":"Thomas","lastname":"Mebtester","email":"tpryor@myebiz.com","phone":null,"created":"2013-11-14
|
37
|
+
21:22:43","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20178"},{"User":{"id":"20180","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs2@myebiz.com","phone":null,"created":"2013-11-15
|
38
|
+
17:01:20","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20180"},{"User":{"id":"20181","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs3@myebiz.com","phone":null,"created":"2013-11-15
|
39
|
+
17:02:54","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20181"},{"User":{"id":"20182","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs4@myebiz.com","phone":null,"created":"2013-11-15
|
40
|
+
18:14:16","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20182"},{"User":{"id":"20183","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs5@myebiz.com","phone":null,"created":"2013-11-15
|
41
|
+
18:15:20","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20183"},{"User":{"id":"20185","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs6@gmail.com","phone":null,"created":"2013-11-20
|
42
|
+
20:06:54","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20185"},{"User":{"id":"20505","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+test1@gmail.com","phone":null,"created":"2014-02-27
|
43
|
+
21:58:35","custom1":"Re","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20505"},{"User":{"id":"20507","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+test2@gmail.com","phone":null,"created":"2014-02-28
|
44
|
+
16:09:54","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20507"},{"User":{"id":"20508","firstname":"Tester","lastname":"Mebtester","email":"mebtester+test3@gmail.com","phone":null,"created":"2014-02-28
|
45
|
+
16:10:25","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20508"},{"User":{"id":"20509","firstname":"Tester","lastname":"Mebtester","email":"mebtester+test4@gmail.com","phone":null,"created":"2014-02-28
|
46
|
+
16:12:29","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20509"},{"User":{"id":"20517","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+gromerge1@gmail.com","phone":null,"created":"2014-03-10
|
47
|
+
20:25:24","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20517"},{"User":{"id":"20520","firstname":"Test","lastname":"TestingSBP","email":"mebtester+SBP31014@gmail.com","phone":null,"created":"2014-03-11
|
48
|
+
15:02:28","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20520"},{"User":{"id":"20521","firstname":"SBP","lastname":"TESTING","email":"mebtester+spbtest555@gmail.com","phone":null,"created":"2014-03-11
|
49
|
+
19:02:23","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20521"},{"User":{"id":"20657","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+ipsbp1@gmail.com","phone":null,"created":"2014-10-30
|
50
|
+
02:46:45","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20657"},{"User":{"id":"20660","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+pmiprint1@gmail.com","phone":null,"created":"2014-10-31
|
51
|
+
03:15:07","custom1":"","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20660"},{"User":{"id":"20695","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+printmerge1@gmail.com","phone":null,"created":"2014-11-23
|
52
|
+
03:27:22","custom1":"Re","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20695"},{"User":{"id":"20708","firstname":"Thomas","lastname":"Mebtester","email":"mebtester+sbpre10@gmail.com","phone":null,"created":"2014-12-26
|
53
|
+
13:40:13","custom1":"Re","custom2":"","custom3":"","alertmessage":""},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20708"}]}}'
|
54
|
+
http_version:
|
55
|
+
recorded_at: Tue, 20 Jan 2015 23:50:14 GMT
|
56
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apidev.grosocial.com/users/20183?key=<API_KEY>&p=<API_PASSWORD>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Date:
|
18
|
+
- Fri, 06 Feb 2015 05:53:11 GMT
|
19
|
+
Server:
|
20
|
+
- Apache/2.2.14 (Ubuntu)
|
21
|
+
Set-Cookie:
|
22
|
+
- CAKEPHP=333rdp8ufi2eeuelrfil2iahk0; expires=Fri, 06-Feb-2015 09:13:11 GMT;
|
23
|
+
path=/; secure
|
24
|
+
P3p:
|
25
|
+
- CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
|
26
|
+
Pragma:
|
27
|
+
- no-cache
|
28
|
+
Cache-Control:
|
29
|
+
- no-store, no-cache, max-age=0, must-revalidate
|
30
|
+
Content-Length:
|
31
|
+
- '341'
|
32
|
+
Content-Type:
|
33
|
+
- text/x-json
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: '{"result":{"http_status":{"code":200,"message":"Success"},"user":{"User":{"id":"20183","firstname":"Thomas","lastname":"Mebtester","email":"tpryor+gs5@myebiz.com","phone":null,"created":"2013-11-15
|
37
|
+
18:15:20","custom1":"","custom2":"","custom3":"","alertmessage":""}},"subscriptionlink":"http://apidev.grosocial.com/usersubscriptions/20183"}}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Fri, 06 Feb 2015 05:53:11 GMT
|
40
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apidev.grosocial.com/users/0?key=<API_KEY>&p=<API_PASSWORD>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Date:
|
18
|
+
- Fri, 06 Feb 2015 05:53:11 GMT
|
19
|
+
Server:
|
20
|
+
- Apache/2.2.14 (Ubuntu)
|
21
|
+
Set-Cookie:
|
22
|
+
- CAKEPHP=kd0mt6hs5u40fhc3hjaesusjb5; expires=Fri, 06-Feb-2015 09:13:11 GMT;
|
23
|
+
path=/; secure
|
24
|
+
P3p:
|
25
|
+
- CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
|
26
|
+
Pragma:
|
27
|
+
- no-cache
|
28
|
+
Cache-Control:
|
29
|
+
- no-store, no-cache, max-age=0, must-revalidate
|
30
|
+
Content-Length:
|
31
|
+
- '68'
|
32
|
+
Content-Type:
|
33
|
+
- text/x-json
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: '{"result":{"http_status":{"code":400,"message":"Resource Invalid"}}}'
|
37
|
+
http_version:
|
38
|
+
recorded_at: Fri, 06 Feb 2015 05:53:11 GMT
|
39
|
+
recorded_with: VCR 2.9.3
|
metadata
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gro_social
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Thompson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.8.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: typhoeus
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.7.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.7.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
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: simplecov
|
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: codeclimate-test-reporter
|
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
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: vcr
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.9.3
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.9.3
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: webmock
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: A simple Ruby client for GroSocial's REST API
|
140
|
+
email:
|
141
|
+
- james@buypd.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".ruby-gemset"
|
149
|
+
- ".ruby-version"
|
150
|
+
- ".travis.yml"
|
151
|
+
- Gemfile
|
152
|
+
- LICENSE.txt
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- gro_social.gemspec
|
156
|
+
- lib/gro_social.rb
|
157
|
+
- lib/gro_social/client.rb
|
158
|
+
- lib/gro_social/user.rb
|
159
|
+
- lib/gro_social/users.rb
|
160
|
+
- lib/gro_social/version.rb
|
161
|
+
- spec/gro_social/client_spec.rb
|
162
|
+
- spec/gro_social/user_spec.rb
|
163
|
+
- spec/gro_social/users_spec.rb
|
164
|
+
- spec/gro_social_spec.rb
|
165
|
+
- spec/spec_helper.rb
|
166
|
+
- spec/vcr_helper.rb
|
167
|
+
- vcr_cassettes/.keep
|
168
|
+
- vcr_cassettes/GroSocial_Client/_request/with_invalid_credentials/raises_an_error.yml
|
169
|
+
- vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_a_single_User/does_not_raise_an_error.yml
|
170
|
+
- vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_a_single_User/returns_a_parsed_JSON_response.yml
|
171
|
+
- vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_all_Users/does_not_raise_an_error.yml
|
172
|
+
- vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_all_Users/returns_a_parsed_JSON_response.yml
|
173
|
+
- vcr_cassettes/GroSocial_Users/_/returns_a_GroSocial_User_when_one_exists.yml
|
174
|
+
- vcr_cassettes/GroSocial_Users/_/returns_nil_when_a_User_does_not_exist.yml
|
175
|
+
homepage: https://github.com/BaseCampOps/gro_social
|
176
|
+
licenses:
|
177
|
+
- MIT
|
178
|
+
metadata: {}
|
179
|
+
post_install_message:
|
180
|
+
rdoc_options: []
|
181
|
+
require_paths:
|
182
|
+
- lib
|
183
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubyforge_project:
|
195
|
+
rubygems_version: 2.4.5
|
196
|
+
signing_key:
|
197
|
+
specification_version: 4
|
198
|
+
summary: Ruby client for GroSocial's REST API
|
199
|
+
test_files:
|
200
|
+
- spec/gro_social/client_spec.rb
|
201
|
+
- spec/gro_social/user_spec.rb
|
202
|
+
- spec/gro_social/users_spec.rb
|
203
|
+
- spec/gro_social_spec.rb
|
204
|
+
- spec/spec_helper.rb
|
205
|
+
- spec/vcr_helper.rb
|
206
|
+
- vcr_cassettes/.keep
|
207
|
+
- vcr_cassettes/GroSocial_Client/_request/with_invalid_credentials/raises_an_error.yml
|
208
|
+
- vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_a_single_User/does_not_raise_an_error.yml
|
209
|
+
- vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_a_single_User/returns_a_parsed_JSON_response.yml
|
210
|
+
- vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_all_Users/does_not_raise_an_error.yml
|
211
|
+
- vcr_cassettes/GroSocial_Client/_request/with_options_to_GET_all_Users/returns_a_parsed_JSON_response.yml
|
212
|
+
- vcr_cassettes/GroSocial_Users/_/returns_a_GroSocial_User_when_one_exists.yml
|
213
|
+
- vcr_cassettes/GroSocial_Users/_/returns_nil_when_a_User_does_not_exist.yml
|