mandao 0.0.3pre4 → 0.0.3

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: 0aa8b32e91fd4baf4ec46ae90a18333efdae74aa
4
- data.tar.gz: 93a6c21dd17eed66c2815570774de4e2f20c9a4d
3
+ metadata.gz: 283514286e8a45320e9455b7ea5261e53633fffd
4
+ data.tar.gz: bfed794aab83411b262b6823f3c9afa9bd4640f2
5
5
  SHA512:
6
- metadata.gz: f93f636164df6448b672c63b8405540f61a66293a680ecfa62a5ee519de924e60814a318f413323f963f8d2251ea0e7fd218129f2affe7391eef6374de50f21d
7
- data.tar.gz: cb258c09b0999467a2e73980a5aab7071e9201137cea1197b47cfb8724b85f1652e83f71731e49074ce986bfcbbe618efe15e740d584e77d5648a03cfaa438e9
6
+ metadata.gz: dca5d0b8c7b2de887cd267fabf96673c575eb6ff04ade9dc0a57437ac3dc8d45e2158fdfb5f152b55ed328d4790c31ef5c3392f0939218139700f20ca53fca15
7
+ data.tar.gz: 35f9fb1c9202f6806746c71639b9a3cadd3d50e588a689f6774ec39e28def5f7ea97703f993ca630390efc6bcd90d5d7bf1b57f1e8e48a55fe79476c0d0a477c
@@ -1,61 +1,4 @@
1
- $:.unshift File.dirname(__FILE__)
2
-
3
- require 'rest_client'
4
- require 'active_resource'
5
-
6
1
  require 'mandao/version'
2
+ Dir.glob(File.expand_path('../resources/*', __FILE__)).each { |file| require(file) }
7
3
  require 'mandao/xml_format'
8
- require 'mandao/resources/base'
9
-
10
- module Mandao
11
-
12
- class << self
13
- attr_accessor :configuration
14
- end
15
-
16
- def self.configure
17
- self.configuration ||= Configuration.new
18
- yield(configuration)
19
- Mandao::Base.activate(api_endpoint: Mandao.config.api_endpoint, default_format: Mandao.config.format)
20
- end
21
-
22
- def self.config
23
- self.configuration
24
- end
25
-
26
- class Configuration
27
- attr_accessor :endpoint
28
- attr_accessor :username
29
- attr_accessor :password
30
- attr_accessor :protocol
31
- attr_accessor :format
32
-
33
- VALID_OPTIONS_KEYS = [:endpoint, :username, :password]
34
- REQUIRED_OPTIONS = [:username, :password]
35
- DEFAULT_PROTOCOL = "https".freeze
36
- DEFAULT_ENDPOINT = 'stage.rest.click2mail.com/v1'.freeze # TODO [ add production endpoint by default ]
37
- DEFAULT_FORMAT = ActiveResource::Formats::XmlFormat
38
-
39
- def initialize
40
- @endpoint = DEFAULT_ENDPOINT
41
- @protocol = DEFAULT_PROTOCOL
42
- @format = DEFAULT_FORMAT
43
- end
44
-
45
- def api_endpoint
46
- "#{@protocol}://#{@username}:#{@password}@#{@endpoint}/"
47
- end
48
-
49
- def valid?
50
- REQUIRED_OPTIONS.each do |opt|
51
- raise StandardError, 'You must provide username and password.' if send(opt)
52
- end
53
- end
54
-
55
- end
56
-
57
- end
58
-
59
- require 'mandao/resources/address'
60
- require 'mandao/resources/address_list'
61
- require 'mandao/resources/document'
4
+ require 'mandao/configuration'
@@ -1,3 +1,4 @@
1
+ require 'active_resource'
1
2
  require File.expand_path('../resources/base', __FILE__)
2
3
 
3
4
  module Mandao
@@ -1,3 +1,7 @@
1
+ require 'rest_client'
2
+ require 'active_resource'
3
+ require File.expand_path('../address', __FILE__)
4
+
1
5
  module Mandao
2
6
 
3
7
  class AddressListCollection < ActiveResource::Collection
@@ -1,16 +1,15 @@
1
+ require 'active_resource'
2
+ require File.expand_path('../../configuration', __FILE__)
3
+
1
4
  module Mandao
2
5
  class Base < ActiveResource::Base
3
6
  self.include_format_in_path = false
4
7
 
5
8
  class << self
6
9
 
7
- def activate(options={})
8
- begin
9
- self.site = options[:api_endpoint]
10
- self.format = options[:default_format]
11
- rescue
12
- raise 'Missing api_endpoint, default_format configuration'
13
- end
10
+ def activate
11
+ self.site = Mandao.config.api_endpoint
12
+ self.format = Mandao.config.format
14
13
  end
15
14
 
16
15
  def parse_response(xml)
@@ -1,3 +1,5 @@
1
+ require 'rest_client'
2
+
1
3
  module Mandao
2
4
 
3
5
  class DocumentCollection < ActiveResource::Collection
@@ -1,3 +1,3 @@
1
1
  module Mandao
2
- VERSION = "0.0.3pre4"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -11,14 +11,6 @@ module ActiveResource
11
11
  end
12
12
  end
13
13
 
14
- def extension
15
- "xml"
16
- end
17
-
18
- def mime_type
19
- "application/xml"
20
- end
21
-
22
14
  end
23
15
  end
24
16
  end
@@ -4,10 +4,10 @@ require 'active_resource'
4
4
  require 'rest_client'
5
5
 
6
6
  require File.expand_path('../../lib/mandao', __FILE__)
7
- # require File.expand_path('../../lib/mandao/resources/base', __FILE__)
8
- # require File.expand_path('../../lib/mandao/xml_format', __FILE__)
7
+ require File.expand_path('../../lib/mandao/resources/base', __FILE__)
8
+ require File.expand_path('../../lib/mandao/xml_format', __FILE__)
9
9
  require File.expand_path('..//mandao/stub_requests', __FILE__)
10
- # Dir.glob(File.expand_path('../../lib/mandao/resources/*', __FILE__)).each { |file| require(file) }
10
+ Dir.glob(File.expand_path('../../lib/mandao/resources/*', __FILE__)).each { |file| require(file) }
11
11
 
12
12
  RSpec.configure do |config|
13
13
  config.include WebMock::API
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandao
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3pre4
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marlon Mantilla
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-16 00:00:00.000000000 Z
11
+ date: 2014-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -138,9 +138,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - ">"
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
- version: 1.3.1
143
+ version: '0'
144
144
  requirements: []
145
145
  rubyforge_project:
146
146
  rubygems_version: 2.2.2