reg.api2 0.0.12 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fcf919b64250ad7be856188c30ab24b11ef258b4
4
- data.tar.gz: 9741bbc8b397d58b26cb733c299804a5ffffd6c8
3
+ metadata.gz: 2a0e71a8b8e931939edc3f25a46d717d705f16c9
4
+ data.tar.gz: bb0f339992d12f6380f70f192a653ac888a385e2
5
5
  SHA512:
6
- metadata.gz: d71dce82ad3170fc6cfd2a9086b91686cc59033a9f1f3b05689f896653f6875c47dfe6251a2c35250208fea1c276808b73e6c8e021915b70f2344d6b3e3cea28
7
- data.tar.gz: 477e265b532a2e5d93876bc9b0e1414faf9327d03160fb69d9d05d3371b466d1f44502ae55b2a88ae9c68df1712e4123faf46dc6b6a7fb5f70d50efa80980bf9
6
+ metadata.gz: d8b82e60de033ebe7faece2f2125cbcc4eccecf14044131a1682913e8e537d83664759470d01443224ff85fcbc66a28a402ca8bfb9eedfe643329195a5baf527
7
+ data.tar.gz: c3606fa81edd963a8d13254c0f78dc206fd95274b5bd27361e3cf4a9cbfbd128cf462bc048fd51087882e621fa2afbc588b3eb6da69c1919fca64c8f4f71fb5e
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- # - jruby-19mode
4
- - rbx-2.1.1
5
3
  - 1.9.2
6
4
  - 1.9.3
7
5
  - 2.0.0
6
+ - 2.1.0
7
+
data/README.md CHANGED
@@ -85,14 +85,17 @@ Also console reads `~/.regapi2` configuration file if exists, to assign properti
85
85
 
86
86
  Please follow these links to view documentation on methods of all known API categories:
87
87
 
