sentimeta 0.1.10 → 0.1.20

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30d1c213e02c958280e9d79a3f356bf1b73557c7
4
- data.tar.gz: c54a3282982ca6db0ad2834918c100d6f7c6627e
3
+ metadata.gz: a6168306613bb2d06e0f3aa0120cb19816dacbc3
4
+ data.tar.gz: 7f3774c9ba5e107d35d327d6f362c21575569531
5
5
  SHA512:
6
- metadata.gz: 4e49d2ab16534dbcafdc4e93d58e56acba32e89a6abec94964aef88a3dbf921f1c679c807eb54ea727df5a5883297a065c95ef3e1302b7271d89a29de8fd3f8d
7
- data.tar.gz: 86ff4f9e6a7f5375e6538036aa78b86ace3f574fcb37506698fa7f21f476cb29be2b72074d447fda8e49b9cd8f8f6234aa27d0f926dbb5b3e6ad174025473cd2
6
+ metadata.gz: 4729be7f7803f539917049ef1e3d36207cfd06eaa726182e31c0c934a9f2b794f10f2c3a50a202283169a0af9620ae0d152e3deb566604db2d5c1576fd9182d1
7
+ data.tar.gz: 4c6230cd901ace42e406da2474df0a03937138780215bcc82e9dbd942e17d70e93986d329ad923051a1dcbe6cf199835743ad201b2b8191ae5665a473549d933
data/config/endpoint.yml CHANGED
@@ -2,7 +2,7 @@ production:
2
2
  url: 'http://127.0.0.1/api/v1'
3
3
 
4
4
  staging:
5
- url: 'http://5.9.0.5/api/v1'
5
+ url: 'http://178.63.216.136/api/v1'
6
6
 
7
7
  test:
8
- url: 'http://5.9.0.5/api/v1'
8
+ url: 'http://178.63.216.136/api/v1'
@@ -1,3 +1,3 @@
1
1
  module Sentimeta
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.20"
3
3
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sentimeta::Client::Auth, :vcr do
4
+
5
+ it { is_expected.to respond_to(:user) }
6
+ it { is_expected.to respond_to(:signup) }
7
+ it { is_expected.to respond_to(:signin) }
8
+ it { is_expected.to respond_to(:reset_password_token) }
9
+ it { is_expected.to respond_to(:reset_password) }
10
+ it { is_expected.to respond_to(:oauth) }
11
+ it { is_expected.to respond_to(:signout) }
12
+
13
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sentimeta::Client::Data, :vcr do
4
+
5
+ it { is_expected.to respond_to(:attributes) }
6
+ it { is_expected.to respond_to(:medal) }
7
+ it { is_expected.to respond_to(:search) }
8
+
9
+ it 'responds to other data-methods' do
10
+ %w(criteria spheres objects catalog).each do |meth|
11
+ is_expected.to respond_to(meth.to_sym)
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sentimeta::Client::Info, :vcr do
4
+
5
+ it { is_expected.to respond_to(:catalog) }
6
+ it { is_expected.to respond_to(:hints) }
7
+ it { is_expected.to respond_to(:main) }
8
+ it { is_expected.to respond_to(:presets) }
9
+
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sentimeta::Client::Prices, :vcr do
4
+
5
+ it { is_expected.to respond_to(:load) }
6
+
7
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sentimeta::Client::Subscription, :vcr do
4
+
5
+ it { is_expected.to respond_to(:subscribe) }
6
+ it { is_expected.to respond_to(:unsubscribe) }
7
+
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sentimeta::Client::UserReviews, :vcr do
4
+
5
+ it { is_expected.to respond_to(:find) }
6
+ it { is_expected.to respond_to(:create) }
7
+
8
+ end
data/spec/client_spec.rb CHANGED
@@ -18,18 +18,6 @@ describe Sentimeta::Client, :vcr do
18
18
  end
19
19
  end
20
20
 
21
-
22
- # describe :send_request do
23
- # it "should be fine for a valid uri" do
24
- # expect { subject.send_request valid_url }.not_to raise_error
25
- # end
26
-
27
- # it "should raise an error for invalid uri" do
28
- # expect { subject.send_request "invalid" }.to raise_error Sentimeta::Error::Unreachable
29
- # end
30
- # end
31
-
32
-
33
21
  describe :endpoints do
34
22
  %i(criteria spheres objects catalog).each do |endpoint|
35
23
  it { should respond_to endpoint }
@@ -43,10 +31,6 @@ describe Sentimeta::Client, :vcr do
43
31
  expect(subject.public_send endpoint).to be_kind_of Array
44
32
  end
