reg.api2 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -61,9 +61,10 @@ Your default username: "test", and You can change it with "~/.regapi2".
61
61
  ```
62
62
 
63
63
  ## Recommendations for effective use of REG.API
64
+
64
65
  This section provides information that will help you to make you work with REG.API more productive and convenient.
65
66
 
66
- One of the most frequent problems our partners face when working with REG.API is exceeding the maximum request limit (1,200 requests per hour).
67
+ One of the most frequent problems our partners face when working with REG.API is exceeding the maximum request limit (1,200 requests per hour for user/ip). Both limits are acting at the same time. If the limits has exceeded then REG.API sets the error code (depends on kind of) to `IP_EXCEEDED_ALLOWED_CONNECTION_RATE` or `ACCOUNT_EXCEEDED_ALLOWED_CONNECTION_RATE`, that raised by client as exception of {RegApi2::ApiError} class.
67
68
 
68
69
  The analysis of such situations showed that in most cases such problems are the results of improper use or misuse of REG.API due to bugs or design faults in the software used by partners.
69
70
 
@@ -92,12 +93,20 @@ The recommendations below will, on the one hand, allow you to preclude situation
92
93
  * In case of connection failures the request can be repeated until it is executed (this significantly increases the system reliability).
93
94
  * In case of request processing errors (if REG.RU returned an error code), you can fix the problem and repeat the request, while the customer will not get any error messages. You can solve the major part of your customers’ problems on your own without their participation.
94
95
 
95
- 4. It is a good practice to keep logs of all API request and responses. If a problem arises, logs will help you or our support engineers to efficiently locate and solve it.
96
+ 4. Use bulk operations whenever possible. A lot of methods support operations over lists of services and domains at once.
97
+
98
+ 5. It is a good practice to keep logs of all API request and responses. If a problem arises, logs will help you or our support engineers to efficiently locate and solve it.
96
99
 
97
100
  We hope that this information will be useful for you and that it will help you to optimize your work with REG.API.
98
101
 
99
102
  ## REG.API 2.0 overview
100
103
 
104
+ ### General interaction principles
105
+
106
+ Each call of a function is atomic and synchronous, i.e. all requests are independent. All operations are also synchronous: the result of an operation returns immediately, there are no any intermediate stages during execution of operations. The choice in favor of this interaction method was made to simplify the customers’ work flow with REG.API.
107
+
108
+ Parallel processing of calls is available to requests not changing balance of the client on the account of REG.API provider.
109
+
101
110
  ### Method accessibility
102
111
 
103
112
  All REG.API methods can be divided into categories of accessibility. On Ruby documentation accessibility marked by note. At the moment the following categories of accessibility present:
@@ -160,6 +169,79 @@ This section describes the parameters common for the functions dealing with serv
160
169
  | pay_type | Payment option. Currently available payment options: (WM, bank, pbank, prepay, yamoney, rapida, robox, paymer, cash, chronopay). Default value: prepay. Please note that automatic payments can be done only if the selected payment method is «prepay» and you have enough funds in your account. Otherwise, your order will be marked as unpaid and you will have to arrange the payment manually from your profile page. |
161
170
  | 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. |
162
171
 
172
+ ### Common error codes
173
+
174
+ Error code from REG.API raised by client as exception of {RegApi2::ApiError} class. Test its `message` or `to_s` to know what happens.
175
+
176
+ | Error_code | Description |
177
+ |------------|-------------|
178
+ | | **Authorization errors** |
179
+ | NO_USERNAME | Username is not specified. |
180
+ | NO_AUTH | Method of authorization is not determined (probably, the password or signature fields are not found). |
181
+ | PASSWORD_AUTH_FAILED | Password authentification failed. |
182
+ | RESELLER_AUTH_FAILED | This function is available only for the Partners. |
183
+ | ACCESS_DENIED | Your access to the API is blocked, please refer to the technical support. |
184
+ | PURCHASES_DISABLED | Buying/selling is forbidden for the given account. |
185
+ | | **Errors of domains, services, folders identification** |
186
+ | DOMAIN_NOT_FOUND | Domain `domain_name` is not found, or you are not the owner. |
187
+ | SERVICE_NOT_FOUND | Service `servtype` for domain `domain_name` is not found. |
188
+ | SERVICE_NOT_SPECIFIED | Error of the service identification. |
189
+ | SERVICE_ID_NOT_FOUND | Service `service_id` is not found, or you are not the owner. |
190
+ | NO_DOMAIN | domain_name is not specified or blank |
191
+ | INVALID_DOMAIN_NAME_FORMAT | Format domain_name is not valid or domain is in unserviced TLD. |
192
+ | INVALID_SERVICE_ID | Format of service_id is not valid.
193
+ | INVALID_DOMAIN_NAME_PUNYCODE | The value of punycode for domain_name is not valid. |
194
+ | BAD_USER_SERVID | Invalid value for user_servid. |
195
+ | USER_SERVID_IS_NOT_UNIQUE | Non-unique field value user_servid at service/domain order. |
196
+ | TOO_MANY_OBJECTS_IN_ONE_REQUEST | Too many objects are indicated (more than 1000) in one request. |
197
+ | | **Accessibility errors** |
198
+ | SERVICE_UNAVAILABLE | Reg.API is temporarily unavailable |
199
+ | BILLING_LOCK | You have another active connection for financial operation to Reg.API |
200
+ | DOMAIN_BAD_NAME | Not valid name: `domain_name` |
201
+ | DOMAIN_BAD_NAME_ONLYDIGITS | Domain registration, which name contains only numbers is not acceptable for the given TLD |
202
+ | HAVE_MIXED_CODETABLES | It is unacceptable to mix national and Latin letters in the domain name |
203
+ | DOMAIN_BAD_TLD | Domain registration with `tld` extension is not available |
204
+ | TLD_DISABLED | Domain registration with `tld` extension is disabled |
205
+ | DOMAIN_NAME_MUSTBEENG | National letters are unacceptable in the domain name for the given extension (`tld`) |
206
+ | DOMAIN_NAME_MUSTBERUS | Latin letters are unacceptable in the domain name for the given extension (`tld`) |
207
+ | DOMAIN_ALREADY_EXISTS | The domain already exists, check via whois. |
208
+ | DOMAIN_INVALID_LENGTH | Invalid length of the domain name, you have entered either too short or too long name |
209
+ | DOMAIN_STOP_LIST | Unacceptable name, this domain is reserved, or it’s a premium-domain, which is offered at a special price |
210
+ | DOMAIN_STOP_PATTERN | Unfortunately, it’s impossible to register the name (`domain_name`) |
211
+ | FREE_DATE_IN_FUTURE | Domain’s release date of `domain_name` will be in future, AFTER the next date of the mass domain release |
212
+ | NO_DOMAINS_CHECKED | You haven’t selected any domain for registration |
213
+ | NO_CONTRACT | Filing an application for pre-term domain name registration is not possible after release before signing your contract about domain registration |
214
+ | INVALID_PUNYCODE_INPUT | Incorrect punycode name (error at the process of coding into Punycode) |
215
+ | CONNECTION_FAILED | Unable to check status of the domain: Can not connect the server. Please, try again later. |
216
+ | DOMAIN_ALREADY_ORDERED | Domain name `domain_name` has been already ordered by you before, You can pay for it, and the application for registration shall be done. |
217
+ | DOMAIN_EXPIRED | Unfortunately, the period of domain delegation of `domain_name` either has expired or will expire in the nearest future |
218
+ | DOMAIN_TOO_YOUNG | Unfortunately, less than 60 days have passed from the moment of domain `domain_name` registration, try to transfer the domain later |
219
+ | CANT_OBTAIN_EXPDATE | Impossible to determine the date of the domain delegation of `domain_name` |
220
+ | DOMAIN_CLIENT_TRANSFER_PROHIBITED | Domain `domain_name` is prohibited for transfer, contact the previous registrar to unlock the domain |
221
+ | DOMAIN_TRANSFER_PROHIBITED_UNKNOWN | Domain `domain_name` is prohibited for transfer by the upstream registrar, contact Technical Support for details |
222
+ | DOMAIN_REGISTERED_VIA_DIRECTI | Automatic transfer of the domain name `domain_name` within DirectI is prohibited |
223
+ | NOT_FOUND_UNIQUE_REQUIRED_DATA | The data for checking the uniqueness are not found: dname, servtype or user_id |
224
+ | ORDER_ALREADY_PAYED | Order on `dname` `servtype` is already payed |
225
+ | DOUBLE_ORDER | You already have not payed order on `dname` `servtype` |
226
+ | DOMAIN_ORDER_LOCKED | The order of the domain is disabled since processing of other order for the same domain isn't completed yet |
227
+ | UNAVAILABLE_DOMAIN_ZONE | `tld` is unavailable domain zone |
228
+ | | **Errors at working with DNS servers** |
229
+ | DOMAIN_IS_NOT_USE_REGRU_NSS | This domain does not use the DNS-server of REG.RU |
230
+ | REVERSE_ZONE_API_NOT_SUPPORTED | Configuring of reverse zones are currently not supported |
231
+ | ZONES_VARY | The domains in the list have different TLD configurations |
232
+ | IP_INVALID | Error in IP address. |
233
+ | SUBD_INVALID | Invalid subdomain |
234
+ | CONFLICT_CNAME | It’s impossible to indicate CNAME logs for a single subdomain together with other logs |
235
+ | | **Other errors** |
236
+ | NO_SUCH_COMMAND | Command `command_name` is not found |
237
+ | HTTPS_ONLY | Access to API via an unsecured interface (http) is prohibited! Please, use https. |
238
+ | PARAMETER_MISSING | `param`('s) is (are) not found.
239
+ | PARAMETER_INCORRECT | `param` has incorrect format or data. |
240
+ | NOT_ENOUGH_MONEY | Not enough money at account for this operation. |
241
+ | INTERNAL_ERROR | Internal error: `error_details`, inform the developers. |
242
+ | SERVICE_OPERATIONS_DISABLED | Service operations are prohibited |
243
+ | UNSUPPORTED_CURRENCY | Currency is not supported in the given system |
244
+
163
245
  ## Documentation
164
246
 
165
247
  Actual documentation available at https://www.reg.com/support/help/API-version2
data/lib/reg_api2/impl.rb CHANGED
@@ -5,12 +5,14 @@ require 'net/https'
5
5
  require 'yajl'
6
6
 
7
7
  module RegApi2
8
- # Networking Error
9
- class NetError < Exception
8
+ # Networking Error.
9
+ # Raised when response doesn't meet HTTP 200 OK status.
10
+ class NetError < IOError
10
11
  end
11
12
 
12
- # API Contract Error
13
- class ContractError < Exception
13
+ # API Contract Error.
14
+ # Raised when input parameters doesn't pass Ruby client tests.
15
+ class ContractError < ArgumentError
14
16
  # @!attribute [r] fields
15
17
  # Wrong fields.
16
18
  attr_reader :fields
@@ -21,8 +23,9 @@ module RegApi2
21
23
  end
22
24
  end
23
25
 
24
- # API Error
25
- class ApiError < Exception
26
+ # API Error from REG.API provider.
27
+ # Please refer to {file:README.md#Common_error_codes common error codes}.
28
+ class ApiError < StandardError
26
29
  # @!attribute [r] description
27
30
  # Localized error description.
28
31
  attr_reader :description
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module RegApi2
3
3
  # Gem version.
4
- VERSION = "0.0.5".freeze
4
+ VERSION = "0.0.6".freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reg.api2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-04 00:00:00.000000000 Z
12
+ date: 2013-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yajl-ruby
@@ -252,7 +252,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
252
  version: '0'
253
253
  segments:
254
254
  - 0
255
- hash: -3976809343195065454
255
+ hash: -909380386582521799
256
256
  required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  none: false
258
258
  requirements:
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
261
  version: '0'
262
262
  segments:
263
263
  - 0
264
- hash: -3976809343195065454
264
+ hash: -909380386582521799
265
265
  requirements: []
266
266
  rubyforge_project:
267
267
  rubygems_version: 1.8.24