88
- * [common](http://regru.github.io/reg_api2-ruby/RegApi2/Common.html).
89
- * [domain](http://regru.github.io/reg_api2-ruby/RegApi2/Domain.html).
90
- * [user](http://regru.github.io/reg_api2-ruby/RegApi2/User.html).
91
- * [service](http://regru.github.io/reg_api2-ruby/RegApi2/Service.html).
92
- * [bill](http://regru.github.io/reg_api2-ruby/RegApi2/Bill.html).
93
- * [folder](http://regru.github.io/reg_api2-ruby/RegApi2/Folder.html).
94
- * [zone](http://regru.github.io/reg_api2-ruby/RegApi2/Zone.html).
95
- * [hosting](http://regru.github.io/reg_api2-ruby/RegApi2/Hosting.html).
88
+ | Category | Description |
89
+ | -------- | ----------- |
90
+ | [common](http://regru.github.io/reg_api2-ruby/RegApi2/Common.html) | Common ops |
91
+ | [domain](http://regru.github.io/reg_api2-ruby/RegApi2/Domain.html) | Domain registration etc. |
92
+ | [user](http://regru.github.io/reg_api2-ruby/RegApi2/User.html) | User creation etc. |
93
+ | [service](http://regru.github.io/reg_api2-ruby/RegApi2/Service.html) | Generic service ops |
94
+ | [bill](http://regru.github.io/reg_api2-ruby/RegApi2/Bill.html) | Billing |
95
+ | [folder](http://regru.github.io/reg_api2-ruby/RegApi2/Folder.html) | Folders for services including domains |
96
+ | [zone](http://regru.github.io/reg_api2-ruby/RegApi2/Zone.html) | Domain zone resource records (DNS) |
97
+ | [hosting](http://regru.github.io/reg_api2-ruby/RegApi2/Hosting.html) | Jelastic hosting ops at now |
98
+ | [shop](http://regru.github.io/reg_api2-ruby/RegApi2/Shop.html) | Domain Shop management functions |
96
99
 
97
100
  ## Recommendations for effective use of REG.API
98
101
 
@@ -177,7 +180,7 @@ Identification by numeric service identifiers is the most reliable and quick met
177
180
  | | **Service identification by parent service ID, service type or subtype** |
178
181
  | uplink_service_id | ID of the parent service with which the required service is associated. |
179
182
  | servtype | Service type. For example, «srv_hosting_ispmgr» for hosting or «srv_webfwd» for the web-forwarding service. |
180
- | subtype | Service subtype. For example, «pro» for the ISP Manager Pro license. |
183
+ | subtype | Service subtype. For example, «pro» for the ISP Manager Pro license. |
181
184
 
182
185
  ### Service list identification parameters
183
186
 
@@ -278,7 +281,7 @@ Error code from REG.API raised by client as exception of {RegApi2::ApiError} cla
278
281
 
279
282
  ## Documentation
280
283
 
281
- Actual documentation available at https://www.reg.com/support/help/API-version2
284
+ Actual documentation available at https://www.reg.com/support/help/api2
282
285
 
283
286
  For developers: Ruby client documentation can be accessed as:
284
287
 
@@ -50,9 +50,18 @@ module RegApi2
50
50
 
51
51
  # @!method get_deleted(opts = {})
52
52
  # Get a list of deleted domains. The function is similar to the [Deleted Domains](https://www.reg.com/domain/new/freeing_domains) page.
53
+ # Maximum returned elements in list equals to 50000.
53
54
  # @param [Hash] opts Options.
54
55
  # @note Accessibility: partners
55
56
  # @note Support of service lists: no
57
+ # @example Typical usage
58
+ # RegApi2.domain.get_deleted(
59
+ # tlds: 'ru',
60
+ # deleted_from: '2013-10-01',
61
+ # deleted_to: '2013-11-01',
62
+ # min_pr: 2,
63
+ # min_cy: 1
64
+ # )
56
65
  define :get_deleted, field: :domains
57
66
 
58
67
  # @!method check(opts = {})
@@ -288,7 +288,10 @@ module RegApi2
288
288
  # @!method refill(opts = {})
289
289
  # You can use this function to refill balance of you service. Only Jelastic (srv_jelastic) is supported at the moment.
290
290
  # @param opts Options.
291
- # @option opts [Array] mailtype Email type: `approver_email` approve ssl certificate order, `certificate_email` — certificate email.
291
+ # @option opts [Fixnum] service_id Service id to be refilled.
292
+ # @option opts [Number] amount Amount of the invoice.
293
+ # @option opts [String] currency Invoice currency (RUR, USD, EUR, UAH).
294
+ # @option opts [Boolean] ok_if_no_money Enable to create bill when not enough funds to complete the operation. In this case requested operation is stored in the system, however it will be processed after submitting "change payment method" request via web interface. Return error if this flag not set and not enough funds to complete the operation.
292
295
  # @return [Hash(service_id, bill_id etc.)]
293
296
  # @note Accessibility: clients
294
297
  # @note Support of service lists: no
@@ -0,0 +1,69 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ module RegApi2
4
+ # REG.API shop category
5
+ module Shop
6
+
7
+ include RegApi2::Builder
8
+
9
+ category :shop
10
+
11
+ # @!method nop
12
+ # @param opts Opts
13
+ # @option opts [String] :dname Domain name.
14
+ # For testing purposes. Also, with the help of this function you can check accessibility of a lot and get its ID. For this, pass username+password+dname.
15
+ # @return [String] lot identifier or nil.
16
+ define :nop
17
+
18
+ # @!method add_lot
19
+ # @param opts Opts
20
+ # adding lot/lots.
21
+ # @return [void] Nothing.
22
+ define :add_lot
23
+
24
+ # @!method add_lot
25
+ # @param opts Opts
26
+ # Update lot/lots.
27
+ # @return [void] Nothing.
28
+ define :update_lot
29
+
30
+ # @!method delete_lot
31
+ # @param opts Opts
32
+ # @option opts [String] :dname Domain list.
33
+ # delete lot/lots.
34
+ # @return [void] Nothing.
35
+ define :delete_lot, required: { dname: {} }
36
+
37
+ # @!method get_info
38
+ # @param opts Opts
39
+ # @option opts [String] :dname Domain list.
40
+ # obtain information on the lot.
41
+ # @return [Hash] Lots data.
42
+ define :get_info, required: { dname: {} }
43
+
44
+ # @!method get_lot_list
45
+ # @param opts Opts
46
+ # @option opts [Boolean] :show_my_lots "Only my items" flag.
47
+ # @option opts [Fixnum] :pg what page to show, by default - 0.
48
+ # @option opts [Fixnum] :itemsonpage how many items per page, by default - 25, possible values: 25, 50, 100, 200, 500.
49
+ # getting a list of lots.
50
+ # @return [Hash] Lots data.
51
+ define :get_lot_list
52
+
53
+ # @!method get_category_list
54
+ # @param opts Opts
55
+ # getting a list of categories.
56
+ # @return [Array] List of categories.
57
+ define :get_category_list, field: :category_list
58
+
59
+ # @!method get_category_list
60
+ # @param opts Opts
61
+ # @option opts [Fixnum] :limit the number of tags, optional, default 10, maximum 50.
62
+ # getting a list of popular tags.
63
+ # @return [Array] List of tags.
64
+ define :get_suggested_tags, field: :tags
65
+
66
+ extend self
67
+ end
68
+ end
69
+
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module RegApi2
3
3
  # Gem version.
4
- VERSION = "0.0.12".freeze
4
+ VERSION = "0.0.14".freeze
5
5
  end
data/lib/reg_api2.rb CHANGED
@@ -19,6 +19,7 @@ require 'reg_api2/bill'
19
19
  require 'reg_api2/folder'
20
20
  require 'reg_api2/zone'
21
21
  require 'reg_api2/hosting'
22
+ require 'reg_api2/shop'
22
23
 
23
24
  # Provides r/w settings for API connection:
24
25
  #
@@ -38,6 +39,7 @@ require 'reg_api2/hosting'
38
39
  # * {RegApi2.folder} API category implemented as {RegApi2::Folder} methods.
39
40
  # * {RegApi2.zone} API category implemented as {RegApi2::Zone} methods.
40
41
  # * {RegApi2.hosting} API category implemented as {RegApi2::Hosting} methods.
42
+ # * {RegApi2.shop} API category implemented as {RegApi2::Shop} methods.
41
43
  #
42
44
  # Provides dump hooks:
43
45
  #
@@ -67,7 +69,7 @@ module RegApi2
67
69
  module_function :common
68
70
 
69
71
  # Shortcut for {RegApi2::Domain} methods.
70
- # @return [Module] {RegApi2::Domain}
72
+ # @return [Module] {RegApi2::Domain}
71
73
  # @api Shortcuts
72
74
  def domain; RegApi2::Domain; end
73
75
  module_function :domain
@@ -108,6 +110,12 @@ module RegApi2
108
110
  def hosting; RegApi2::Hosting; end
109
111
  module_function :hosting
110
112
 
113
+ # Shortcut for {RegApi2::Shop} methods.
114
+ # @return [Module] {RegApi2::Shop}
115
+ # @api Shortcuts
116
+ def shop; RegApi2::Shop; end
117
+ module_function :shop
118
+
111
119
  class << self
112
120
  # @!attribute [rw] username
113
121
  # @return [String] User name (`test` by default).
data/reg.api2.gemspec CHANGED
@@ -22,7 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency "yajl-ruby", "~> 1.0"
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rspec", "~> 2.14"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "rspec-collection_matchers", "~> 1.0"
26
27
  spec.add_development_dependency "faker"
27
28
  spec.add_development_dependency "machinist"
28
29
  spec.add_development_dependency "yard", "~> 0.8"
@@ -6,64 +6,64 @@ describe RegApi2::Bill do
6
6
 
7
7
  describe :nop do
8
8
  it "should raise nothing" do
9
- lambda { bill.nop }.should_not raise_error
9
+ expect { bill.nop }.not_to raise_error
10
10
  end
11
-
11
+
12
12
  it "should return nil" do
13
- bill.nop.should be_nil
13
+ expect(bill.nop).to be_nil
14
14
  end
15
15
 
16
16
  it "should return bill if specified" do
17
- bill.nop(bill_id: 12345).should have(1).bill
17
+ expect(bill.nop(bill_id: 12345)).to have_exactly(1).bill
18
18
  end
19
19
 
20
20
  it "should return bills if specified" do
21
- bill.nop(bills: [ 12345, 12346 ]).should have(2).bills
22
- end
21
+ expect(bill.nop(bills: [ 12345, 12346 ])).to have_exactly(2).bills
22
+ end
23
23
  end
24
24
 
25
25
  describe :get_not_payed do
26
26
  it "should raise nothing" do
27
- lambda { bill.get_not_payed }.should_not raise_error
27
+ expect { bill.get_not_payed }.not_to raise_error
28
28
  end
29
29
 
30
30
  it "should return something real" do
31
- bill.get_not_payed.should have(1).bill
31
+ expect(bill.get_not_payed).to have_exactly(1).bill
32
32
  end
33
33
  end
34
34
 
35
35
  describe :get_for_period do
36
36
  it "should raise ContractError without dates" do
37
- lambda { bill.get_for_period }.should raise_error RegApi2::ContractError
37
+ expect { bill.get_for_period }.to raise_error RegApi2::ContractError
38
38
  end
39
39
 
40
40
  it "should return something real" do
41
- bill.get_for_period(
41
+ expect(bill.get_for_period(
42
42
  start_date: Date.new(2000, 1, 1),
43
43
  end_date: Date.new(2015, 1, 1)
44
- ).should have(1).bill
44
+ )).to have_exactly(1).bill
45
45
  end
46
46
  end
47
47
 
48
48
  describe :change_pay_type do
49
49
  it "should raise if no currency given" do
50
- lambda { bill.change_pay_type(
51
- pay_type: :prepay,
52
- bills: [ 123456 ]
53
- ) }.should raise_error RegApi2::ContractError
50
+ expect { bill.change_pay_type(
51
+ pay_type: :prepay,
52
+ bills: [ 123456 ]
53
+ ) }.to raise_error RegApi2::ContractError
54
54
  end
55
55
  it "should raise if no pay_type given" do
56
- lambda { bill.change_pay_type(
57
- currency: :RUR,
56
+ expect { bill.change_pay_type(
57
+ currency: :RUR,
58
58
  bills: [ 123456 ]
59
- ) }.should raise_error RegApi2::ContractError
59
+ ) }.to raise_error RegApi2::ContractError
60
60
  end
61
61
  it "should raise nothing if ok" do
62
- bill.change_pay_type(
62
+ expect(bill.change_pay_type(
63
63
  pay_type: :prepay,
64
64
  currency: :RUR,
65
65
  bills: [ 123456 ]
66
- ).should have(1).bill
66
+ )).to have_exactly(1).bill
67
67
  end
68
68
  end
69
69
 
@@ -72,9 +72,9 @@ describe RegApi2::Bill do
72
72
  ans = bill.delete(
73
73
  bills: [ { bill_id: 12345 }, { bill_id: 12346 }, { bill_id: 12347 } ]
74
74
  )
75
- ans.map { |b| b.bill_id }.should == [ 12345, 12346, 12347 ]
76
- ans.each { |b| b.result.should == 'success' }
77
- ans.each { |b| b.status.should == 'deleted' }
75
+ expect(ans.map { |b| b.bill_id }).to eq([ 12345, 12346, 12347 ])
76
+ ans.each { |b| expect(b.result).to eq('success') }
77
+ ans.each { |b| expect(b.status).to eq('deleted') }
78
78
  end
79
79
  end
80
80
  end
@@ -5,34 +5,34 @@ describe RegApi2::Common do
5
5
 
6
6
  describe :nop do
7
7
  it "should raise nothing" do
8
- lambda { common.nop }.should_not raise_error
8
+ expect { common.nop }.not_to raise_error
9
9
  end
10
10
  it "should return login" do
11
- common.nop.login.should == RegApi2.username
11
+ expect(common.nop.login).to eq(RegApi2.username)
12
12
  end
13
13
  end
14
14
 
15
15
  describe :reseller_nop do
16
16
  it "should raise nothing" do
17
- lambda { common.reseller_nop }.should_not raise_error
17
+ expect { common.reseller_nop }.not_to raise_error
18
18
  end
19
19
  it "should return login" do
20
- common.reseller_nop.login.should == RegApi2.username
20
+ expect(common.reseller_nop.login).to eq(RegApi2.username)
21
21
  end
22
22
  end
23
23
 
24
24
  describe :get_user_id do
25
25
  it "should raise nothing" do
26
- lambda { common.get_user_id }.should_not raise_error
26
+ expect { common.get_user_id }.not_to raise_error
27
27
  end
28
28
  it "should return user id" do
29
- common.get_user_id.should be_kind_of(Fixnum)
29
+ expect(common.get_user_id).to be_kind_of(Fixnum)
30
30
  end
31
31
  end
32
32
 
33
33
  describe :get_service_id do
34
34
  it "should raise nothing" do
35
- lambda { common.get_service_id(service_id: 123456) }.should_not raise_error
35
+ expect { common.get_service_id(service_id: 123456) }.not_to raise_error
36
36
  end
37
37
  it "should return user id" do
38
38
  common.get_service_id(service_id: 123456) == 123456
@@ -5,7 +5,7 @@ describe RegApi2::Domain do
5
5
 
6
6
  describe :nop do
7
7
  it "should raise nothing" do
8
- lambda { domain.nop }.should_not raise_error
8
+ expect { domain.nop }.not_to raise_error
9
9
  end
10
10
 
11
11
  it "should return service id if domain exist"
@@ -19,15 +19,28 @@ describe RegApi2::Domain do
19
19
  show_update_data: true,
20
20
  currency: :USD
21
21
  )
22
- prices.should have_key(:price_group)
23
- prices.currency.should == 'USD'
22
+ expect(prices).to have_key(:price_group)
23
+ expect(prices.currency).to eq('USD')
24
24
  end
25
25
  end
26
26
 
27
27
  describe :get_suggest do
28
28
  it "should return suggestions" do
29
29
  ans = domain.get_suggest word: 'house', additional_word: 'new', use_hyphen: false, tlds: [ :ru ]
30
- ans.should be_kind_of(Array)
30
+ expect(ans).to be_kind_of(Array)
31
+ end
32
+ end
33
+
34
+ describe :get_deleted do
35
+ it "should return deleted domains" do
36
+ ans = domain.get_deleted(
37
+ tlds: 'ru',
38
+ deleted_from: '2013-10-01',
39
+ deleted_to: '2013-11-01',
40
+ min_pr: 2,
41
+ min_cy: 1
42
+ )
43
+ expect(ans).to be_kind_of(Array)
31
44
  end
32
45
  end
33
46
  end
@@ -8,15 +8,15 @@ describe Testplate do
8
8
  let!(:plate) { Testplate.new(a: 4, b: 5) }
9
9
 
10
10
  it "should be initialized with hash" do
11
- plate.a.should == 4
12
- plate.b.should == 5
11
+ expect(plate.a).to eq(4)
12
+ expect(plate.b).to eq(5)
13
13
  end
14
14
 
15
15
  it "should return the hash" do
16
- plate.to_hash.should == { a: 4, b: 5 }
16
+ expect(plate.to_hash).to eq({ a: 4, b: 5 })
17
17
  end
18
18
 
19
19
  it "should return json" do
20
- plate.to_json.should =~ /^{.?"a":4/
20
+ expect(plate.to_json).to match(/^{.?"a":4/)
21
21
  end
22
22
  end
@@ -8,45 +8,45 @@ describe RegApi2::Folder do
8
8
 
9
9
  describe :nop do
10
10
  it "should raise nothing" do
11
- lambda { folder.nop }.should_not raise_error
11
+ expect { folder.nop }.not_to raise_error
12
12
  end
13
13
 
14
14
  it "should return default folder if no ops set" do
15
- folder.nop.should == EXAMPLE_FOLDER_DATA
15
+ expect(folder.nop).to eq(EXAMPLE_FOLDER_DATA)
16
16
  end
17
17
 
18
18
  it "should return folder data if folder_id specified" do
19
- folder.nop(folder_id: 12345).should == EXAMPLE_FOLDER_DATA
19
+ expect(folder.nop(folder_id: 12345)).to eq(EXAMPLE_FOLDER_DATA)
20
20
  end
21
21
 
22
22
  it "should return folder data if test_folder_name specified" do
23
- folder.nop(folder_name: "test_folder_name").should == EXAMPLE_FOLDER_DATA
23
+ expect(folder.nop(folder_name: "test_folder_name")).to eq(EXAMPLE_FOLDER_DATA)
24
24
  end
25
25
  end
26
26
 
27
27
  describe :create do
28
28
  it "should create a folder" do
29
- folder.create(folder_name: 'test_folder_name').should be_nil
29
+ expect(folder.create(folder_name: 'test_folder_name')).to be_nil
30
30
  end
31
31
  end
32
32
 
33
33
  describe :remove do
34
34
  it "should remove a folder by id" do
35
- folder.remove(folder_id: 123456).should be_nil
35
+ expect(folder.remove(folder_id: 123456)).to be_nil
36
36
  end
37
37
 
38
38
  it "should remove a folder by name" do
39
- folder.remove(folder_name: 'test_folder_name').should be_nil
39
+ expect(folder.remove(folder_name: 'test_folder_name')).to be_nil
40
40
  end
41
41
  end
42
42
 
43
43
  describe :rename do
44
44
  it "should rename a folder by id" do
45
- folder.rename(folder_id: 123456, new_folder_name: 'new_test_folder_name').should have_key(:folder_content)
45
+ expect(folder.rename(folder_id: 123456, new_folder_name: 'new_test_folder_name')).to have_key(:folder_content)
46
46
  end
47
47
 
48
48
  it "should rename a folder by name" do
49
- folder.rename(folder_name: 'test_folder_name', new_folder_name: 'new_test_folder_name').should have_key(:folder_content)
49
+ expect(folder.rename(folder_name: 'test_folder_name', new_folder_name: 'new_test_folder_name')).to have_key(:folder_content)
50
50
  end
51
51
  end
52
52
  end
@@ -6,19 +6,19 @@ describe RegApi2::Hosting do
6
6
 
7
7
  describe :nop do
8
8
  it "should return nil" do
9
- hosting.nop.should be_nil
9
+ expect(hosting.nop).to be_nil
10
10
  end
11
11
  end
12
12
 
13
13
  describe :get_jelastic_refill_url do
14
14
  it "should return \"https://test1.ru\"" do
15
- hosting.get_jelastic_refill_url.should == "https://test1.ru"
15
+ expect(hosting.get_jelastic_refill_url).to eq("https://test1.ru")
16
16
  end
17
17
  end
18
18
 
19
19
  describe :set_jelastic_refill_url do
20
20
  it "should return nil on success" do
21
- hosting.set_jelastic_refill_url(url: "http://ya.ru/").should be_nil
21
+ expect(hosting.set_jelastic_refill_url(url: "http://ya.ru/")).to be_nil
22
22
  end
23
23
  end
24
24
 
@@ -12,29 +12,29 @@ describe RegApi2 do
12
12
 
13
13
  it "should #create_http at first call" do
14
14
  allow(RegApi2).to receive(:create_http).once.and_return(45)
15
- RegApi2.http.should == 45
15
+ expect(RegApi2.http).to eq(45)
16
16
  end
17
17
 
18
18
  it "should not #create_http at next call" do
19
19
  allow(RegApi2).to receive(:create_http).once.and_return(45)
20
- RegApi2.http.should == 45
21
- RegApi2.http.should == 45
20
+ expect(RegApi2.http).to eq(45)
21
+ expect(RegApi2.http).to eq(45)
22
22
  end
23
23
  end
24
24
 
25
25
  describe :create_http do
26
26
  it "should create Net::HTTP object" do
27
27
  http = RegApi2.create_http
28
- http.should be_kind_of(Net::HTTP)
29
- http.should be_use_ssl
30
- http.verify_mode.should == OpenSSL::SSL::VERIFY_NONE
28
+ expect(http).to be_kind_of(Net::HTTP)
29
+ expect(http).to be_use_ssl
30
+ expect(http.verify_mode).to eq(OpenSSL::SSL::VERIFY_NONE)
31
31
  end
32
32
 
33
33
  it "should use ca_cert_path if exists" do
34
34
  allow(RegApi2).to receive(:ca_cert_path).and_return("file")
35
35
  http = RegApi2.create_http
36
- http.verify_mode.should == OpenSSL::SSL::VERIFY_PEER
37
- http.ca_file.should == "file"
36
+ expect(http.verify_mode).to eq(OpenSSL::SSL::VERIFY_PEER)
37
+ expect(http.ca_file).to eq("file")
38
38
  end
39
39
 
40
40
  it "should use pem with pem_password" do
@@ -46,8 +46,8 @@ describe RegApi2 do
46
46
  allow(OpenSSL::PKey::RSA).to receive(:new).with("pem", "pem_password").and_return(key)
47
47
 
48
48
  http = RegApi2.create_http
49
- http.cert.should == pem
50
- http.key.should == key
49
+ expect(http.cert).to eq(pem)
50
+ expect(http.key).to eq(key)
51
51
  end
52
52
 
53
53
  it "should use pem without pem_password" do
@@ -59,20 +59,20 @@ describe RegApi2 do
59
59
  allow(OpenSSL::PKey::RSA).to receive(:new).with("pem").and_return(key)
60
60
 
61
61
  http = RegApi2.create_http
62
- http.cert.should == pem
63
- http.key.should_not be_nil
62
+ expect(http.cert).to eq(pem)
63
+ expect(http.key).not_to be_nil
64
64
  end
65
65
  end
66
66
 
67
67
  describe :make_action do
68
68
 
69
69
  it "should raise ApiError with NO_SUCH_COMMAND code on absent command" do
70
- lambda do
70
+ expect do
71
71
  RegApi2.make_action(:bad, :command, {}, {})
72
- end.should raise_error RegApi2::ApiError
73
- lambda do
72
+ end.to raise_error RegApi2::ApiError
73
+ expect do
74
74
  RegApi2.make_action(:bad, :command, {}, {})
75
- end.should raise_error /NO_SUCH_COMMAND/
75
+ end.to raise_error /NO_SUCH_COMMAND/
76
76
  end
77
77
  end
78
78
  end
@@ -10,10 +10,10 @@ describe RegApi2::RequestContract do
10
10
 
11
11
  describe :initialize do
12
12
  it "should assign opts" do
13
- contract.opts.should == {
13
+ expect(contract.opts).to eq({
14
14
  required: %w[ a b ],
15
15
  optional: %w[ c d ]
16
- }
16
+ })
17
17
  end
18
18
  end
19
19
 
@@ -5,7 +5,7 @@ describe RegApi2::ResultContract do
5
5
 
6
6
  describe :initialize do
7
7
  it "should assign opts" do
8
- contract.opts.should == { a: 1, b: 4 }
8
+ expect(contract.opts).to eq({ a: 1, b: 4 })
9
9
  end
10
10
  end
11
11
 
@@ -13,18 +13,18 @@ describe RegApi2::ResultContract do
13
13
  it "should return handle_answer" do
14
14
  expected = 'OOLOLLO'
15
15
  expect(contract).to receive(:handle_answer).with({}).and_return(expected)
16
- contract.handle_result({ "answer" => {} }).should == expected
16
+ expect(contract.handle_result({ "answer" => {} })).to eq(expected)
17
17
  end
18
18
  end
19
19
 
20
20
  describe :handle_answer do
21
21
  it "should return specified value" do
22
- contract.handle_answer("FX").should == "FX"
22
+ expect(contract.handle_answer("FX")).to eq("FX")
23
23
  end
24
24
 
25
25
  it "should return field value if exists" do
26
26
  contract = RegApi2::ResultContract.new(a:1, field: :a)
27
- contract.handle_result({ answer: { "a" => "FX" } }).should == "FX"
27
+ expect(contract.handle_result({ answer: { "a" => "FX" } })).to eq("FX")
28
28
  end
29
29
  end
30
30
 
@@ -36,23 +36,23 @@ describe RegApi2::ResultContract do
36
36
  amount: "15",
37
37
  text: "2323"
38
38
  })
39
- ans.should == {
39
+ expect(ans).to eq({
40
40
  active_domains_cnt: 6,
41
41
  success: false,
42
42
  amount: 15.0,
43
43
  text: "2323"
44
- }
44
+ })
45
45
  ans = contract.convert({
46
46
  success: "1",
47
47
  })
48
- ans.should == {
48
+ expect(ans).to eq({
49
49
  success: true,
50
- }
50
+ })
51
51
  end
52
52
 
53
53
  it "should proceed arrays too" do
54
54
  ans = contract.convert([ 1, 2, [ 1 ], { amount: "4543" } ])
55
- ans.should == [ 1, 2, [ 1 ], { amount: 4543.0} ]
55
+ expect(ans).to eq([ 1, 2, [ 1 ], { amount: 4543.0} ])
56
56
  end
57
57
  end
58
58
  end