bookingsync-api 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bookingsync/api/client.rb +6 -0
- data/lib/bookingsync/api/version.rb +1 -1
- data/spec/bookingsync/api/client_spec.rb +8 -0
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a92d599d79a2d4e9677b5c776c2561b523d0b5cc
|
4
|
+
data.tar.gz: d42cdec7c7dc41ea511be912fca12d71502626f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56c5b573d13803764140b99a53f20bc6b1737f2513df427ce2bc5bd5b73758dac2e85ebc2dc2cfe0f8724f049ead428d1e5e9edc0e81d290d56fb06f895e2783
|
7
|
+
data.tar.gz: e9288c74c35e09fb70c652f5085821267ddd90c7f73df1770270e3f647168cdec5d5a1d47b39054ffbf93ca36a63418ce8a1c4ad8ac225d602c3e362a6d6a619
|
@@ -76,6 +76,7 @@ module BookingSync::API
|
|
76
76
|
@conn = Faraday.new(faraday_options)
|
77
77
|
@conn.headers[:accept] = MEDIA_TYPE
|
78
78
|
@conn.headers[:content_type] = MEDIA_TYPE
|
79
|
+
@conn.headers[:user_agent] = user_agent
|
79
80
|
@conn.url_prefix = api_endpoint
|
80
81
|
yield @conn if block_given?
|
81
82
|
end
|
@@ -307,6 +308,11 @@ module BookingSync::API
|
|
307
308
|
Logger.new(debug? ? STDOUT : nil)
|
308
309
|
end
|
309
310
|
|
311
|
+
# Return user agent with gem version, can be logged in API.
|
312
|
+
def user_agent
|
313
|
+
"BookingSync API gem v#{BookingSync::API::VERSION}"
|
314
|
+
end
|
315
|
+
|
310
316
|
# Default instrumenter which does nothing.
|
311
317
|
module NoopInstrumenter
|
312
318
|
def self.instrument(name, payload = {})
|
@@ -116,6 +116,14 @@ describe BookingSync::API::Client do
|
|
116
116
|
expect(response).to be_kind_of(BookingSync::API::Response)
|
117
117
|
end
|
118
118
|
|
119
|
+
it "requests with proper User-Agent" do
|
120
|
+
stub_get("resource", body: {}.to_json)
|
121
|
+
response = client.call(:get, "resource")
|
122
|
+
assert_requested :get, bs_url("resource"),
|
123
|
+
headers: {"User-Agent" =>
|
124
|
+
"BookingSync API gem v#{BookingSync::API::VERSION}"}
|
125
|
+
end
|
126
|
+
|
119
127
|
context "API returns 401" do
|
120
128
|
it "raises Unauthorized exception" do
|
121
129
|
stub_get("resource", status: 401)
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookingsync-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sébastien Grosjean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07
|
11
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: addressable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hashie
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: This gem allows to interact with the BookingSync API via Ruby objects
|
@@ -87,9 +87,9 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .rspec
|
92
|
-
- .travis.yml
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
93
|
- Gemfile
|
94
94
|
- Guardfile
|
95
95
|
- LICENSE.txt
|
@@ -236,17 +236,17 @@ require_paths:
|
|
236
236
|
- lib
|
237
237
|
required_ruby_version: !ruby/object:Gem::Requirement
|
238
238
|
requirements:
|
239
|
-
- -
|
239
|
+
- - ">="
|
240
240
|
- !ruby/object:Gem::Version
|
241
241
|
version: '0'
|
242
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
243
|
requirements:
|
244
|
-
- -
|
244
|
+
- - ">="
|
245
245
|
- !ruby/object:Gem::Version
|
246
246
|
version: '0'
|
247
247
|
requirements: []
|
248
248
|
rubyforge_project:
|
249
|
-
rubygems_version: 2.
|
249
|
+
rubygems_version: 2.2.2
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: Ruby interface for accessing https://www.bookingsync.com
|