puntospoint 0.0.2 → 0.0.4

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.
@@ -0,0 +1,12 @@
1
+ development:
2
+ wsdl_url: "http://dev.puntospoint.com/api/cmr/events/wsdl"
3
+ api_user: "Junta"
4
+ api_password: "7d11a52135b4502bc6f3336f05478f52"
5
+ test:
6
+ wsdl_url: "test wsdl url"
7
+ api_user: "api user"
8
+ api_password: "api password"
9
+ production:
10
+ wsdl_url: "production wsdl url"
11
+ api_user: "api user"
12
+ api_password: "api password"
data/lib/puntospoint.rb CHANGED
@@ -2,6 +2,7 @@ module Puntospoint
2
2
  # Your code goes here...
3
3
  end
4
4
 
5
+ require 'savon'
5
6
  require 'puntospoint/version'
6
7
  require 'puntospoint/config'
7
8
  require 'puntospoint/api'
@@ -6,29 +6,38 @@ module PuntosPoint
6
6
  @env = env
7
7
  @@config ||= PuntosPoint::Config.new(@env)
8
8
  @@wsdl_url ||= @@config.wsdl_url
9
- @client = Savon.client(wsdl: @@wsdl_url)
9
+ @client = ::Savon.client(wsdl: @@wsdl_url, headers: { 'Authentication' => @@config.api_password })
10
10
  end
11
11
 
12
12
  def get_events
13
-
13
+ @client.call(:get_events)
14
+ .body[:get_events_response][:value] rescue nil
14
15
  end
15
16
 
16
17
  def get_event(event_id)
17
-
18
+ @client.call(:get_event, message: { event_id: event_id })
19
+ .body[:get_event_response][:value] rescue nil
18
20
  end
19
21
 
20
- def create_purchase(rut, email, exchange_id, references_codes)
21
-
22
+ def create_purchase(rut, email, exchange_id, references_codes = nil)
23
+ @client.call(:create_purchase,
24
+ message: {
25
+ rut: rut,
26
+ email: email,
27
+ exchange_id: exchange_id,
28
+ reference_codes: references_codes
29
+ })
30
+ .body[:create_purchase_response][:value] rescue nil
22
31
  end
23
32
 
24
33
  def confirm_purchase(purchase_id)
25
-
34
+ @client.call(:confirm_purchase, message: { purchase_id: purchase_id })
35
+ .body[:confirm_purchase_response][:value] rescue nil
26
36
  end
27
37
 
28
38
  def redeem_purchase(purchase_id)
29
-
39
+ @client.call(:redeem_purchase, message: { purchase_id: purchase_id })
40
+ .body[:redeem_purchase_response][:value] rescue nil
30
41
  end
31
-
32
-
33
42
  end
34
43
  end
@@ -13,7 +13,7 @@ module PuntosPoint
13
13
  # env - Environment.
14
14
  #
15
15
  # Returns a Config object.
16
- def initialize env = nil, config_override = nil
16
+ def initialize(env = nil)
17
17
  if env
18
18
  # For non-rails apps
19
19
  @config_filepath = File.join(File.dirname(__FILE__), "..", "..", "config", "puntospoint.yml")
@@ -1,3 +1,3 @@
1
1
  module Puntospoint
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puntospoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
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: 2014-04-15 00:00:00.000000000 Z
12
+ date: 2014-04-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -94,6 +94,7 @@ files:
94
94
  - LICENSE.txt
95
95
  - README.md
96
96
  - Rakefile
97
+ - config/puntospoint.yml
97
98
  - config/puntospoint.yml.example
98
99
  - lib/puntospoint.rb
99
100
  - lib/puntospoint/api.rb