geocerts 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.14
1
+ 0.0.15
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{geocerts}
8
- s.version = "0.0.14"
8
+ s.version = "0.0.15"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["GeoCerts, Inc."]
@@ -36,12 +36,14 @@ Gem::Specification.new do |s|
36
36
  "lib/geo_certs/endpoints/agreements.rb",
37
37
  "lib/geo_certs/endpoints/certificates.rb",
38
38
  "lib/geo_certs/endpoints/events.rb",
39
+ "lib/geo_certs/endpoints/hello.rb",
39
40
  "lib/geo_certs/endpoints/orders.rb",
40
41
  "lib/geo_certs/endpoints/products.rb",
41
42
  "lib/geo_certs/errors.rb",
42
43
  "lib/geo_certs/event.rb",
43
44
  "lib/geo_certs/exceptions.rb",
44
45
  "lib/geo_certs/hash_extension.rb",
46
+ "lib/geo_certs/hello.rb",
45
47
  "lib/geo_certs/order.rb",
46
48
  "lib/geo_certs/order/administrator.rb",
47
49
  "lib/geo_certs/order/contact.rb",
@@ -61,12 +63,14 @@ Gem::Specification.new do |s|
61
63
  "test/fixtures/responses/agreement.rb",
62
64
  "test/fixtures/responses/certificate.rb",
63
65
  "test/fixtures/responses/event.rb",
66
+ "test/fixtures/responses/hello.rb",
64
67
  "test/fixtures/responses/order.rb",
65
68
  "test/fixtures/responses/product.rb",
66
69
  "test/integrations/agreement_test.rb",
67
70
  "test/integrations/api_test.rb",
68
71
  "test/integrations/certificate_test.rb",
69
72
  "test/integrations/event_test.rb",
73
+ "test/integrations/hello_test.rb",
70
74
  "test/integrations/order_test.rb",
71
75
  "test/integrations/product_test.rb",
72
76
  "test/test_helper.rb",
@@ -95,6 +99,7 @@ Gem::Specification.new do |s|
95
99
  "test/fixtures/responses/agreement.rb",
96
100
  "test/fixtures/responses/certificate.rb",
97
101
  "test/fixtures/responses/event.rb",
102
+ "test/fixtures/responses/hello.rb",
98
103
  "test/fixtures/responses/order.rb",
99
104
  "test/fixtures/responses/product.rb",
100
105
  "test/fixtures/responses.rb",
@@ -102,6 +107,7 @@ Gem::Specification.new do |s|
102
107
  "test/integrations/api_test.rb",
103
108
  "test/integrations/certificate_test.rb",
104
109
  "test/integrations/event_test.rb",
110
+ "test/integrations/hello_test.rb",
105
111
  "test/integrations/order_test.rb",
106
112
  "test/integrations/product_test.rb",
107
113
  "test/test_helper.rb",
@@ -7,11 +7,13 @@ require 'geo_certs/order'
7
7
  require 'geo_certs/certificate'
8
8
  require 'geo_certs/agreement'
9
9
  require 'geo_certs/event'
10
+ require 'geo_certs/hello'
10
11
  require 'geo_certs/endpoints/orders'
11
12
  require 'geo_certs/endpoints/certificates'
12
13
  require 'geo_certs/endpoints/agreements'
13
14
  require 'geo_certs/endpoints/products'
14
15
  require 'geo_certs/endpoints/events'
16
+ require 'geo_certs/endpoints/hello'
15
17
 
16
18
  module GeoCerts
17
19
 
@@ -24,6 +26,7 @@ module GeoCerts
24
26
  include Endpoints::Products
25
27
  include Endpoints::Agreements
26
28
  include Endpoints::Events
29
+ include Endpoints::Hello
27
30
  end
28
31
 
29
32
  end
@@ -0,0 +1,24 @@
1
+ module GeoCerts
2
+ module Endpoints # :nodoc:
3
+
4
+ module Hello # :nodoc:
5
+
6
+ def self.included(base)
7
+ base.class_eval do
8
+ endpoint GeoCerts::API::ENDPOINT do
9
+
10
+ action :hello, :url => '/hello.xml', :method => :post do
11
+ parameter :hello, :required => true
12
+ parser Parsers::OrderParser do
13
+ element :hello
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,35 @@
1
+ module GeoCerts
2
+
3
+ ##
4
+ # The lowest level class/method to test your credentials and connectivity
5
+ # with the GeoCerts API. If everything is properly configured, then a call
6
+ # to GeoCerts::Hello.message('my message') will result in a response
7
+ # matching your message:
8
+ #
9
+ # hello = GeoCerts::Hello.message('testing') # => <GeoCerts::Hello @hello="testing">
10
+ # hello.result # => 'testing'
11
+ # hello.hello # => 'testing'
12
+ # 'testing' == hello.result # => true
13
+ #
14
+ class Hello < ApiObject
15
+
16
+ attr_accessor :hello
17
+ alias :result :hello
18
+
19
+
20
+ ##
21
+ # Pass any message in to Hello and if everything is properly configured,
22
+ # you will receive back a matching message in the response result.
23
+ #
24
+ def self.message(message)
25
+ new(call_api { GeoCerts.api.hello(:hello => GeoCerts.escape(message)) })
26
+ end
27
+
28
+
29
+ def initialize(attributes = {})
30
+ self.hello = attributes[:hello]
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -4,6 +4,7 @@ begin
4
4
  credentials = YAML.load_file(File.expand_path(File.dirname(__FILE__) + '/../test_credentials.yml'))
5
5
  GeoCerts.partner_id = credentials['partner_id']
6
6
  GeoCerts.api_token = credentials['api_token']
7
+ GeoCerts.sandbox = true
7
8
  rescue Errno::ENOENT, LoadError
8
9
  puts '===='
9
10
  puts '= An error occurred:'
@@ -0,0 +1,19 @@
1
+ module Responses
2
+
3
+ module Hello
4
+
5
+ Hello = <<-XML
6
+ HTTP/1.1 200 OK
7
+ Content-Type: application/xml; charset=utf-8
8
+ Connection: keep-alive
9
+ Vary: Accept-Encoding
10
+ Status: 200
11
+ Content-Length: 67
12
+
13
+ <?xml version="1.0" encoding="UTF-8"?>
14
+ <hello>test message</hello>
15
+ XML
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ class GeoCerts::HelloTest < Test::Unit::TestCase
4
+
5
+ context 'GeoCerts::Hello (using the API)' do
6
+
7
+ context 'message' do
8
+
9
+ should 'return a GeoCerts::Hello' do
10
+ managed_server_request :post, %r{/hello.xml.*}, :response => Responses::Hello::Hello do
11
+ assert_kind_of(GeoCerts::Hello, GeoCerts::Hello.message('test message'))
12
+ end
13
+ end
14
+
15
+ should 'return the message' do
16
+ managed_server_request :post, %r{/hello.xml.*}, :response => Responses::Hello::Hello do
17
+ assert_equal('test message', GeoCerts::Hello.message('test message').hello)
18
+ assert_equal('test message', GeoCerts::Hello.message('test message').result)
19
+ end
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+
26
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 14
9
- version: 0.0.14
8
+ - 15
9
+ version: 0.0.15
10
10
  platform: ruby
11
11
  authors:
12
12
  - GeoCerts, Inc.
@@ -116,12 +116,14 @@ files:
116
116
  - lib/geo_certs/endpoints/agreements.rb
117
117
  - lib/geo_certs/endpoints/certificates.rb
118
118
  - lib/geo_certs/endpoints/events.rb
119
+ - lib/geo_certs/endpoints/hello.rb
119
120
  - lib/geo_certs/endpoints/orders.rb
120
121
  - lib/geo_certs/endpoints/products.rb
121
122
  - lib/geo_certs/errors.rb
122
123
  - lib/geo_certs/event.rb
123
124
  - lib/geo_certs/exceptions.rb
124
125
  - lib/geo_certs/hash_extension.rb
126
+ - lib/geo_certs/hello.rb
125
127
  - lib/geo_certs/order.rb
126
128
  - lib/geo_certs/order/administrator.rb
127
129
  - lib/geo_certs/order/contact.rb
@@ -141,12 +143,14 @@ files:
141
143
  - test/fixtures/responses/agreement.rb
142
144
  - test/fixtures/responses/certificate.rb
143
145
  - test/fixtures/responses/event.rb
146
+ - test/fixtures/responses/hello.rb
144
147
  - test/fixtures/responses/order.rb
145
148
  - test/fixtures/responses/product.rb
146
149
  - test/integrations/agreement_test.rb
147
150
  - test/integrations/api_test.rb
148
151
  - test/integrations/certificate_test.rb
149
152
  - test/integrations/event_test.rb
153
+ - test/integrations/hello_test.rb
150
154
  - test/integrations/order_test.rb
151
155
  - test/integrations/product_test.rb
152
156
  - test/test_helper.rb
@@ -199,6 +203,7 @@ test_files:
199
203
  - test/fixtures/responses/agreement.rb
200
204
  - test/fixtures/responses/certificate.rb
201
205
  - test/fixtures/responses/event.rb
206
+ - test/fixtures/responses/hello.rb
202
207
  - test/fixtures/responses/order.rb
203
208
  - test/fixtures/responses/product.rb
204
209
  - test/fixtures/responses.rb
@@ -206,6 +211,7 @@ test_files:
206
211
  - test/integrations/api_test.rb
207
212
  - test/integrations/certificate_test.rb
208
213
  - test/integrations/event_test.rb
214
+ - test/integrations/hello_test.rb
209
215
  - test/integrations/order_test.rb
210
216
  - test/integrations/product_test.rb
211
217
  - test/test_helper.rb