plaidio 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/plaidio/call.rb +28 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfdcbfcc013315a45c05301818998bc2a56b77b0
4
- data.tar.gz: 643b968783721aac7bd259f94ea0bc031a85621a
3
+ metadata.gz: 37c4f00d15e2d92f972ed906ba595cffc17c0e94
4
+ data.tar.gz: ff7251d854e5e54f270fad282c237cf5129d26a9
5
5
  SHA512:
6
- metadata.gz: 27623cc16089470e421f13ff7a1eaa6b62c520a370f4bff04845392a28cffe26cec042442d7a4e79d49961dee269976c6f6c219f8c22fac2e88ace84fcccbec4
7
- data.tar.gz: 461f2057d8d86f25db95cc9bc8aa3468902c7ddb5472989e78f9351610749996452023c591ca5f21838ad07d073e83de49fcde7878b01365a6e7c67aa8fecd51
6
+ metadata.gz: af082efc7a4ebdf0e435405083a7453f3a6ac246e3f994daf8ad9a6a805defb587e6deb63ddcc170dd65a80fe3900454fc5c14c865ea682742222b87573a3606
7
+ data.tar.gz: bbc57e08e296df85aad48003f98b66ca006cf8cf4c0d30d12f52e2c8666ad2b6a1b57e0dda97d506a68ed5e7edab3d9b7d22986771bfb6129b55ccd35c345a93
data/lib/plaidio/call.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  module Plaidio
2
- require 'rest-client'
3
2
  class Call
4
3
 
5
4
  BASE_URL = 'https://tartan.plaid.com/'
6
-
7
- # This initializes our instance variables, and sets up a new Customer class.
5
+
6
+ # This initializes our instance variables, and sets up a new Customer class.
8
7
  def initialize
9
8
  Plaidio::Configure::KEYS.each do |key|
10
9
  instance_variable_set(:"@#{key}", Plaidio.instance_variable_get(:"@#{key}"))
@@ -15,11 +14,15 @@ module Plaidio
15
14
  post('/connect',type,username,password,email)
16
15
  return parse_response(@response)
17
16
  end
18
-
17
+
18
+ def get_place(id)
19
+ get('/entity',id)
20
+ return parse_place(@response)
21
+ end
19
22
  protected
20
23
 
21
24
  def parse_response(response)
22
- case response.code
25
+ case response.code
23
26
  when "200"
24
27
  @parsed_response = Hash.new
25
28
  @parsed_response[:code] = response.code
@@ -37,7 +40,7 @@ module Plaidio
37
40
  @parsed_response[:access_token] = response["access_token"]
38
41
  @parsed_response[:mfa_info] = response["mfa_info"]
39
42
  return @parsed_response
40
- else
43
+ else
41
44
  @parsed_response = Hash.new
42
45
  @parsed_response[:code] = response.code
43
46
  @parsed_response[:message] = response
@@ -45,6 +48,18 @@ module Plaidio
45
48
  end
46
49
  end
47
50
 
51
+ def parse_place(response)
52
+ @parsed_response = Hash.new
53
+ @parsed_response[:code] = response.code
54
+ response = JSON.parse(response)["entity"]
55
+ @parsed_response[:category] = response["category"]
56
+ @parsed_response[:name] = response["name"]
57
+ @parsed_response[:id] = response["_id"]
58
+ @parsed_response[:phone] = response["meta"]["contact"]["telephone"]
59
+ @parsed_response[:location] = response["meta"]["location"]
60
+ return @parsed_response
61
+ end
62
+
48
63
  private
49
64
 
50
65
  def post(path,type,username,password,email)
@@ -52,6 +67,12 @@ module Plaidio
52
67
  @response = RestClient.post url, :client_id => self.instance_variable_get(:'@customer_id') ,:secret => self.instance_variable_get(:'@secret'), :type => type ,:credentials => {:username => username, :password => password} ,:email => email
53
68
  return @response
54
69
  end
55
-
70
+
71
+ def get(path,id)
72
+ url = BASE_URL + path
73
+ @response = RestClient.get(url,:params => {:entity_id => id})
74
+ return @response
75
+ end
76
+
56
77
  end
57
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plaidio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Crites