45
33
  end
46
-
47
- # it { should respond_to :prices }
48
- # it("#prices should call fetch once") { pending }
49
- # it("#prices should return an array") { pending }
50
34
  end
51
35
 
52
36
  end
@@ -0,0 +1,86 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sentimeta::RestClient, :vcr do
4
+
5
+ subject do
6
+ module TestModule extend Sentimeta::RestClient; end
7
+ end
8
+
9
+ it { is_expected.to respond_to(:fetch) }
10
+
11
+ describe '#generate_uri' do
12
+ it 'works without options' do
13
+ expect(
14
+ subject.generate_uri(:spheres)
15
+ ).to eq 'http://178.63.216.136/api/v1/spheres'
16
+ end
17
+
18
+ it 'generate right uri for attributes' do
19
+ expect(
20
+ subject.generate_uri(:attributes, filter: 'actors', sphere: 'movies')
21
+ ).to eq 'http://178.63.216.136/api/v1/movies/attributes/actors'
22
+ end
23
+
24
+ it 'generate right uri for prices' do
25
+ expect(
26
+ subject.generate_uri(:prices, provider: 'booking', sphere: 'hotels')
27
+ ).to eq 'http://178.63.216.136/api/v1/hotels/prices/booking'
28
+ end
29
+
30
+ it 'puts id at the end of URI' do
31
+ expect(
32
+ subject.generate_uri(:prices, id: 12345, provider: 'booking', sphere: 'hotels')
33
+ ).to eq 'http://178.63.216.136/api/v1/hotels/prices/booking/12345'
34
+ end
35
+ end
36
+
37
+ describe '#fetch' do
38
+ it 'sends get request by default' do
39
+ expect(::RestClient::Request).to receive(:execute)
40
+ .with(hash_including(method: :get))
41
+ .and_call_original
42
+
43
+ subject.fetch 'spheres'
44
+ end
45
+
46
+ it 'sends right request' do
47
+ expect(::RestClient::Request).to receive(:execute)
48
+ .with(hash_including(url: 'http://178.63.216.136/api/v1/hotels/catalog'))
49
+ .and_call_original
50
+
51
+ subject.fetch 'catalog', sphere: 'hotels'
52
+ end
53
+
54
+ it 'puts tokens to header' do
55
+ headers = {
56
+ 'X-SERVER-ACCESS-TOKEN' => 'servertoken',
57
+ 'X-TOKEN' => 'usertoken'
58
+ }
59
+ Sentimeta.server_token = 'servertoken'
60
+ expect(::RestClient::Request).to receive(:execute)
61
+ .with(hash_including(headers: headers))
62
+ .and_call_original
63
+
64
+ subject.fetch 'catalog', sphere: 'hotels', token: 'usertoken'
65
+ end
66
+
67
+ it 'handle empty parameters normally' do
68
+ expected_params = { param: :test }
69
+ expect(::RestClient::Request).to receive(:execute)
70
+ .with(hash_including(payload: expected_params))
71
+ .and_call_original
72
+
73
+ subject.fetch 'catalog', sphere: 'hotels', blabla: nil, param: :test
74
+ end
75
+ end
76
+
77
+ it "responds to shortcut methods" do
78
+ %i(get post put patch delete options).each do |method|
79
+ expect(::RestClient::Request).to receive(:execute)
80
+ .with(hash_including(method: method))
81
+ .and_return(OpenStruct.new(code: 200, body: ''))
82
+ subject.public_send(method)
83
+ end
84
+ end
85
+
86
+ end
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,7 @@ require 'yaml'
6
6
 
7
7
  Sentimeta.sphere = :hotels
8
8
  Sentimeta.env = :test
9
+ Sentimeta.logger.level = Logger::WARN
9
10
 
10
11
  require 'webmock/rspec'
11
12
  require "vcr"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentimeta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Shpakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-26 00:00:00.000000000 Z
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -126,8 +126,15 @@ files:
126
126
  - lib/sentimeta/support.rb
127
127
  - lib/sentimeta/version.rb
128
128
  - sentimeta.gemspec
129
+ - spec/client/auth_spec.rb
130
+ - spec/client/data_spec.rb
131
+ - spec/client/info_spec.rb
132
+ - spec/client/prices_spec.rb
133
+ - spec/client/subscription_spec.rb
134
+ - spec/client/user_reviews_spec.rb
129
135
  - spec/client_spec.rb
130
136
  - spec/model_spec.rb
137
+ - spec/rest_client_spec.rb
131
138
  - spec/spec_helper.rb
132
139
  homepage: http://toprater.com
133
140
  licenses: