access 2.0.37 → 2.0.38

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: 61cf27370cacb4985e9f2e936029590257640eb9
4
- data.tar.gz: e8356f71bdb55ae3528cb42bcc1d70b1c5011150
3
+ metadata.gz: a0244c8ef26522f2464344ec4e3b7fea42e98d41
4
+ data.tar.gz: fe3e8a643acd259899025412014e3e44efdbe551
5
5
  SHA512:
6
- metadata.gz: 958a576931c22f1fe37ea61df47f2753b3488d80932c708071c9677b256bf535970cc15118c4cd0f08f9bdfb06d897021ad85e1b495678ce9bd8162615a44822
7
- data.tar.gz: 4a8199d6508245b07039b13bd41775b8c93f2acc6f0ef548c1d964474eac7cc4097791f44c0aad7321fd13bf8bf40d738784838c6f01c50957d7f3da1cb12be0
6
+ metadata.gz: fea1ab0692596fe4d70ae41ec49e9c1857597fc5e809f09e3d6d979923b88df23c3054fa46797fd411ee245fd3bdd7e003b239f0dd25010d578a07e5986be50a
7
+ data.tar.gz: 9c19127c4fd43d23d02e3e08dbfadd928f6e84e931c9d6bf80e9378dd89e2550c24e6dd9234e7372c0b888fae2c30873547afd7a791a2ac0b6ea6909293071a0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- access (2.0.37)
4
+ access (2.0.38)
5
5
  hashie (~> 3.3.1)
6
6
  httparty (~> 0.13.3)
7
7
 
data/README.md CHANGED
@@ -29,12 +29,13 @@ You can configure the following options:
29
29
  - `return_json`: Set as `'true'` or `'false'`. Default is `'false'` return ruby objects.
30
30
  - `hashify`: Set as `'true'` or `'false'`. Default is `'false'` return a hashed version of the json response if `return_json` is set to 'true'.
31
31
  - `access_timeout`: Set as a number. Default to `'10'`.
32
+ - `access_debug_output`: Set as a string `'true'` or '`false`'. Default is '`false`'. When '`true`' it will write out the raw request response from the httparty call.
32
33
 
33
34
  #### Config via Environment Variables
34
35
 
35
36
  You can set config settings by creating environment variables called:
36
37
 
37
- `ENV['ACCESS_TOKEN']`, `ENV['ACCESS_ENVIRONMENT']`, `ENV['ACCESS_RETURN_JSON']`, `ENV['ACCESS_HASHIFY']`, `ENV['ACCESS_TIMEOUT']`
38
+ `ENV['ACCESS_TOKEN']`, `ENV['ACCESS_ENVIRONMENT']`, `ENV['ACCESS_RETURN_JSON']`, `ENV['ACCESS_HASHIFY']`, `ENV['ACCESS_TIMEOUT']`. `ENV['ACCESS_DEBUG_OUTPUT']`
38
39
 
39
40
  #### Config via Initializer
40
41
 
@@ -52,11 +53,17 @@ You can also set them one at a time
52
53
 
53
54
  ### Config via Params
54
55
 
56
+ `api_environment` can be overwritten by passing in by passing the param `api_environment` to the end of any call that accepts options.
57
+
58
+ `access_timeout` can be overwritten by passing in by passing the param `access_timeout` to the end of any call that accepts options.
59
+
60
+ `access_token` can be overwritten by passing in by passing the param `access_token` to the end of any call that accepts options.
61
+
55
62
  `return_json` can be overwritten by passing in by passing the param `return_json` to the end of any call that accepts options.
56
63
 
57
64
  `hashify` can be overwritten by passing in by passing the param `hashify` to the end of any call that accepts options.
58
65
 
59
- `access_token` can be overwritten by passing in by passing the param `access_token` to the end of any call that accepts options.
66
+ `access_debug_output` can be overwritten by passing in by passing the param `access_debug_output` to the end of any call that accepts options.
60
67
 
61
68
  ###Making Calls
62
69
 
@@ -14,7 +14,7 @@ module Access
14
14
 
15
15
  class Config
16
16
  DOMAINS = {'production' => '', 'demo' => '-demo', 'stage' => '-stage', 'staging' => '-stage', 'development' => '' }
17
- attr_accessor :access_token, :api_environment, :return_json, :hashify, :access_timeout
17
+ attr_accessor :access_token, :api_environment, :return_json, :hashify, :access_timeout, :access_debug_output
18
18
 
19
19
  def initialize
20
20
  @access_token = ENV['ACCESS_TOKEN']
@@ -26,6 +26,8 @@ module Access
26
26
  @hashify = ENV['ACCESS_HASHIFY'] || 'false'
27
27
  # how many seconds till we raise a Access::Error::Timeout
28
28
  @access_timeout = ENV['ACCESS_TIMEOUT'] || '10'
29
+ # Set to 'true' to see the raw output of the httparty call
30
+ @access_debug_output = ENV['ACCESS_DEBUG_OUTPUT'] || 'false'
29
31
  end
30
32
 
31
33
  def reset
@@ -35,6 +37,7 @@ module Access
35
37
  self.return_json = ENV['ACCESS_RETURN_JSON'] || 'false'
36
38
  self.hashify = ENV['ACCESS_HASHIFY'] || 'false'
37
39
  self.access_timeout = ENV['ACCESS_TIMEOUT'] || '10'
40
+ self.access_debug_output = ENV['ACCESS_DEBUG_OUTPUT'] || 'false'
38
41
  end
39
42
  end
40
43
 
@@ -10,11 +10,12 @@ module Access
10
10
  @timeout = options.delete(:access_timeout) || Access.config.access_timeout
11
11
  @return_json = should_return_json?(options.delete(:return_json))
12
12
  @use_hasify = hashify_results?(options.delete(:hashify))
13
+ @debug_output = options.delete(:access_debug_output) || Access.config.access_debug_output
13
14
  end
14
15
 
15
16
  def get(path, api_type, options={}, &block)
16
17
  base_setup(path, api_type, options)
17
- results = self.class.get(url, headers: headers, query: options, timeout: timeout)
18
+ results = self.class.get(url, headers: headers, query: options, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
18
19
  if return_json
19
20
  use_hasify ? results.hashify : results
20
21
  else
@@ -28,7 +29,7 @@ module Access
28
29
 
29
30
  def put(path, api_type, options={}, &block)
30
31
  base_setup(path, api_type, options)
31
- results = self.class.put(url, headers: headers, body: options.to_json, timeout: timeout)
32
+ results = self.class.put(url, headers: headers, body: options.to_json, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
32
33
  if return_json
33
34
  use_hasify ? results.hashify : results
34
35
  else
@@ -42,7 +43,7 @@ module Access
42
43
 
43
44
  def post(path, api_type, options={}, &block)
44
45
  base_setup(path, api_type, options)
45
- results = self.class.post(url, headers: headers, body: options.to_json, timeout: timeout)
46
+ results = self.class.post(url, headers: headers, body: options.to_json, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
46
47
  if return_json
47
48
  use_hasify ? results.hashify : results
48
49
  else
@@ -56,7 +57,7 @@ module Access
56
57
 
57
58
  def delete(path, api_type, options={}, &block)
58
59
  base_setup(path, api_type, options)
59
- results = self.class.delete(url, headers: headers, body: options.to_json, timeout: timeout)
60
+ results = self.class.delete(url, headers: headers, body: options.to_json, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
60
61
  if return_json
61
62
  use_hasify ? results.hashify : results
62
63
  else
@@ -70,7 +71,7 @@ module Access
70
71
 
71
72
  def post_for_filter(path, api_type, filter, options={}, &block)
72
73
  base_setup(path, api_type, options)
73
- results = self.class.post(url, headers: headers, body: filter, timeout: timeout)
74
+ results = self.class.post(url, headers: headers, body: filter, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
74
75
  if return_json
75
76
  use_hasify ? results.hashify : results
76
77
  else
@@ -1,4 +1,4 @@
1
1
  module Access
2
- VERSION = "2.0.37"
2
+ VERSION = "2.0.38"
3
3
  end
4
4
 
@@ -45,4 +45,49 @@ http_interactions:
45
45
  string: '{"username":"cs@test.com","birth_date":"2015-12-15","gender":null,"home_address":null,"default_location":null,"mobile_phone_number":null,"created_dts":"2015-12-15T17:08:07.614+0000","modified_dts":"2015-12-15T17:08:25.300+0000","last_registered_dts":"2015-10-07T19:57:56.456+0000","active":true,"messaging":null,"first_name":"Cody","last_name":"Stringham","member_id":89738626,"program_id":2412,"member_key":"226872","program_key":"TYP123","cvt":"6fa6c66c4edc07b767f147a6e5fc614c20797ef0","lat_lon_address":null,"address":null}'
46
46
  http_version:
47
47
  recorded_at: Tue, 15 Dec 2015 19:52:16 GMT
48
+ - request:
49
+ method: put
50
+ uri: https://mms-stage.adcrws.com/v1/members/226872?program_id=2412
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"birth_date":"2016-01-04"}'
54
+ headers:
55
+ Access-Token:
56
+ - ACCESS_TOKEN
57
+ Content-Type:
58
+ - application/json
59
+ Accept:
60
+ - application/json
61
+ response:
62
+ status:
63
+ code: 200
64
+ message: OK
65
+ headers:
66
+ Server:
67
+ - Apache-Coyote/1.1
68
+ X-Content-Type-Options:
69
+ - nosniff
70
+ X-Xss-Protection:
71
+ - 1; mode=block
72
+ Cache-Control:
73
+ - no-cache, no-store, max-age=0, must-revalidate
74
+ Pragma:
75
+ - no-cache
76
+ Expires:
77
+ - '0'
78
+ X-Frame-Options:
79
+ - DENY
80
+ X-Application-Context:
81
+ - application:main,stage:10120
82
+ Content-Type:
83
+ - application/json;charset=UTF-8
84
+ Transfer-Encoding:
85
+ - chunked
86
+ Date:
87
+ - Mon, 04 Jan 2016 19:56:02 GMT
88
+ body:
89
+ encoding: UTF-8
90
+ string: '{"username":"cs@test.com","birth_date":"2016-01-04","gender":null,"home_address":null,"default_location":null,"mobile_phone_number":null,"created_dts":"2015-12-15T17:08:07.614+0000","modified_dts":"2015-12-15T17:08:25.300+0000","last_registered_dts":"2015-10-07T19:57:56.456+0000","active":true,"messaging":null,"first_name":"Cody","last_name":"Stringham","member_id":89738626,"program_id":2412,"member_key":"226872","program_key":"TYP123","cvt":"6fa6c66c4edc07b767f147a6e5fc614c20797ef0","lat_lon_address":null,"address":null}'
91
+ http_version:
92
+ recorded_at: Mon, 04 Jan 2016 19:54:37 GMT
48
93
  recorded_with: VCR 3.0.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: access
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.37
4
+ version: 2.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-15 00:00:00.000000000 Z
13
+ date: 2016-01-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler