loopiator 0.2.0 → 0.3.0

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: 5affbb391d115c51aab353b0bc8d4875dd6195a6
4
- data.tar.gz: f258c432f16ed2bac1c688becdabfba00bfec7ab
3
+ metadata.gz: be4bd53de4c331058e0fb971f6a7d477baecb6a7
4
+ data.tar.gz: e5029296588dafd6edca92795e71760f7e0a71b6
5
5
  SHA512:
6
- metadata.gz: b07dc2ad5815511e2a6febc3ba7a0521d62ce3cafd8cfefb3a0fc620269e484cb0d3a5e5387f7971e2cccdd8ce8227f8c36bcd213715abc8e0682bf5afc09826
7
- data.tar.gz: f3af5648404af7d6132d45f8c912db20484feaa3d0475d656e6a40e7761f3e6c3cac0192a96ff7d3af021d2899e2c6f650c5e0f3dbe97786eea20d7901b3dfc9
6
+ metadata.gz: 8e8cd80be4a4918de47322b4de7b8f405f981dca9f3ec46bf3ca3624338452e458ede843326f4baa73e898d373bff572c31d5d84d2082ce78f2e809459bb8bec
7
+ data.tar.gz: 6db744b565eb45dbb941199652cbfbf2ce3b5d0efcfec78ebc6dba0d5f632b907c02e79e1909464a6bb640819a9b2e409949620c78900692b09359f120c5fb02
data/README.md CHANGED
@@ -1,4 +1,28 @@
1
- Loopiator
2
- =========
1
+ # Loopiator
2
+ Ruby gem for Interacting with Loopia.se's XML RPC API.
3
3
 
4
- Ruby Gem for Interacting with Loopia's API
4
+ ## Installation
5
+ Add the gem to your Gemfile and run bundle update:
6
+ ```ruby
7
+ gem 'loopiator'
8
+ bundle update
9
+ ```
10
+
11
+ Generate an initializer for your app:
12
+
13
+ ```ruby
14
+ rails generate loopiator username password
15
+ ```
16
+
17
+ You'll find your API credentials in Loopia's control panel.
18
+
19
+ ## Usage
20
+
21
+ Basic example:
22
+ ```ruby
23
+ client = Loopiator::Client.new
24
+ available = client.domain_is_free('google.se')
25
+ ```
26
+
27
+ ## Notes
28
+ The full Loopia API hasn't been implemented. I've just implemented the things I need for now. If you need more functionality, either implement it yourself and send a pull request or open an issue and I'll see if I have the time to implement what you need.
@@ -0,0 +1,31 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/named_base'
3
+
4
+ module Loopiator
5
+ module Generators
6
+ class LoopiatorGenerator < ::Rails::Generators::Base
7
+ argument :username, :type => :string, :banner => 'username', :default => nil
8
+ argument :password, :type => :string, :banner => 'password', :default => nil
9
+
10
+ source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
11
+
12
+ def create_initializer
13
+ say "creating initializer..."
14
+
15
+ if loopiator_already_configured?
16
+ say "It looks like you've already configured Loopiator."
17
+ say "To re-create the config file, remove it first: config/initializers/loopiator.rb"
18
+ exit
19
+ end
20
+
21
+ template 'initializer.rb', 'config/initializers/loopiator.rb', assigns: { username: username, password: password }
22
+ end
23
+
24
+ def loopiator_already_configured?
25
+ File.exists?('config/initializers/loopiator.rb')
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+
@@ -0,0 +1,4 @@
1
+ Loopiator.configure do |config|
2
+ config.username = '<%= username %>'
3
+ config.password = '<%= password %>'
4
+ end
data/lib/loopiator.rb CHANGED
@@ -1,19 +1,31 @@
1
- module Loopiator
2
- VERSION = "0.2.0"
1
+ require File.join(File.dirname(__FILE__), 'loopiator/railtie') if defined? Rails
2
+ require File.join(File.dirname(__FILE__), 'loopiator/extensions/hash') if !Hash.instance_methods(false).include?(:symbolize_keys!)
3
+ require File.join(File.dirname(__FILE__), 'loopiator/configuration')
4
+ require File.join(File.dirname(__FILE__), 'loopiator/logger')
5
+ require File.join(File.dirname(__FILE__), 'loopiator/errors')
6
+ require File.join(File.dirname(__FILE__), 'loopiator/utilities')
7
+ require File.join(File.dirname(__FILE__), 'loopiator/models/domain')
8
+ require File.join(File.dirname(__FILE__), 'loopiator/domains')
9
+ require File.join(File.dirname(__FILE__), 'loopiator/credits')
10
+ require File.join(File.dirname(__FILE__), 'loopiator/client')
3
11
 
4
- require File.join(File.dirname(__FILE__), 'loopiator/railtie') if defined?(Rails)
12
+ module Loopiator
13
+ VERSION = "0.3.0"
5
14
 
6
- if (!Hash.instance_methods(false).include?(:symbolize_keys!))
7
- require File.join(File.dirname(__FILE__), 'loopiator/extensions/hash')
15
+ class << self
16
+ attr_writer :configuration
8
17
  end
9
-
10
- require File.join(File.dirname(__FILE__), 'loopiator/logger')
11
- require File.join(File.dirname(__FILE__), 'loopiator/errors')
12
18
 
13
- require File.join(File.dirname(__FILE__), 'loopiator/models/domain')
19
+ def self.configuration
20
+ @configuration ||= Configuration.new
21
+ end
22
+
23
+ def self.reset
24
+ @configuration = Configuration.new
25
+ end
26
+
27
+ def self.configure
28
+ yield(self.configuration)
29
+ end
14
30
 
15
- require File.join(File.dirname(__FILE__), 'loopiator/domains')
16
- require File.join(File.dirname(__FILE__), 'loopiator/credits')
17
-
18
- require File.join(File.dirname(__FILE__), 'loopiator/client')
19
31
  end
@@ -1,54 +1,27 @@
1
- require 'uri'
2
- require 'cgi'
3
- require 'rubygems'
4
1
  require 'xmlrpc/client'
5
2
  require 'simpleidn'
6
3
 
7
4
  module Loopiator
8
5
  class Client
9
- attr_accessor :config, :client, :username, :password, :endpoint
6
+ attr_accessor :client
10
7
 
11
8
  include Loopiator::Logger
12
9
 
13
- def initialize(options = {})
14
- @config = set_config
15
-
16
- options.symbolize_keys!
17
- @config.merge!(options)
18
-
19
- @username = @config.fetch(:username, nil)
20
- @password = @config.fetch(:password, nil)
21
- @endpoint = @config.fetch(:endpoint, nil)
22
-
23
- timeout = options.fetch(:timeout, 500)
24
-
25
- set_client(timeout)
26
- end
27
-
28
- def set_config
29
- rails_env = defined?(Rails) ? Rails.env : "development"
30
- config ||= YAML.load_file(File.join(Rails.root, "config/loopia.yml"))[rails_env] if defined?(Rails)
31
- config ||= YAML.load_file(File.join(File.dirname(__FILE__), "../generators/templates/loopia.yml"))[rails_env] rescue nil
32
- config ||= YAML.load_file(File.join(File.dirname(__FILE__), "../generators/templates/loopia.template.yml"))[rails_env] rescue nil
33
- config ||= {}
34
-
35
- config.symbolize_keys!
36
-
37
- return config
10
+ def initialize(connection_options = nil)
11
+ set_client(connection_options)
38
12
  end
39
13
 
40
- def set_client(timeout = 500)
41
- @client = XMLRPC::Client.new_from_uri(@endpoint)
42
- @client.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE)
43
- @client.timeout = timeout
44
- @client
14
+ def set_client(connection_options = nil)
15
+ self.client = XMLRPC::Client.new_from_hash(generate_connection_options(connection_options))
16
+ self.client.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE)
17
+ self.client
45
18
  end
46
19
 
47
20
  def call(rpc_method, *args)
48
- response = ""
21
+ response = nil
49
22
 
50
23
  begin
51
- response = @client.call(rpc_method, @username, @password, *args)
24
+ response = self.client.call(rpc_method, Loopiator.configuration.username, Loopiator.configuration.password, *args)
52
25
 
53
26
  rescue EOFError => eof_error
54
27
  raise Loopiator::ConnectionError
@@ -58,7 +31,7 @@ module Loopiator
58
31
  end
59
32
 
60
33
  def parse_status_response(response)
61
- response = response.downcase.to_sym
34
+ response = response.downcase.to_sym
62
35
 
63
36
  case response
64
37
  when :ok then return response
@@ -74,5 +47,21 @@ module Loopiator
74
47
 
75
48
  include Loopiator::Domains
76
49
  include Loopiator::Credits
50
+
51
+ private
52
+ def generate_connection_options(connection_options = nil)
53
+ connection_options ||= {
54
+ host: Loopiator.configuration.host,
55
+ path: Loopiator.configuration.path,
56
+ port: Loopiator.configuration.port,
57
+ use_ssl: Loopiator.configuration.use_ssl,
58
+ timeout: Loopiator.configuration.timeout,
59
+ proxy_host: Loopiator.configuration.proxy_host,
60
+ proxy_port: Loopiator.configuration.proxy_port,
61
+ user: Loopiator.configuration.proxy_user,
62
+ password: Loopiator.configuration.proxy_password,
63
+ }
64
+ end
65
+
77
66
  end
78
67
  end
@@ -0,0 +1,26 @@
1
+ module Loopiator
2
+ class Configuration
3
+ attr_accessor :host, :port, :path
4
+ attr_accessor :use_ssl, :timeout
5
+ attr_accessor :username, :password
6
+ attr_accessor :proxy_host, :proxy_port, :proxy_user, :proxy_password
7
+
8
+ def initialize
9
+ self.host = "api.loopia.se"
10
+ self.port = 443
11
+ self.path = "/RPCSERV"
12
+
13
+ self.use_ssl = true
14
+ self.timeout = 180
15
+
16
+ self.username = nil
17
+ self.password = nil
18
+
19
+ self.proxy_host = nil
20
+ self.proxy_port = nil
21
+ self.proxy_user = nil
22
+ self.proxy_password = nil
23
+ end
24
+
25
+ end
26
+ end
@@ -2,12 +2,12 @@ module Loopiator
2
2
  module Credits
3
3
 
4
4
  # https://www.loopia.se/api/getcreditsamount/
5
- def get_credits_amount(with_vat = true, customer_number = "")
5
+ def get_credits_amount(include_vat: true, customer_number: "")
6
6
  call("getCreditsAmount", customer_number, with_vat).to_f
7
7
  end
8
8
 
9
9
  # https://www.loopia.se/api/payinvoiceusingcredits/
10
- def pay_invoice_using_credits(reference_number, customer_number = "")
10
+ def pay_invoice_using_credits(reference_number, customer_number: "")
11
11
  parse_status_response(call("payInvoiceUsingCredits", customer_number, reference_number.to_s))
12
12
  end
13
13
 
@@ -7,7 +7,7 @@ module Loopiator
7
7
  return response.eql?(:ok)
8
8
  end
9
9
 
10
- def get_domain(domain_name, customer_number = "")
10
+ def get_domain(domain_name, customer_number: "")
11
11
  domain = nil
12
12
  response = call("getDomain", customer_number, encode_domain(domain_name))
13
13
 
@@ -31,7 +31,7 @@ module Loopiator
31
31
  ordered = order_domain(domain_name, accept_terms: true, customer_number: customer_number, raise_exception_on_occupied: raise_exception_on_occupied)
32
32
 
33
33
  if (ordered)
34
- domain = get_domain(domain_name, customer_number)
34
+ domain = get_domain(domain_name, customer_number: customer_number)
35
35
 
36
36
  if (domain && domain.needs_to_be_paid? && !domain.reference_number.nil? && !domain.reference_number.empty?)
37
37
  success = pay_invoice_using_credits(domain.reference_number, customer_number)
@@ -43,7 +43,7 @@ module Loopiator
43
43
 
44
44
  private
45
45
  def encode_domain(domain_name)
46
- SimpleIDN.to_ascii(domain_name)
46
+ Loopiator::Utilities.encode_domain(domain_name)
47
47
  end
48
48
 
49
49
  end
@@ -0,0 +1,9 @@
1
+ module Loopiator
2
+ class Utilities
3
+
4
+ def self.encode_domain(domain_name)
5
+ SimpleIDN.to_ascii(domain_name)
6
+ end
7
+
8
+ end
9
+ end
data/loopiator.gemspec CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'loopiator'
6
- s.version = '0.2.0'
6
+ s.version = '0.3.0'
7
7
 
8
8
  s.homepage = "https://github.com/Agiley/Loopiator"
9
9
  s.email = "sebastian@agiley.se"
@@ -15,17 +15,17 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.add_development_dependency 'rake'
17
17
  s.add_development_dependency 'rspec'
18
- s.add_development_dependency 'mocha'
19
18
 
20
19
  # = MANIFEST =
21
20
  s.files = %w[
22
21
  Gemfile
23
22
  README.md
24
23
  Rakefile
25
- lib/generators/loopiator/loopiator_generator.rb
26
- lib/generators/templates/loopia.template.yml
24
+ lib/generators/loopiator_generator.rb
25
+ lib/generators/templates/initializer.rb
27
26
  lib/loopiator.rb
28
27
  lib/loopiator/client.rb
28
+ lib/loopiator/configuration.rb
29
29
  lib/loopiator/credits.rb
30
30
  lib/loopiator/domains.rb
31
31
  lib/loopiator/errors.rb
@@ -33,11 +33,13 @@ Gem::Specification.new do |s|
33
33
  lib/loopiator/logger.rb
34
34
  lib/loopiator/models/domain.rb
35
35
  lib/loopiator/railtie.rb
36
+ lib/loopiator/utilities.rb
36
37
  loopiator.gemspec
37
- spec/loopiator/client_spec.rb
38
+ spec/loopiator/configuration_spec.rb
38
39
  spec/loopiator/credits_spec.rb
39
40
  spec/loopiator/domains_spec.rb
40
41
  spec/spec_helper.rb
42
+ spec/support/helpers.rb
41
43
  ]
42
44
  # = MANIFEST =
43
45
 
@@ -0,0 +1,81 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ describe "Loopiator Configuration" do
4
+ context "When configuring Loopiator" do
5
+
6
+ context "Using defaults" do
7
+ it "should not have a username set" do
8
+ expect(Loopiator.configuration.username).to be == nil
9
+ end
10
+
11
+ it "should not have a password set" do
12
+ expect(Loopiator.configuration.password).to be == nil
13
+ end
14
+
15
+ it "should have a default host set" do
16
+ expect(Loopiator.configuration.host).to be == "api.loopia.se"
17
+ end
18
+
19
+ it "should have a default port set" do
20
+ expect(Loopiator.configuration.port).to be == 443
21
+ end
22
+
23
+ it "should have a default path set" do
24
+ expect(Loopiator.configuration.path).to be == "/RPCSERV"
25
+ end
26
+
27
+ it "should have a default timeout set" do
28
+ expect(Loopiator.configuration.timeout).to be == 180
29
+ end
30
+ end
31
+
32
+ context "Using custom configuration" do
33
+ before :each do
34
+ Loopiator.configure do |config|
35
+ config.username = "test_user"
36
+ config.password = "test_password"
37
+ config.timeout = 200
38
+ config.proxy_host = "192.1.1.1"
39
+ config.proxy_port = 8080
40
+ end
41
+ end
42
+
43
+ after :each do
44
+ Loopiator.reset
45
+ end
46
+
47
+ it "should have a custom username set" do
48
+ expect(Loopiator.configuration.username).to be == "test_user"
49
+ end
50
+
51
+ it "should have a custom password set" do
52
+ expect(Loopiator.configuration.password).to be == "test_password"
53
+ end
54
+
55
+ it "should have a custom timeout set" do
56
+ expect(Loopiator.configuration.timeout).to be == 200
57
+ end
58
+
59
+ it "should have a custom proxy host set" do
60
+ expect(Loopiator.configuration.proxy_host).to be == "192.1.1.1"
61
+ end
62
+
63
+ it "should have a custom proxy port set" do
64
+ expect(Loopiator.configuration.proxy_port).to be == 8080
65
+ end
66
+
67
+ it "should have a default host set" do
68
+ expect(Loopiator.configuration.host).to be == "api.loopia.se"
69
+ end
70
+
71
+ it "should have a default port set" do
72
+ expect(Loopiator.configuration.port).to be == 443
73
+ end
74
+
75
+ it "should have a default path set" do
76
+ expect(Loopiator.configuration.path).to be == "/RPCSERV"
77
+ end
78
+ end
79
+
80
+ end
81
+ end
@@ -2,27 +2,26 @@
2
2
 
