fio_api 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 685e91eac02a573999a18b5ac41b5505f35da56f
4
+ data.tar.gz: ebe0594db6cb2c53b83fadacba9a5ba9ff6bab19
5
+ SHA512:
6
+ metadata.gz: cde73de58e95c2fa4a4496de6306fc6428bf679135603cc0fddbd7f864dd74f5669485e8002b38bf6ee461a2af38b6a15d8bb6c1f787ee2e349193b6ba7d6053
7
+ data.tar.gz: aa54a2d8445b4f41cc2b694271f1884173e3fa2b206841fa6d435910557c6fa9375b880ef7eba0e982fcdb92ae278dc0c85be5c656b01743b9918013cab460df
data/Gemfile CHANGED
@@ -3,14 +3,14 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
- gem "httparty", ">= 0.9.0"
6
+ gem "httparty", ">= 0.13.7"
7
7
 
8
8
  # Add dependencies to develop your gem here.
9
9
  # Include everything needed to run rake, tests, features, etc.
10
10
  group :development do
11
- gem "rspec", ">= 2.8.0"
12
- gem "rspec-mocks", ">= 2.8.0"
13
- gem "rdoc", ">= 3.12"
14
- gem "bundler", ">= 1.2.0"
15
- gem "jeweler", ">= 1.8.4"
11
+ gem "rspec", ">= 3.4.0"
12
+ gem "rspec-mocks", ">= 3.4.0"
13
+ gem "rdoc", ">= 4.2.0"
14
+ gem "bundler", ">= 1.10.6"
15
+ gem "jeweler", ">= 2.0.1"
16
16
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/fio_api.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "fio_api"
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Robin Bortlik"]
data/lib/base/request.rb CHANGED
@@ -26,7 +26,7 @@ module FioAPI
26
26
  # Request instance
27
27
  #
28
28
  def fetch
29
- self.response_json = HTTParty.get(uri).to_hash
29
+ self.response_json = HTTParty.get(uri, format: :json)
30
30
  self
31
31
  end
32
32
 
@@ -8,7 +8,7 @@ describe FioAPI::Account do
8
8
  :date_start, :date_end, :year_list, :id_list, :id_from, :id_to, :id_last_download].each do |attr|
9
9
 
10
10
  it "should respond to #{attr}" do
11
- FioAPI::Account.new.should respond_to(attr)
11
+ expect(FioAPI::Account.new).to respond_to(attr)
12
12
  end
13
13
 
14
14
  end
@@ -5,11 +5,11 @@ describe FioAPI::ListResponseDeserializer do
5
5
  describe "instance attributes" do
6
6
 
7
7
  it "should respond to account" do
8
- FioAPI::ListResponseDeserializer.new.should respond_to(:account)
8
+ expect(FioAPI::ListResponseDeserializer.new).to respond_to(:account)
9
9
  end
10
10
 
11
11
  it "should respond to transactions" do
12
- FioAPI::ListResponseDeserializer.new.should respond_to(:transactions)
12
+ expect(FioAPI::ListResponseDeserializer.new).to respond_to(:transactions)
13
13
  end
14
14
 
15
15
  end
@@ -34,7 +34,7 @@ describe FioAPI::ListResponseDeserializer do
34
34
  deserialized = @deserializer.send(:deserialize_account, account_json)
35
35
 
36
36
  result.each do |attr_name,value|
37
- deserialized.send(attr_name).should eq(value)
37
+ expect(deserialized.send(attr_name)).to eq(value)
38
38
  end
39
39
  end
40
40
 
@@ -73,15 +73,15 @@ describe FioAPI::ListResponseDeserializer do
73
73
  deserialized = @deserializer.send(:deserialize_transactions, [transaction_json])[0]
74
74
 
75
75
  result.each do |attr_name,value|
76
- deserialized.send(attr_name).should eq(value)
76
+ expect(deserialized.send(attr_name)).to eq(value)
77
77
  end
78
78
  end
79
79
 
80
80
  it "should return deserializer object with account and transactions" do
81
81
  @deserializer.deserialize({"accountStatement" => {"transactionList" => {"transaction" => [{}] }}} )
82
- @deserializer.account.class.should eq FioAPI::Account
83
- @deserializer.transactions.class.should eq Array
84
- @deserializer.transactions.first.class.should eq FioAPI::Transaction
82
+ expect(@deserializer.account.class).to eq FioAPI::Account
83
+ expect(@deserializer.transactions.class).to eq Array
84
+ expect(@deserializer.transactions.first.class).to eq FioAPI::Transaction
85
85
  end
86
86
  end
87
87
  end
