sailplay 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +11 -0
- data/Guardfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +39 -0
- data/Rakefile +7 -0
- data/lib/sailplay.rb +109 -0
- data/lib/sailplay/api/base.rb +4 -0
- data/lib/sailplay/api/gift.rb +34 -0
- data/lib/sailplay/api/purchase.rb +40 -0
- data/lib/sailplay/api/user.rb +52 -0
- data/lib/sailplay/client.rb +255 -0
- data/lib/sailplay/configuration.rb +115 -0
- data/lib/sailplay/error.rb +27 -0
- data/lib/sailplay/rails.rb +24 -0
- data/lib/sailplay/rails/client.rb +118 -0
- data/lib/sailplay/response.rb +25 -0
- data/lib/sailplay/version.rb +3 -0
- data/lib/templates/sailplay_client +19 -0
- data/rails/init.rb +1 -0
- data/sailplay.gemspec +34 -0
- data/spec/sailplay/client_spec.rb +123 -0
- data/spec/sailplay/configuration_spec.rb +80 -0
- data/spec/sailplay_spec.rb +5 -0
- data/spec/spec_helper.rb +21 -0
- metadata +197 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Sailplay::Configuration do
|
4
|
+
context 'default' do
|
5
|
+
it 'should set the host to sailplay.ru' do
|
6
|
+
subject.host.should eq('sailplay.ru')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should set the protocol to https' do
|
10
|
+
subject.protocol.should eq('https')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should set the port to 443' do
|
14
|
+
subject.port.should eq(443)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should be secure' do
|
18
|
+
subject.secure.should be_true
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should set the endpoint to /api/v1' do
|
22
|
+
subject.endpoint.should eq('/api/v1')
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'shouldn\'t set store_id' do
|
26
|
+
subject.store_id.should be_nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'shouldn\'t set store_key' do
|
30
|
+
subject.store_key.should be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'shouldn\'t set store_pin' do
|
34
|
+
subject.store_pin.should be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should set content type to application/json' do
|
38
|
+
subject.connection_options[:headers][:accept].should eq('application/json')
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should set correct user agent' do
|
42
|
+
subject.connection_options[:headers][:user_agent].should eq("Sailplay Ruby Gem (#{Sailplay::VERSION})")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'default port' do
|
47
|
+
it 'should be 80 when not secure' do
|
48
|
+
subject.secure = false
|
49
|
+
subject.port.should eq(80)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should be 443 when secure' do
|
53
|
+
subject.secure = true
|
54
|
+
subject.port.should eq(443)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should allow user configuration' do
|
58
|
+
subject.port = 1234
|
59
|
+
subject.port.should eq(1234)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'default protocol' do
|
64
|
+
it 'should be http when not secure' do
|
65
|
+
subject.secure = false
|
66
|
+
subject.protocol.should eq('http')
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should be https when secure' do
|
70
|
+
subject.secure = true
|
71
|
+
subject.protocol.should eq('https')
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe 'default logger' do
|
76
|
+
it 'should have info level' do
|
77
|
+
subject.logger.level.should eq(Logger::INFO)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
4
|
+
require 'rspec/autorun'
|
5
|
+
require 'webmock/rspec'
|
6
|
+
|
7
|
+
require 'sailplay'
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
|
+
config.filter_run :focus => true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
|
14
|
+
#config.before :suite do
|
15
|
+
# RestClient.log = $stdout
|
16
|
+
#end
|
17
|
+
|
18
|
+
config.before :each do
|
19
|
+
WebMock.disable_net_connect!
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sailplay
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Sergey Nebolsin
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2013-08-21 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: multi_json
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
prerelease: false
|
32
|
+
type: :runtime
|
33
|
+
requirement: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rest-client
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
prerelease: false
|
46
|
+
type: :runtime
|
47
|
+
requirement: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: bundler
|
50
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 9
|
56
|
+
segments:
|
57
|
+
- 1
|
58
|
+
- 3
|
59
|
+
version: "1.3"
|
60
|
+
prerelease: false
|
61
|
+
type: :development
|
62
|
+
requirement: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rake
|
65
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
prerelease: false
|
75
|
+
type: :development
|
76
|
+
requirement: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: rspec
|
79
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ~>
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 2
|
87
|
+
- 0
|
88
|
+
version: "2.0"
|
89
|
+
prerelease: false
|
90
|
+
type: :development
|
91
|
+
requirement: *id005
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: webmock
|
94
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
prerelease: false
|
104
|
+
type: :development
|
105
|
+
requirement: *id006
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: coveralls
|
108
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
prerelease: false
|
118
|
+
type: :development
|
119
|
+
requirement: *id007
|
120
|
+
description: Wrapper for sailplay.ru REST api
|
121
|
+
email:
|
122
|
+
- nebolsin@gmail.com
|
123
|
+
executables: []
|
124
|
+
|
125
|
+
extensions: []
|
126
|
+
|
127
|
+
extra_rdoc_files: []
|
128
|
+
|
129
|
+
files:
|
130
|
+
- .gitignore
|
131
|
+
- .rspec
|
132
|
+
- .travis.yml
|
133
|
+
- CHANGELOG.md
|
134
|
+
- Gemfile
|
135
|
+
- Guardfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- lib/sailplay.rb
|
140
|
+
- lib/sailplay/api/base.rb
|
141
|
+
- lib/sailplay/api/gift.rb
|
142
|
+
- lib/sailplay/api/purchase.rb
|
143
|
+
- lib/sailplay/api/user.rb
|
144
|
+
- lib/sailplay/client.rb
|
145
|
+
- lib/sailplay/configuration.rb
|
146
|
+
- lib/sailplay/error.rb
|
147
|
+
- lib/sailplay/rails.rb
|
148
|
+
- lib/sailplay/rails/client.rb
|
149
|
+
- lib/sailplay/response.rb
|
150
|
+
- lib/sailplay/version.rb
|
151
|
+
- lib/templates/sailplay_client
|
152
|
+
- rails/init.rb
|
153
|
+
- sailplay.gemspec
|
154
|
+
- spec/sailplay/client_spec.rb
|
155
|
+
- spec/sailplay/configuration_spec.rb
|
156
|
+
- spec/sailplay_spec.rb
|
157
|
+
- spec/spec_helper.rb
|
158
|
+
homepage: https://github.com/nebolsin/sailplay
|
159
|
+
licenses:
|
160
|
+
- MIT
|
161
|
+
post_install_message:
|
162
|
+
rdoc_options: []
|
163
|
+
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
hash: 57
|
172
|
+
segments:
|
173
|
+
- 1
|
174
|
+
- 8
|
175
|
+
- 7
|
176
|
+
version: 1.8.7
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
hash: 3
|
183
|
+
segments:
|
184
|
+
- 0
|
185
|
+
version: "0"
|
186
|
+
requirements: []
|
187
|
+
|
188
|
+
rubyforge_project:
|
189
|
+
rubygems_version: 1.8.25
|
190
|
+
signing_key:
|
191
|
+
specification_version: 3
|
192
|
+
summary: Sailplay API client
|
193
|
+
test_files:
|
194
|
+
- spec/sailplay/client_spec.rb
|
195
|
+
- spec/sailplay/configuration_spec.rb
|
196
|
+
- spec/sailplay_spec.rb
|
197
|
+
- spec/spec_helper.rb
|