3
3
  require File.expand_path('../../spec_helper', __FILE__)
4
4
 
5
- describe "Credits Management -" do
5
+ describe "Credits Management" do
6
6
 
7
- before(:each) do
7
+ before :each do
8
8
  @client = Loopiator::Client.new
9
9
  end
10
10
 
11
- describe "When managing my credits:" do
12
-
11
+ after :each do
12
+ Loopiator.reset
13
+ end
14
+
15
+ context "When managing my credits:" do
13
16
  it "I should be able to check how many credits I currently have (with VAT)" do
14
- @client.expects(:get_credits_amount).with(true).once.returns(125)
15
- remaining_credits = @client.get_credits_amount(true)
16
- remaining_credits.should == 125
17
+ expect(@client).to receive(:get_credits_amount).with(include_vat: true).and_return(125)
18
+ expect(@client.get_credits_amount(include_vat: true)).to be == 125
17
19
  end
18
20
 
19
21
  it "I should be able to check how many credits I currently have (without VAT)" do
20
- @client.expects(:get_credits_amount).with(false).once.returns(100)
21
- remaining_credits = @client.get_credits_amount(false)
22
- remaining_credits.should == 100
22
+ expect(@client).to receive(:get_credits_amount).with(include_vat: false).and_return(100)
23
+ expect(@client.get_credits_amount(include_vat: false)).to be == 100
23
24
  end
24
-
25
25
  end
26
26
 
27
- end
28
-
27
+ end
@@ -2,30 +2,35 @@
2
2
 
3
3
  require File.expand_path('../../spec_helper', __FILE__)
4
4
 
5
- describe "Domain Management -" do
5
+ describe "Domain Management" do
6
6
 
7
- before(:each) do
7
+ before :each do
8
+ set_configuration_with_real_credentials if real_credentials_available?
8
9
  @client = Loopiator::Client.new
9
10
  end
10
11
 
11
- describe "When checking domain availability:" do
12
-
12
+ after :each do
13
+ Loopiator.reset
14
+ end
15
+
16
+ context "When checking domain availability:" do
13
17
  it "I should be able to check that a domain is available" do
14
- @client.domain_is_free('dsadsadsadsadsadsadasdas.se').should == true
18
+ expect(@client).to receive(:domain_is_free).with('dsadsadsadsadsadsadasdas.se').and_return(true) unless real_credentials_available?
19
+ expect(@client.domain_is_free('dsadsadsadsadsadsadasdas.se')).to be == true
15
20
  end
16
-
21
+
17
22
  it "I should be able to check if a domain is not available" do
18
- @client.domain_is_free('aftonbladet.se').should == false
23
+ expect(@client).to receive(:domain_is_free).with('aftonbladet.se').and_return(false) unless real_credentials_available?
24
+ expect(@client.domain_is_free('aftonbladet.se')).to be == false
19
25
  end
20
-
26
+
21
27
  it "I should be able to check if an IDN-domain is available" do
22
- @client.domain_is_free('såhärtestarmanenidndomänkanske.se').should == true
28
+ expect(@client).to receive(:domain_is_free).with('såhärtestarmanenidndomänkanske.se').and_return(true) unless real_credentials_available?
29
+ expect(@client.domain_is_free('såhärtestarmanenidndomänkanske.se')).to be == true
23
30
  end
24
-
25
31
  end
26
-
27
- describe "When managing my domains:" do
28
-
32
+
33
+ context "When managing domains" do
29
34
  it "I should be able to check the details for a domain that I own" do
30
35
  hash = {"paid" => 1,
31
36
  "unpaid_amount" => 0,
@@ -35,19 +40,19 @@ describe "Domain Management -" do
35
40
  "expiration_date" => "UNKNOWN",
36
41
  "reference_no" => "999999"
37
42
  }
38
-
43
+
39
44
  mock = Loopiator::Models::Domain.new(hash)
40
-
41
- @client.expects(:get_domain).with('testdomain.se').once.returns(mock)
42
-
45
+
46
+ expect(@client).to receive(:get_domain).with('testdomain.se').and_return(mock)
47
+
43
48
  domain = @client.get_domain('testdomain.se')
44
-
45
- domain.paid?.should == true
46
- domain.needs_to_be_paid?.should == false
47
- domain.registered?.should == true
48
- domain.reference_number.should == "999999"
49
+
50
+ expect(domain.paid?).to be == true
51
+ expect(domain.needs_to_be_paid?).to be == false
52
+ expect(domain.registered?).to be == true
53
+ expect(domain.reference_number).to be == "999999"
49
54
  end
50
-
55
+
51
56
  it "I should be able to see that a domain hasn't been paid for yet." do
52
57
  hash = {"paid" => 0,
53
58
  "unpaid_amount" => 99,
@@ -57,19 +62,19 @@ describe "Domain Management -" do
57
62
  "expiration_date" => "UNKNOWN",
58
63
  "reference_no" => "1111111"
59
64
  }
60
-
65
+
61
66
  mock = Loopiator::Models::Domain.new(hash)
62
-
63
- @client.expects(:get_domain).with('testdomain.se').once.returns(mock)
64
-
67
+
68
+
69
+ expect(@client).to receive(:get_domain).with('testdomain.se').and_return(mock)
70
+
65
71
  domain = @client.get_domain('testdomain.se')
66
-
67
- domain.paid?.should == false
68
- domain.needs_to_be_paid?.should == true
69
- domain.unpaid_amount.should == 99
70
- domain.reference_number.should == "1111111"
72
+
73
+ expect(domain.paid?).to be == false
74
+ expect(domain.needs_to_be_paid?).to be == true
75
+ expect(domain.unpaid_amount).to be == 99
76
+ expect(domain.reference_number).to be == "1111111"
71
77
  end
72
-
73
78
  end
74
-
79
+
75
80
  end
data/spec/spec_helper.rb CHANGED
@@ -21,6 +21,19 @@ Bundler.require
21
21
 
22
22
  require File.expand_path('../../lib/loopiator', __FILE__)
23
23
 
24
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
25
+
24
26
  RSpec.configure do |config|
25
- config.mock_with :mocha
27
+ config.include(Helpers)
28
+
29
+ config.color = true
30
+ config.formatter = 'documentation'
31
+
32
+ config.expect_with :rspec do |expectations|
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ config.mock_with :rspec do |mocks|
37
+ mocks.verify_partial_doubles = true
38
+ end
26
39
  end
@@ -0,0 +1,18 @@
1
+ require 'yaml'
2
+
3
+ module Helpers
4
+ def real_credentials_available?
5
+ ::File.exists?(File.join(File.dirname(__FILE__), 'credentials.yml'))
6
+ end
7
+
8
+ def set_configuration_with_real_credentials
9
+ cfg = ::YAML.load_file(File.join(File.dirname(__FILE__), 'credentials.yml'))
10
+
11
+ ::Loopiator.configure do |config|
12
+ cfg.each do |key, value|
13
+ config.send("#{key}=", value)
14
+ end
15
+ end
16
+ end
17
+
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loopiator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Johnsson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-01 00:00:00.000000000 Z
11
+ date: 2015-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simpleidn
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: mocha
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  description: Interface for communicating with Loopia's API
70
56
  email: sebastian@agiley.se