@@ -3,43 +3,43 @@ require_relative "../spec_helper"
3
3
  describe FioAPI::List do
4
4
  before(:each) do
5
5
  @list = FioAPI::List.new
6
- HTTParty.stub(:get) { {response: "response"} }
6
+ allow(HTTParty).to receive(:get) { {response: "response"} }
7
7
  end
8
8
 
9
9
  it "should set request with uri for date range" do
10
10
  date_from = Date.new(2011,1,1)
11
11
  date_to = Date.new(2012,11,25)
12
12
  url = "https://www.fio.cz/ib_api/rest/periods/#{FioAPI.token}/#{date_from}/#{date_to}/transactions.json"
13
- @list.by_date_range(date_from, date_to).request.uri.should eq url
13
+ expect(@list.by_date_range(date_from, date_to).request.uri).to eq url
14
14
  end
15
15
 
16
16
  it "should set request with uri for listing_id and year" do
17
17
  year = 2012
18
18
  id = "12345"
19
19
  url = "https://www.fio.cz/ib_api/rest/by-id/#{FioAPI.token}/#{year}/#{id}/transactions.json"
20
- @list.by_listing_id_and_year(id, year).request.uri.should eq url
20
+ expect(@list.by_listing_id_and_year(id, year).request.uri).to eq url
21
21
  end
22
22
 
23
23
  it "should set request with uri from last fetch" do
24
24
  url = "https://www.fio.cz/ib_api/rest/last/#{FioAPI.token}/transactions.json"
25
- @list.from_last_fetch.request.uri.should eq url
25
+ expect(@list.from_last_fetch.request.uri).to eq url
26
26
  end
27
27
 
28
28
  it "should set request with uri to set last fetch id" do
29
29
  id = "12345"
30
30
  url = "https://www.fio.cz/ib_api/rest/set-last-id/#{FioAPI.token}/#{id}/"
31
- @list.set_last_fetch_id(id).request.uri.should eq url
31
+ expect(@list.set_last_fetch_id(id).request.uri).to eq url
32
32
  end
33
33
 
34
34
  it "should set request with uri to set last date" do
35
35
  date = Date.new(2012,11,25)
36
36
  url = "https://www.fio.cz/ib_api/rest/set-last-date/#{FioAPI.token}/#{date}/"
37
- @list.set_last_fetch_date(date).request.uri.should eq url
37
+ expect(@list.set_last_fetch_date(date).request.uri).to eq url
38
38
  end
39
39
 
40
40
  it "should fetch and deserialize response" do
41
41
  @list.send(:fetch_and_deserialize_response)
42
- @list.request.should_not be_nil
43
- @list.response.should_not be_nil
42
+ expect(@list.request).not_to be_nil
43
+ expect(@list.response).not_to be_nil
44
44
  end
45
45
  end
@@ -3,34 +3,34 @@ require_relative "../spec_helper"
3
3
  describe FioAPI::Request do
4
4
 
5
5
  it "should have defined token" do
6
- FioAPI::Request.should respond_to :token
6
+ expect(FioAPI::Request).to respond_to :token
7
7
  end
8
8
 
9
9
  it "should have defined uri" do
10
- FioAPI::Request.new.should respond_to :uri
10
+ expect(FioAPI::Request.new).to respond_to :uri
11
11
  end
12
12
 
13
13
  it "should have defined response" do
14
- FioAPI::Request.new.should respond_to :response
14
+ expect(FioAPI::Request.new).to respond_to :response
15
15
  end
16
16
 
17
17
  describe "fetch" do
18
18
  before(:each) do
19
19
  @response = {response: "response"}
20
- HTTParty.stub(:get) { @response }
20
+ allow(HTTParty).to receive(:get) { @response }
21
21
  end
22
22
 
23
23
  it "should fill the response" do
24
24
  request = FioAPI::Request.new
25
25
  request.fetch
26
- request.response.should eq @response
26
+ expect(request.response).to eq @response
27
27
  end
28
28
 
29
29
  it "should deserialize the response" do
30
30
  deserializer = FioAPI::ListResponseDeserializer.new
31
31
  request = FioAPI::Request.new(deserializer: deserializer)
32
32
  request.fetch
33
- request.response.should eq deserializer.deserialize(@response)
33
+ expect(request.response).to eq deserializer.deserialize(@response)
34
34
  end
35
35
  end
36
36
 
@@ -42,12 +42,12 @@ describe FioAPI::Request do
42
42
  end
43
43
 
44
44
  it "should construct uri from arguments" do
