konduto-ruby 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 79d4e5bd7ec52ea368972d4faf1d8a58bf9cd23a
4
+ data.tar.gz: 0778688a51fb6b89b455eb758d4be0e92d54df05
5
+ SHA512:
6
+ metadata.gz: 022d0cb281e28294a6605b6609f0cf6d5a453574d8ac0c2e5d8cc0c4c7c4dbc6cd8d6c95a5ce72b0b770330e1db0b4f0e6c098187d1c5021859f7c3d11ec9961
7
+ data.tar.gz: ef1fde2699e3cd12b87ef6b9b2ff30745b0334ce3e3d5c4f7d9634c74ced98e07a15d909e8119fd161284cfa6213e0bf9c06c9529b8673bf6bc0270eaca14fd6
@@ -0,0 +1,117 @@
1
+ class KondutoRuby
2
+ require 'uri'
3
+ require 'base64'
4
+ require 'net/http'
5
+ require 'konduto-ruby/konduto_order_status'
6
+ attr_accessor :request_body, :response_body, :endpoint
7
+ attr_reader :api_key
8
+
9
+ def initialize api_key, endpoint = 'https://api.konduto.com/v1'
10
+ @endpoint = URI.parse(endpoint)
11
+ @http_client = Net::HTTP.new(@endpoint.host, @endpoint.port)
12
+ @api_key = api_key
13
+ end
14
+
15
+ def api_key= api_key
16
+ if api_key.length == 21
17
+ @api_key = api_key
18
+ else
19
+ raise ArgumentError.new "Invalid key: #{api_key}! API key length must be of 21"
20
+ end
21
+ end
22
+
23
+ def proxy
24
+ return @proxy if @proxy
25
+ URI.parse(ENV['http_proxy']) rescue nil
26
+ end
27
+
28
+ def proxy= proxy_url
29
+ @proxy = URI.parse(proxy_url)
30
+ end
31
+
32
+ def order_url order_id=''
33
+ url = "#{@endpoint}/orders"
34
+ url += "/#{order_id}" unless order_id == ''
35
+ URI.parse(url)
36
+ end
37
+
38
+ def send_request http_method, request_body=''
39
+ headers = {
40
+ 'Authorization' => "Basic #{Base64.encode64(@api_key)}",
41
+ 'Content-Type' =>'application/json',
42
+ 'Referer' => @endpoint.path
43
+ }
44
+ http_method.initialize_http_header headers
45
+ http_method.body = request_body
46
+ if proxy
47
+ http = Net::HTTP::Proxy(proxy.host, proxy.port).new(@endpoint.host, @endpoint.port)
48
+ else
49
+ http = Net::HTTP.new(@endpoint.host, @endpoint.port)
50
+ end
51
+ http.use_ssl = true
52
+ response = http.request(http_method)
53
+
54
+ response
55
+ end
56
+
57
+ def get_order order_id
58
+ get = Net::HTTP::Get.new(order_url(order_id))
59
+ response = send_request(get)
60
+
61
+ if response.kind_of? Net::HTTPSuccess
62
+ order = KondutoOrder.new JSON.parse(response.entity)['order']
63
+ order.id = order_id unless order.id
64
+ return order
65
+ else
66
+ raise build_error_message(JSON.parse(response.body)['message'])
67
+ end
68
+
69
+
70
+ end
71
+
72
+ def analyze order
73
+ post = Net::HTTP::Post.new(order_url)
74
+ response = send_request(post, order.to_json)
75
+
76
+ if response.kind_of? Net::HTTPSuccess
77
+ return KondutoOrder.new JSON.parse(response.entity)['order']
78
+ else
79
+ raise build_error_message(JSON.parse(response.body)['message'])
80
+ end
81
+ end
82
+
83
+ def update_order_status order, new_status, comments
84
+ raise ArgumentError("Illegal status #{new_status}") unless KondutoOrderStatus.allowed_status.include? new_status
85
+ raise ArgumentError("Commets can't be nil") unless comments
86
+
87
+ put = Net::HTTP::Put.new(order_url(order.id))
88
+ body = {status: new_status.downcase, comments: comments}.to_json
89
+ response = send_request(put, body)
90
+
91
+ if response.kind_of? Net::HTTPSuccess
92
+ resposta = JSON.parse(response.entity)['order']
93
+ raise 'Update order status can\'t be done' if resposta['old_status'].nil? && resposta['new_status'].nil?
94
+ order.status = resposta['new_status']
95
+ return order
96
+ else
97
+ raise build_error_message(JSON.parse(response.body)['message'])
98
+ end
99
+ end
100
+
101
+ def build_error_message(error)
102
+ expected = error['why']['expected']
103
+ if expected.is_a?(Array)
104
+ expected = ''
105
+ expected.each_with_index do |ex,index|
106
+ expected += ex
107
+ expected += ' - ' unless (index == expected.size - 1)
108
+ end
109
+ end
110
+
111
+ if error['error_identifier'].nil?
112
+ return "-> Where: #{error['where']}\n->Expected: #{expected}, Found: #{error['why']['found']}"
113
+ else
114
+ return "#->{error['error_identifier']} - #{error['notification']} / Where: #{error['where']}\n-> Expected: #{expected}, Found: #{error['why']['found']}"
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,28 @@
1
+ class KondutoAddress
2
+ attr_accessor :name, :address1, :address2, :city, :state, :country, :zip
3
+
4
+ def initialize(*args)
5
+ unless args[0].nil?
6
+ args[0].each do |k,v|
7
+ instance_variable_set("@#{k}", v) unless v.nil?
8
+ end
9
+ end
10
+ end
11
+
12
+ def to_hash
13
+ hash = {
14
+ name: self.name,
15
+ address1: self.address1,
16
+ address2: self.address2,
17
+ city: self.city,
18
+ state: self.state,
19
+ country: self.country,
20
+ zip: self.zip
21
+ }
22
+ KondutoUtils.remove_nil_keys_from_hash(hash)
23
+ end
24
+
25
+ def to_json
26
+ self.to_hash.to_json
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ class KondutoCustomer
2
+ attr_accessor :id, :name, :email, :dob, :tax_id, :phone1, :phone2, :created_at, :new, :vip
3
+
4
+ def initialize(*args)
5
+ unless args[0].nil?
6
+ args[0].each do |k,v|
7
+ instance_variable_set("@#{k}", v) unless v.nil?
8
+ end
9
+ end
10
+ end
11
+
12
+ def to_hash
13
+ hash = {
14
+ id: self.id,
15
+ name: self.name,
16
+ email: self.email,
17
+ dob: self.dob,
18
+ tax_id: self.tax_id,
19
+ phone1: self.phone1,
20
+ phone2: self.phone2,
21
+ created_at: self.created_at,
22
+ new: self.new,
23
+ vip: self.vip
24
+ }
25
+ KondutoUtils.remove_nil_keys_from_hash(hash)
26
+ end
27
+
28
+ def to_json
29
+ self.to_hash.to_json
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ class KondutoDevice
2
+ attr_accessor :user_id, :fingerprint, :platform, :browser, :language, :timezone, :cookie, :javascript, :flash, :ip
3
+
4
+ def initialize(*args)
5
+ unless args[0].nil?
6
+ args[0].each do |k,v|
7
+ instance_variable_set("@#{k}", v) unless v.nil?
8
+ end
9
+ end
10
+ end
11
+
12
+ def to_hash
13
+ hash = {
14
+ user_id: self.user_id,
15
+ fingerprint: self.fingerprint,
16
+ platform: self.platform,
17
+ browser: self.browser,
18
+ language: self.language,
19
+ timezone: self.timezone,
20
+ cookie: self.cookie,
21
+ javascript: self.javascript,
22
+ flash: self.flash,
23
+ ip: self.ip
24
+ }
25
+ KondutoUtils.remove_nil_keys_from_hash(hash)
26
+ end
27
+
28
+ def to_json
29
+ self.to_hash.to_json
30
+ end
31
+ end
@@ -0,0 +1,24 @@
1
+ class KondutoGeolocation
2
+ attr_accessor :city, :state, :country
3
+
4
+ def initialize(*args)
5
+ unless args[0].nil?
6
+ args[0].each do |k,v|
7
+ instance_variable_set("@#{k}", v) unless v.nil?
8
+ end
9
+ end
10
+ end
11
+
12
+ def to_hash
13
+ hash = {
14
+ city: self.city,
15
+ state: self.state,
16
+ country: self.country
17
+ }
18
+ KondutoUtils.remove_nil_keys_from_hash(hash)
19
+ end
20
+
21
+ def to_json
22
+ self.to_hash.to_json
23
+ end
24
+ end
@@ -0,0 +1,30 @@
1
+ class KondutoItem
2
+ attr_accessor :sku, :category, :name, :description, :product_code, :unit_cost, :quantity, :discount, :created_at
3
+
4
+ def initialize(*args)
5
+ unless args[0].nil?
6
+ args[0].each do |k,v|
7
+ instance_variable_set("@#{k}", v) unless v.nil?
8
+ end
9
+ end
10
+ end
11
+
12
+ def to_hash
13
+ hash = {
14
+ sku: self.sku,
15
+ category: self.category,
16
+ name: self.name,
17
+ description: self.description,
18
+ product_code: self.product_code,
19
+ unit_cost: self.unit_cost,
20
+ quantity: self.quantity,
21
+ discount: self.discount,
22
+ created_at: self.created_at
23
+ }
24
+ KondutoUtils.remove_nil_keys_from_hash(hash)
25
+ end
26
+
27
+ def to_json
28
+ self.to_hash.to_json
29
+ end
30
+ end
@@ -0,0 +1,23 @@
1
+ class KondutoLoyalty
2
+ attr_accessor :program, :category
3
+
4
+ def initialize(*args)
5
+ unless args[0].nil?
6
+ args[0].each do |k,v|
7
+ instance_variable_set("@#{k}", v) unless v.nil?
8
+ end
9
+ end
10
+ end
11
+
12
+ def to_hash
13
+ hash = {
14
+ program: self.program,
15
+ category: self.category
16
+ }
17
+ KondutoUtils.remove_nil_keys_from_hash(hash)
18
+ end
19
+
20
+ def to_json
21
+ self.to_hash.to_json
22
+ end
23
+ end
@@ -0,0 +1,37 @@
1
+ class KondutoNavigation
2
+ attr_accessor :session_time, :referrer, :time_site_1d, :new_accounts_1d, :password_resets_1d, :sales_declined_1d,\
3
+ :sessions_1d, :time_since_last_sale, :time_site_7d, :time_per_page_7d, :new_accounts_7d, \
4
+ :password_resets_7d, :checkout_count_7d, :sales_declined_7d, :sessions_7d
5
+ def initialize(*args)
6
+ unless args[0].nil?
7
+ args[0].each do |k,v|
8
+ instance_variable_set("@#{k}", v) unless v.nil?
9
+ end
10
+ end
11
+ end
12
+
13
+ def to_hash
14
+ hash = {
15
+ session_time: self.session_time,
16
+ referrer: self.referrer,
17
+ time_site_1d: self.time_site_1d,
18
+ new_accounts_1d: self.new_accounts_1d,
19
+ password_resets_1d: self.password_resets_1d,
20
+ sales_declined_1d: self.sales_declined_1d,
21
+ sessions_1d: self.sessions_1d,
22
+ time_since_last_sale: self.time_since_last_sale,
23
+ time_site_7d: self.time_site_7d,
24
+ time_per_page_7d: self.time_per_page_7d,
25
+ new_accounts_7d: self.new_accounts_7d,
26
+ password_resets_7d: self.password_resets_7d,
27
+ checkout_count_7d: self.checkout_count_7d,
28
+ sales_declined_7d: self.sales_declined_7d,
29
+ sessions_7d: self.sessions_7d,
30
+ }
31
+ KondutoUtils.remove_nil_keys_from_hash(hash)
32
+ end
33
+
34
+ def to_json
35
+ self.to_hash.to_json
36
+ end
37
+ end
@@ -0,0 +1,153 @@
1
+ class KondutoOrder
2
+ require 'konduto-ruby/konduto_address'
3
+ require 'konduto-ruby/konduto_customer'
4
+ require 'konduto-ruby/konduto_device'
5
+ require 'konduto-ruby/konduto_navigation'
6
+ require 'konduto-ruby/konduto_geolocation'
7
+ require 'konduto-ruby/konduto_seller'
8
+ require 'konduto-ruby/konduto_payment'
9
+ require 'konduto-ruby/konduto_item'
10
+ require 'konduto-ruby/konduto_travel'
11
+ require 'konduto-ruby/konduto_utils'
12
+ require 'json/pure'
13
+
14
+ attr_accessor :id, :visitor, :timestamp, :total_amount, :shipping_amount, :tax_amount, :customer, :currency, \
15
+ :installments, :ip, :score, :shipping_address, :billing_address, :recommendation, :status, \
16
+ :geolocation, :analyze, :messages_enchanged, :first_message, :purchased_at, :seller, :payment, \
17
+ :shopping_cart, :device, :navigation, :travel
18
+
19
+ def initialize(*args)
20
+ params = args[0]
21
+ self.shopping_cart = []
22
+ self.payment = []
23
+ if params.nil?
24
+ self.shipping_address = KondutoAddress.new
25
+ self.billing_address = KondutoAddress.new
26
+ self.customer = KondutoCustomer.new
27
+ self.seller = KondutoSeller.new
28
+ self.travel = KondutoTravel.new
29
+ self.device = KondutoDevice.new
30
+ self.geolocation = KondutoGeolocation.new
31
+ else
32
+ params = KondutoUtils.deep_symbolize_keys params
33
+ if params[shipping_address].nil?
34
+ self.shipping_address = KondutoAddress.new
35
+ else
36
+ self.shipping_address = KondutoAddress.new params[:shipping_address]
37
+ params.delete :shipping_address
38
+ end
39
+
40
+ if params[:billing_address].nil?
41
+ self.billing_address = KondutoAddress.new
42
+ else
43
+ self.billing_address = KondutoAddress.new params[:billing_address]
44
+ params.delete :billing_address
45
+ end
46
+
47
+ if params[:customer].nil?
48
+ self.customer = KondutoCustomer.new
49
+ else
50
+ self.customer = KondutoCustomer.new params[:customer]
51
+ params.delete :customer
52
+ end
53
+
54
+ if params[:seller].nil?
55
+ self.seller = KondutoSeller.new
56
+ else
57
+ self.seller = KondutoSeller.new params[:seller]
58
+ params.delete :seller
59
+ end
60
+
61
+ if params[:travel].nil?
62
+ self.travel = KondutoTravel.new
63
+ else
64
+ self.travel = KondutoTravel.new params[:travel]
65
+ params.delete :travel
66
+ end
67
+
68
+ if params[:device].nil?
69
+ self.device = KondutoDevice.new
70
+ else
71
+ self.device = KondutoDevice.new params[:device]
72
+ params.delete :device
73
+ end
74
+
75
+ if params[:geolocation].nil?
76
+ self.geolocation = KondutoGeolocation.new
77
+ else
78
+ self.geolocation = KondutoGeolocation.new params[:geolocation]
79
+ params.delete :geolocation
80
+ end
81
+
82
+ if params[:navigation].nil?
83
+ self.navigation = KondutoNavigation.new
84
+ else
85
+ self.navigation = KondutoNavigation.new params[:navigation]
86
+ params.delete :navigation
87
+ end
88
+
89
+ unless params[:payment].nil? || params[:payment].empty?
90
+ params[:payment].each do |p|
91
+ self.payment << KondutoPayment.new(p)
92
+ end
93
+ params.delete :payment
94
+ end
95
+
96
+ unless params[:shopping_cart].nil? || params[:shopping_cart].empty?
97
+ params[:shopping_cart].each do |i|
98
+ self.shopping_cart << KondutoItem.new(i)
99
+ end
100
+ params.delete :shopping_cart
101
+ end
102
+
103
+ params.each do |k,v|
104
+ instance_variable_set("@#{k}", v) unless v.nil?
105
+ end
106
+ end
107
+ end
108
+
109
+ def add_item (product)
110
+ self.shopping_cart << product
111
+ end
112
+
113
+ def add_payment (payment)
114
+ self.payment << payment
115
+ end
116
+
117
+ def to_hash
118
+ hash = {
119
+ id:self.id,
120
+ visitor:self.visitor,
121
+ total_amount:self.total_amount,
122
+ shipping_amount:self.shipping_amount,
123
+ tax_amount:self.tax_amount,
124
+ currency:self.currency,
125
+ installments:self.installments,
126
+ ip:self.ip,
127
+ first_message:self.first_message,
128
+ messages_exchanged:self.messages_enchanged,
129
+ purchased_at:self.purchased_at,
130
+ analyze:self.analyze,
131
+ customer:self.customer.to_hash,
132
+ payment: KondutoUtils.array_to_hash(self.payment),
133
+ billing:self.billing_address.to_hash,
134
+ shipping:self.shipping_address.to_hash,
135
+ shopping_cart:KondutoUtils.array_to_hash(self.shopping_cart),
136
+ travel:self.travel.to_hash,
137
+ seller:self.seller.to_hash,
138
+ device:self.device.to_hash,
139
+ geolocation:self.geolocation.to_hash,
140
+ navigation:self.navigation.to_hash
141
+ }
142
+ KondutoUtils.remove_nil_keys_from_hash(hash)
143
+ end
144
+
145
+ def to_json
146
+ self.to_hash.to_json
147
+ end
148
+
149
+ def to_json
150
+ self.to_hash.to_json
151
+ end
152
+
153
+ end
@@ -0,0 +1,26 @@
1
+ class KondutoOrderStatus
2
+ attr_accessor :status, :comments
3
+
4
+ def self.allowed_status
5
+ %w(APPROVED DECLINED NOT_AUTHORIZED CANCELLED FRAUD)
6
+ end
7
+ def initialize(*args)
8
+ unless args[0].nil?
9
+ args[0].each do |k,v|
10
+ instance_variable_set("@#{k}", v) unless v.nil?
11
+ end
12
+ end
13
+ end
14
+
15
+ def to_hash
16
+ hash = {
17
+ status: self.status,
18
+ comments: self.comments
19
+ }
20
+ KondutoUtils.remove_nil_keys_from_hash(hash)
21
+ end
22
+
23
+ def to_json
24
+ self.to_hash.to_json
25
+ end
26
+ end
@@ -0,0 +1,40 @@
1
+ class KondutoPassenger
2
+ require 'konduto-ruby/konduto_loyalty'
3
+
4
+ attr_accessor :name, :document, :document_type, :dob, :nationality, :frequent_traveller, :special_needs, :loyalty
5
+
6
+ TYPE_DOCUMENT = [:passport, :id]
7
+ def initialize(*args)
8
+ if args[0].nil?
9
+ self.loyalty = KondutoLoyalty.new
10
+ else
11
+ if args[0][:loyalty].nil?
12
+ self.loyalty = KondutoLoyalty.new
13
+ else
14
+ self.loyalty = KondutoLoyalty.new args[0][:loyalty]
15
+ args[0].delete :loyalty
16
+ end
17
+ args[0].each do |k,v|
18
+ instance_variable_set("@#{k}", v) unless v.nil?
19
+ end
20
+ end
21
+ end
22
+
23
+ def to_hash
24
+ hash = {
25
+ name: self.name,
26
+ document: self.document,
27
+ document_type: self.document_type,
28
+ dob: self.dob,
29
+ nationality: self.nationality,
30
+ frequent_traveller: self.frequent_traveller,
31
+ special_needs: self.special_needs,
32
+ loyalty: self.loyalty.to_hash
33
+ }
34
+ KondutoUtils.remove_nil_keys_from_hash(hash)
35
+ end
36
+
37
+ def to_json
38
+ self.to_hash.to_json
39
+ end
40
+ end
@@ -0,0 +1,29 @@
1
+ class KondutoPayment
2
+ attr_accessor :type, :status, :bin, :last4, :expiration_date
3
+
4
+ TYPE_PAYMENT = [:credit, :boleto, :debit, :transfer, :voucher]
5
+ TYPE_STATUS = [:approved, :declined, :pending]
6
+
7
+ def initialize(*args)
8
+ unless args[0].nil?
9
+ args[0].each do |k,v|
10
+ instance_variable_set("@#{k}", v) unless v.nil?
11
+ end
12
+ end
13
+ end
14
+
15
+ def to_hash
16
+ hash = {
17
+ type: self.type,
18
+ status: self.status,
19
+ bin: self.bin,
20
+ last4: self.last4,
21
+ expiration_date: self.expiration_date
22
+ }
23
+ KondutoUtils.remove_nil_keys_from_hash(hash)
24
+ end
25
+
26
+ def to_json
27
+ self.to_hash.to_json
28
+ end
29
+ end
@@ -0,0 +1,24 @@
1
+ class KondutoSeller
2
+ attr_accessor :id, :name, :created_at
3
+
4
+ def initialize(*args)
5
+ unless args[0].nil?
6
+ args[0].each do |k,v|
7
+ instance_variable_set("@#{k}", v) unless v.nil?
8
+ end
9
+ end
10
+ end
11
+
12
+ def to_hash
13
+ hash = {
14
+ id: self.id,
15
+ name: self.name,
16
+ created_at: self.created_at
17
+ }
18
+ KondutoUtils.remove_nil_keys_from_hash(hash)
19
+ end
20
+
21
+ def to_json
22
+ self.to_hash.to_json
23
+ end
24
+ end
@@ -0,0 +1,50 @@
1
+ class KondutoTravel
2
+ require 'konduto-ruby/konduto_travel_info'
3
+ require 'konduto-ruby/konduto_utils'
4
+ attr_accessor :type, :departure, :return, :passengers
5
+ TYPE_TRAVEL = [:flight, :bus]
6
+
7
+ def initialize(*args)
8
+ self.passengers = []
9
+
10
+ if args[0].nil?
11
+ self.departure = KondutoTravelInfo.new
12
+ self.return = KondutoTravelInfo.new
13
+ else
14
+ if args[0][:departure].nil?
15
+ self.departure = KondutoTravelInfo.new
16
+ else
17
+ self.departure = KondutoTravelInfo.new args[0][:departure]
18
+ args[0].delete :departure
19
+ end
20
+ if args[0][:return].nil?
21
+ self.return = KondutoTravelInfo.new
22
+ else
23
+ self.return = KondutoTravelInfo.new args[0][:return]
24
+ args[0].delete :return
25
+ end
26
+
27
+ args[0].each do |k,v|
28
+ instance_variable_set("@#{k}", v) unless v.nil?
29
+ end
30
+ end
31
+ end
32
+
33
+ def add_passenger (passenger)
34
+ self.passengers << passenger
35
+ end
36
+
37
+ def to_hash
38
+ hash = {
39
+ type: self.type,
40
+ departure: self.departure.to_hash,
41
+ return: self.return.to_hash,
42
+ passengers: KondutoUtils.array_to_hash(self.passengers)
43
+ }
44
+ KondutoUtils.remove_nil_keys_from_hash(hash)
45
+ end
46
+
47
+ def to_json
48
+ self.to_hash.to_json
49
+ end
50
+ end
@@ -0,0 +1,27 @@
1
+ class KondutoTravelInfo
2
+ attr_accessor :date, :number_of_connections, :class, :fare_basis
3
+
4
+ TRAVEL_CLASS = [:economy, :business, :first]
5
+
6
+ def initialize(*args)
7
+ unless args[0].nil?
8
+ args[0].each do |k,v|
9
+ instance_variable_set("@#{k}", v) unless v.nil?
10
+ end
11
+ end
12
+ end
13
+
14
+ def to_hash
15
+ hash = {
16
+ date: self.date,
17
+ number_of_connections: self.number_of_connections,
18
+ class: self.class,
19
+ fare_basis: self.fare_basis
20
+ }
21
+ KondutoUtils.remove_nil_keys_from_hash(hash)
22
+ end
23
+
24
+ def to_json
25
+ self.to_hash.to_json
26
+ end
27
+ end
@@ -0,0 +1,15 @@
1
+ class KondutoUtils
2
+ def self.array_to_hash arr
3
+ arr.map{ |pair| Hash[*pair] }
4
+ end
5
+
6
+ def self.remove_nil_keys_from_hash hash
7
+ hash.delete_if { |k, v| v.nil? || (v.respond_to?(:empty?) && v.empty?) }
8
+ end
9
+
10
+ def self.deep_symbolize_keys hash
11
+ return hash.inject({}){|memo,(k,v)| memo[k.to_sym] = deep_symbolize_keys(v); memo} if hash.is_a? Hash
12
+ return hash.inject([]){|memo,v | memo << deep_symbolize_keys(v); memo} if hash.is_a? Array
13
+ return hash
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: konduto-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Gabriel Custodio
8
+ - Jonathan Cardoso de Campos
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2016-04-29 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: ''
15
+ email:
16
+ - gcmartins93@gmail.com jonathancardosodecampos@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/konduto-ruby.rb
22
+ - lib/konduto-ruby/konduto_address.rb
23
+ - lib/konduto-ruby/konduto_customer.rb
24
+ - lib/konduto-ruby/konduto_device.rb
25
+ - lib/konduto-ruby/konduto_geolocation.rb
26
+ - lib/konduto-ruby/konduto_item.rb
27
+ - lib/konduto-ruby/konduto_loyalty.rb
28
+ - lib/konduto-ruby/konduto_navigation.rb
29
+ - lib/konduto-ruby/konduto_order.rb
30
+ - lib/konduto-ruby/konduto_order_status.rb
31
+ - lib/konduto-ruby/konduto_passenger.rb
32
+ - lib/konduto-ruby/konduto_payment.rb
33
+ - lib/konduto-ruby/konduto_seller.rb
34
+ - lib/konduto-ruby/konduto_travel.rb
35
+ - lib/konduto-ruby/konduto_travel_info.rb
36
+ - lib/konduto-ruby/konduto_utils.rb
37
+ homepage: ''
38
+ licenses:
39
+ - MIT
40
+ metadata: {}
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project:
57
+ rubygems_version: 2.4.8
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: ''
61
+ test_files: []