71
57
  executables: []
@@ -75,10 +61,11 @@ files:
75
61
  - Gemfile
76
62
  - README.md
77
63
  - Rakefile
78
- - lib/generators/loopiator/loopiator_generator.rb
79
- - lib/generators/templates/loopia.template.yml
64
+ - lib/generators/loopiator_generator.rb
65
+ - lib/generators/templates/initializer.rb
80
66
  - lib/loopiator.rb
81
67
  - lib/loopiator/client.rb
68
+ - lib/loopiator/configuration.rb
82
69
  - lib/loopiator/credits.rb
83
70
  - lib/loopiator/domains.rb
84
71
  - lib/loopiator/errors.rb
@@ -86,11 +73,13 @@ files:
86
73
  - lib/loopiator/logger.rb
87
74
  - lib/loopiator/models/domain.rb
88
75
  - lib/loopiator/railtie.rb
76
+ - lib/loopiator/utilities.rb
89
77
  - loopiator.gemspec
90
- - spec/loopiator/client_spec.rb
78
+ - spec/loopiator/configuration_spec.rb
91
79
  - spec/loopiator/credits_spec.rb
92
80
  - spec/loopiator/domains_spec.rb
93
81
  - spec/spec_helper.rb
82
+ - spec/support/helpers.rb
94
83
  homepage: https://github.com/Agiley/Loopiator
95
84
  licenses: []
96
85
  metadata: {}
@@ -110,12 +99,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
99
  version: 1.3.5
111
100
  requirements: []
112
101
  rubyforge_project:
113
- rubygems_version: 2.4.5
102
+ rubygems_version: 2.4.8
114
103
  signing_key:
115
104
  specification_version: 2
116
105
  summary: Interface for communicating with Loopia's API
117
106
  test_files:
118
- - spec/loopiator/client_spec.rb
107
+ - spec/loopiator/configuration_spec.rb
119
108
  - spec/loopiator/credits_spec.rb
120
109
  - spec/loopiator/domains_spec.rb
121
110
  - spec/spec_helper.rb
111
+ - spec/support/helpers.rb
@@ -1,18 +0,0 @@
1
- require 'generators/helpers/file_helper'
2
-
3
- module Loopiator
4
- module Generators
5
- class LoopiatorGenerator < Rails::Generators::Base
6
- namespace "loopiator"
7
- source_root File.expand_path("../../templates", __FILE__)
8
-
9
- desc "Copies loopia.yml to the Rails app's config directory."
10
-
11
- def copy_config
12
- template "loopia.template.yml", "config/loopia.yml"
13
- end
14
-
15
- end
16
- end
17
- end
18
-
@@ -1,16 +0,0 @@
1
- ---
2
- development:
3
- username: "your-username"
4
- password: "your-password"
5
- endpoint: "https://api.loopia.se/RPCSERV"
6
-
7
- test:
8
- username: "your-username"
9
- password: "your-password"
10
- endpoint: "https://api.loopia.se/RPCSERV"
11
-
12
- production:
13
- username: "your-username"
14
- password: "your-password"
15
- endpoint: "https://api.loopia.se/RPCSERV"
16
-
@@ -1,33 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
-
3
- describe "Loopiator Api Client" do
4
- describe "- When initializing a new client" do
5
-
6
- describe "- With defaults:" do
7
- before(:each) do
8
- config = {username: "test_user",
9
- password: "test_password",
10
- endpoint: "https://api.loopia.se/RPCSERV" }
11
-
12
- Loopiator::Client.any_instance.expects(:set_config).at_least_once.returns(config)
13
-
14
- @client = Loopiator::Client.new(config)
15
- end
16
-
17
- it "should have a username set" do
18
- @client.username.should == "test_user"
19
- end
20
-
21
- it "should have a password set" do
22
- @client.password.should == "test_password"
23
- end
24
-
25
- it "should have an endpoint set" do
26
- @client.endpoint.should == "https://api.loopia.se/RPCSERV"
27
- end
28
-
29
- end
30
-
31
- end
32
- end
33
-