sentimeta 0.0.5 → 0.0.6

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: 88453ac215a3005051208a8e0120183d510861fb
4
- data.tar.gz: e170188eda6261cdbc047a72c1bafbfef85a1792
3
+ metadata.gz: e4bd1e8db281f3eb7ce7793945b9c4d136df281e
4
+ data.tar.gz: 97566ddfd6a851e449dd43fa61d15eb6c931d9d9
5
5
  SHA512:
6
- metadata.gz: de48f8c1212269ab2a335e943816de998af2cec48be839f6141120773c55cab22130a9e33fd4c131dc40894337e26564e1a8e84a3e5f85e4a6d7cd850be10a34
7
- data.tar.gz: e8e5f6d08a300e6e3e323d820fa5a1faa11ac416b1644663d4052614ba6235b4d3641153836a6679fe43511b872570d6a870acfa2fd38073053c28a4021e333f
6
+ metadata.gz: 717f47bd743b0c4c04773c67423416a4d6b3f0199a36326eea2b7193691767eeb8721f78d0c39da767158a4f12e5147b60c820566136331f5fe4aeba1ca33acc
7
+ data.tar.gz: cc3127025b6ed51a2d70030dc9f71e2bda46c91683de7e14b8314fae24d411b28e71f906a287f70008fdd8c9d8a289f92a6b36dd55a6af1ace937c821c7d896c
@@ -12,6 +12,10 @@ module Sentimeta
12
12
  end
13
13
  end
14
14
 
15
+ def prices options={}
16
+ fetch :prices, options
17
+ end
18
+
15
19
  def fetch endpoint, options={}
16
20
  options = options.keep_if { |key, value| !!value }
17
21
  send_request generate_uri endpoint, options
@@ -22,6 +26,7 @@ module Sentimeta
22
26
  components << Sentimeta.endpoint
23
27
  components << (options.delete(:sphere) || Sentimeta.sphere) unless endpoint == :spheres
24
28
  components << endpoint
29
+ components << options.delete(:provider) if endpoint == :prices
25
30
  components << options.delete(:id)
26
31
  end.compact.join('/')
27
32
 
@@ -32,7 +37,7 @@ module Sentimeta
32
37
  end
33
38
 
34
39
  def send_request uri
35
- logger.debug " Sentimeta: #{ URI.unescape uri.to_s }"
40
+ Sentimeta.logger.debug " Sentimeta: #{ URI.unescape uri.to_s }"
36
41
  Observers.all.each { |o| o.notify "fetch", URI.unescape(uri.to_s) }
37
42
  begin
38
43
  JSON.parse(uri.open.read)
@@ -41,9 +46,6 @@ module Sentimeta
41
46
  end
42
47
  end
43
48
 
44
- def logger
45
- @logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
46
- end
47
49
  end
48
50
 
49
51
  end
@@ -0,0 +1,11 @@
1
+ module Sentimeta
2
+ module Error
3
+ class RecordNotFound < StandardError
4
+
5
+ def initialize msg = "Record not found on API"
6
+ super msg
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module Sentimeta
2
+
3
+ def logger
4
+ @logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
5
+ end
6
+
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Sentimeta
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/sentimeta.rb CHANGED
@@ -4,7 +4,9 @@ module Sentimeta
4
4
  require "sentimeta/client"
5
5
  require "sentimeta/observers"
6
6
  require "sentimeta/model"
7
+ require "sentimeta/logger"
7
8
  require "sentimeta/error/unreachable"
9
+ require "sentimeta/error/record_not_found"
8
10
 
9
11
  require 'logger'
10
12
  require 'yaml'
data/spec/client_spec.rb CHANGED
@@ -43,6 +43,10 @@ describe Sentimeta::Client do
43
43
  expect(subject.public_send endpoint).to be_kind_of Array
44
44
  end
45
45
  end
46
+
47
+ it { should respond_to :prices }
48
+ it("#prices should call fetch once") { pending }
49
+ it("#prices should return an array") { pending }
46
50
  end
47
51
 
48
52
  end
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.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Shpakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-12 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,7 +81,9 @@ files:
81
81
  - config/endpoint.yml
82
82
  - lib/sentimeta.rb
83
83
  - lib/sentimeta/client.rb
84
+ - lib/sentimeta/error/record_not_found.rb
84
85
  - lib/sentimeta/error/unreachable.rb
86
+ - lib/sentimeta/logger.rb
85
87
  - lib/sentimeta/model.rb
86
88
  - lib/sentimeta/observers.rb
87
89
  - lib/sentimeta/version.rb