45
- @request.send(:construct_uri, FioAPI.token, 'transactions.json').to_s.should eq @url
45
+ expect(@request.send(:construct_uri, FioAPI.token, 'transactions.json').to_s).to eq @url
46
46
  end
47
47
 
48
48
  it "should set uri from arguments" do
49
49
  @request.set_uri FioAPI.token, 'transactions.json'
50
- @request.uri.should eq @url
50
+ expect(@request.uri).to eq @url
51
51
  end
52
52
 
53
53
  end
@@ -9,7 +9,7 @@ describe FioAPI::Transaction do
9
9
  :sender, :detail_info, :comment, :bic, :action_id].each do |attr|
10
10
 
11
11
  it "should respond to #{attr}" do
12
- FioAPI::Transaction.new.should respond_to(attr)
12
+ expect(FioAPI::Transaction.new).to respond_to(attr)
13
13
  end
14
14
 
15
15
  end
data/spec/fio_api_spec.rb CHANGED
@@ -4,13 +4,13 @@ describe FioAPI do
4
4
  it "should setup token" do
5
5
  token = "some token"
6
6
  FioAPI.token = token
7
- FioAPI::Request.token.should eq token
7
+ expect(FioAPI::Request.token).to eq token
8
8
  end
9
9
 
10
10
  it "should return token" do
11
11
  token = "some token"
12
12
  FioAPI::Request.token = token
13
- FioAPI.token.should eq token
13
+ expect(FioAPI.token).to eq token
14
14
  end
15
15
  end
16
16
 
@@ -5,15 +5,15 @@ describe Hash do
5
5
  describe "try_path" do
6
6
 
7
7
  it "should respond to try_path method" do
8
- {}.should respond_to(:try_path)
8
+ expect({}).to respond_to(:try_path)
9
9
  end
10
10
 
11
11
  it "should return nil if can't find key" do
12
- {}.try_path("key1", "key2").should be_nil
12
+ expect({}.try_path("key1", "key2")).to be_nil
13
13
  end
14
14
 
15
15
  it "should return value on path" do
16
- {"key1" => {"key2" => "value"} }.try_path("key1", "key2").should eq "value"
16
+ expect({"key1" => {"key2" => "value"} }.try_path("key1", "key2")).to eq "value"
17
17
  end
18
18
  end
19
19
  end
@@ -23,11 +23,11 @@ describe NilClass do
23
23
  describe "try_path" do
24
24
 
25
25
  it "should respond to try_path method" do
26
- nil.should respond_to(:try_path)
26
+ expect(nil).to respond_to(:try_path)
27
27
  end
28
28
 
29
29
  it "should return nil" do
30
- nil.try_path("key1", "key2").should be_nil
30
+ expect(nil.try_path("key1", "key2")).to be_nil
31
31
  end
32
32
 
33
33
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fio_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Robin Bortlik
@@ -14,97 +13,85 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.9.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.9.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: 2.8.0
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: 2.8.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec-mocks
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: 2.8.0
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: 2.8.0
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rdoc
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '3.12'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '3.12'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: bundler
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: 1.2.0
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: 1.2.0
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: jeweler
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: 1.8.4
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: 1.8.4
110
97
  description: API wrapper for FIO bank
@@ -115,8 +102,8 @@ extra_rdoc_files:
115
102
  - LICENSE.txt
116
103
  - README.rdoc
117
104
  files:
118
- - .rspec
119
- - .travis.yml
105
+ - ".rspec"
106
+ - ".travis.yml"
120
107
  - Gemfile
121
108
  - LICENSE.txt
122
109
  - README.rdoc
@@ -144,28 +131,24 @@ files:
144
131
  homepage: http://github.com/robinbortlik/fio_api
145
132
  licenses:
146
133
  - MIT
134
+ metadata: {}
147
135
  post_install_message:
148
136
  rdoc_options: []
149
137
  require_paths:
150
138
  - lib
151
139
  required_ruby_version: !ruby/object:Gem::Requirement
152
- none: false
153
140
  requirements:
154
- - - ! '>='
141
+ - - ">="
155
142
  - !ruby/object:Gem::Version
156
143
  version: '0'
157
- segments:
158
- - 0
159
- hash: 2579242793212923539
160
144
  required_rubygems_version: !ruby/object:Gem::Requirement
161
- none: false
162
145
  requirements:
163
- - - ! '>='
146
+ - - ">="
164
147
  - !ruby/object:Gem::Version
165
148
  version: '0'
166
149
  requirements: []
167
150
  rubyforge_project:
168
- rubygems_version: 1.8.25
151
+ rubygems_version: 2.4.5
169
152
  signing_key:
170
153
  specification_version: 3
171
154
  summary: API wrapper for FIO bank