dexby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8153c9251fcba95236518886b09959b1bf2d93d1
4
+ data.tar.gz: 0c7d22c5eab90e356e7e1db04f1645f2abbbabc9
5
+ SHA512:
6
+ metadata.gz: c6ccd65924e2e1972d69834ce2bf0f0aa38ef4c2f9d2001f9518b0b8de3315b42c55856d1c5e15c0abacc13351271d800a902e8b68604a081eda74d663f9d619
7
+ data.tar.gz: 1e60a24c031814d7e8a64b6fdd60293742444517a9bb0eb491d4d949714c0ad5733dcb066f784cb66960c7bcdca471a6b689e4cd4494ba12e34c6806f946e7d7
@@ -0,0 +1,25 @@
1
+ .rvmrc
2
+ .rspec
3
+ *.gem
4
+ *.rbc
5
+ *.swp
6
+ .bundle
7
+ .config
8
+ .yardoc
9
+ Gemfile.lock
10
+ InstalledFiles
11
+ _yardoc
12
+ coverage
13
+ doc/
14
+ lib/bundler/man
15
+ pkg
16
+ rdoc
17
+ spec/reports
18
+ test/tmp
19
+ test/version_tmp
20
+ tmp
21
+ *.bundle
22
+ *.so
23
+ *.o
24
+ *.a
25
+ mkmf.log
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ - 2.3
5
+ - 2.4
6
+ - jruby
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dexby.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2017 Jesse Cantara, jcantara@gmail.com https://github.com/jcantara
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Dexby
2
+
3
+ [![Build Status](https://travis-ci.org/jcantara/dexby.svg?branch=master)](https://travis-ci.org/jcantara/dexby)
4
+
5
+ Dexcom API wrapper for Ruby
6
+
7
+ Just so this is said right off: this software should NEVER be relied upon for medical use.
8
+ It is a toy project I am using to compile blood-glucode information for my own uses.
9
+ Please see the [MIT License](LICENSE) for specific details, but please, please never use this
10
+ for information you are trusting your life to. I would not trust my life on it and neither should you.
11
+ I am not liable for anything that should come of using this software in any way. Use at your own risk!
12
+
13
+ Additionally, I have no specific authorization from Dexcom to write this, or access their data in
14
+ this way. Their API is not advertised as public, and is used by their own apps. I am not affiliated
15
+ with Dexcom in any way and do not represent them, nor does this library.
16
+
17
+ With that out of the way, we can get to the fun stuff:
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ gem 'dexby'
24
+
25
+ And then execute:
26
+
27
+ $ bundle
28
+
29
+ Or install it yourself as:
30
+
31
+ $ gem install dexby
32
+
33
+ ## Usage
34
+
35
+ TODO: Write usage instructions here
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it ( https://github.com/jcantara/dexby/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dexby/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dexby"
8
+ spec.version = Dexby::VERSION
9
+ spec.authors = ["Jesse Cantara"]
10
+ spec.email = ["jcantara@gmail.com"]
11
+ spec.summary = %q{Ruby API wrapper for Dexcom data}
12
+ spec.homepage = "https://github.com/jcantara/dexby"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "rspec"
23
+
24
+ spec.add_dependency "httparty"
25
+ end
@@ -0,0 +1,8 @@
1
+ require "dexby/version"
2
+ require "dexby/reader"
3
+
4
+ module Dexby
5
+ def self.new(username, password)
6
+ Reader.new(username, password)
7
+ end
8
+ end
@@ -0,0 +1,36 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ class Dexby::Connection
5
+ include ::HTTParty
6
+ base_uri 'https://share1.dexcom.com'
7
+ headers ({
8
+ "User-Agent" => "Dexcom Share/3.0.2.11 CFNetwork/711.2.23 Darwin/14.0.0",
9
+ "Content-Type" => "application/json",
10
+ "Accept" => "application/json",
11
+ })
12
+ format :json
13
+
14
+ APPLICATION_ID = "d8665ade-9673-4e27-9ff6-92db4ce13d13" # not sure where this comes from, might just be internal versioning for legit dexcom app?
15
+ LOGIN_ENDPOINT = "/ShareWebServices/Services/General/LoginPublisherAccountByName"
16
+ READ_ENDPOINT = "/ShareWebServices/Services/Publisher/ReadPublisherLatestGlucoseValues"
17
+
18
+ def self.login_body(user, pass)
19
+ {"accountName" => user, "password" => pass, "applicationId" => APPLICATION_ID}
20
+ end
21
+
22
+ def self.read_query(session_id, minutes, count)
23
+ {"sessionId" => session_id, "minutes" => minutes, "maxCount" => count}
24
+ end
25
+
26
+ def self.login(user, pass)
27
+ response = self.post(LOGIN_ENDPOINT, body: login_body(user, pass).to_json)
28
+ [response.body.tr('"',''), response.code]
29
+ end
30
+
31
+ def self.read(session_id, minutes=1440, count=1)
32
+ response = self.post(READ_ENDPOINT, query: read_query(session_id, minutes, count))
33
+ [response.parsed_response, response.code]
34
+ end
35
+
36
+ end
@@ -0,0 +1,27 @@
1
+ require 'date'
2
+
3
+ class Dexby::Parse
4
+
5
+ TREND_MAP = {0=>:"", 1=>:rising_quickly, 2=>:rising, 3=>:rising_slightly, 4=>:steady, 5=>:falling_slightly, 6=>:falling, 7=>:falling_quickly, 8=>:unknown, 9=>:unavailable}
6
+
7
+ def self.parse(item)
8
+ date = parse_date(item['WT'])
9
+ trend = parse_trend(item['Trend'])
10
+ value = item['Value']
11
+ return {trend: trend, date: date, value: value}
12
+ end
13
+
14
+ def self.parse_trend(value)
15
+ return TREND_MAP[value] if TREND_MAP.key? value
16
+ raise ArgumentError
17
+ end
18
+
19
+ def self.parse_date(value)
20
+ return DateTime.strptime(value, '/Date(%Q)/').new_offset(DateTime.now.offset)
21
+ end
22
+
23
+ def self.parse_all(items)
24
+ return items.map{|i| parse(i)}
25
+ end
26
+
27
+ end
@@ -0,0 +1,56 @@
1
+ require "dexby/connection"
2
+ require "dexby/parse"
3
+
4
+ class Dexby::Reader
5
+ def initialize(username, password, connection_class=Dexby::Connection, parser_class=Dexby::Parse)
6
+ @connection_class = connection_class
7
+ @parser_class = parser_class
8
+ @username = username
9
+ @password = password
10
+ @session_id = nil
11
+ end
12
+
13
+ def connection
14
+ @connection_class
15
+ end
16
+
17
+ def parser
18
+ @parser_class
19
+ end
20
+
21
+ def read
22
+ ensure_session_id
23
+ result = session_connection_read
24
+ if result[1] != 200
25
+ raise ::StandardError
26
+ end
27
+ parser.parse_all(result[0])
28
+ end
29
+
30
+ def session_connection_read
31
+ result = connection.read(@session_id)
32
+ if result[1] == 401 # expired session_id
33
+ result = get_session_reread
34
+ end
35
+ return result
36
+ end
37
+
38
+ def get_session_reread
39
+ get_session_id
40
+ connection.read(@session_id)
41
+ end
42
+
43
+ def ensure_session_id
44
+ get_session_id if @session_id.nil?
45
+ end
46
+
47
+ def get_session_id
48
+ result = connection.login(@username, @password)
49
+ if result[1] == 200
50
+ @session_id = result[0]
51
+ else
52
+ raise ::StandardError
53
+ end
54
+ end
55
+
56
+ end
@@ -0,0 +1,3 @@
1
+ module Dexby
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,57 @@
1
+ require 'dexby/connection'
2
+ require 'json'
3
+
4
+ RSpec.describe Dexby::Connection do
5
+
6
+ let(:subject) { described_class }
7
+
8
+ describe "class methods" do
9
+ describe ".login_body" do
10
+ it "creates login request body" do
11
+ expect( subject.login_body('user', 'pass') ).to eq ({'applicationId' => "d8665ade-9673-4e27-9ff6-92db4ce13d13", "accountName" => 'user', "password" => 'pass'})
12
+ end
13
+ end
14
+
15
+ describe ".read_query" do
16
+ it "creates read query" do
17
+ expect( subject.read_query('banana', 5, 6) ).to eq ({"sessionId" => 'banana', "minutes" => 5, "maxCount" => 6})
18
+ end
19
+ end
20
+
21
+ context "methods that make requests" do
22
+ let(:fake_response) { double('response') }
23
+ before(:example) do
24
+ allow(fake_response).to receive(:body).and_return('"blah"')
25
+ allow(fake_response).to receive(:code).and_return 200
26
+ end
27
+
28
+ describe ".login" do
29
+ it "posts to login endpoint" do
30
+ expect(subject).to receive(:post).with(subject::LOGIN_ENDPOINT, body: subject.login_body('user', 'pass').to_json).and_return(fake_response)
31
+ subject.login('user', 'pass')
32
+ end
33
+ it "returns session_id and response code" do
34
+ expect(fake_response).to receive(:body).and_return('"blah"')
35
+ allow(subject).to receive(:post).with(subject::LOGIN_ENDPOINT, body: subject.login_body('user', 'pass').to_json).and_return(fake_response)
36
+ expect(subject.login('user', 'pass')).to eq ["blah", 200]
37
+ end
38
+ end
39
+
40
+ describe ".read" do
41
+ let(:parsed_response) { [{"DT"=>"/Date(1500679432000-0700)/", "ST"=>"/Date(1500668632000)/", "Trend"=>3, "Value"=>263, "WT"=>"/Date(1500668632000)/"}] }
42
+
43
+ it "posts to read endpoint" do
44
+ allow(fake_response).to receive(:parsed_response).and_return parsed_response
45
+ expect(subject).to receive(:post).with(subject::READ_ENDPOINT, query: subject.read_query('banana', 5, 6)).and_return(fake_response)
46
+ subject.read('banana', 5, 6)
47
+ end
48
+ it "returns parsed_response and response code" do
49
+ expect(fake_response).to receive(:parsed_response).and_return parsed_response
50
+ expect(subject).to receive(:post).with(subject::READ_ENDPOINT, query: subject.read_query('banana', 5, 6)).and_return(fake_response)
51
+ expect(subject.read('banana', 5, 6)).to eq [parsed_response, 200]
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ end
@@ -0,0 +1,17 @@
1
+ require 'dexby'
2
+
3
+ RSpec.describe Dexby do
4
+ describe "#new" do
5
+ context "without user/pass arguments" do
6
+ it "raises an error" do
7
+ expect { described_class.new }.to raise_error ArgumentError
8
+ end
9
+ end
10
+ context "with user/pass arguments" do
11
+ let(:default_args) { {username: 'test', password: 'test'} }
12
+ it "returns a Dexby::Reader" do
13
+ expect(described_class.new(*default_args)).to be_a Dexby::Reader
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,81 @@
1
+ require 'dexby/parse'
2
+ require 'date'
3
+
4
+ RSpec.describe Dexby::Parse do
5
+
6
+ describe ".parse" do
7
+ context "when given a response object from dexcom api" do
8
+ let(:response_object) { {"DT"=>"/Date(1500828526000-0700)/", "ST"=>"/Date(1500817726000)/", "Trend"=>4, "Value"=>84, "WT"=>"/Date(1500817726000)/"} }
9
+ let(:parsed_response) { {trend: :steady, date: DateTime.new(2017,7,23,9,48,46,Rational(-4,24)), value: 84} }
10
+
11
+ it "returns a ruby hash representation of the response" do
12
+ expect(described_class.parse(response_object)).to eq parsed_response
13
+ end
14
+ end
15
+ context "when given a different response object from dexcom api" do
16
+ let(:response_object) { {"DT"=>"/Date(1500828525000-0700)/", "ST"=>"/Date(1500817726000)/", "Trend"=>5, "Value"=>85, "WT"=>"/Date(1500817725000)/"} }
17
+ let(:parsed_response) { {trend: :falling_slightly, date: DateTime.new(2017,7,23,9,48,45,Rational(-4,24)), value: 85} }
18
+
19
+ it "returns a ruby hash representation of the response" do
20
+ expect(described_class.parse(response_object)).to eq parsed_response
21
+ end
22
+ end
23
+ end
24
+
25
+ describe ".parse_trend" do
26
+ let(:trend_map) { {0=>:"", 1=>:rising_quickly, 2=>:rising, 3=>:rising_slightly, 4=>:steady, 5=>:falling_slightly, 6=>:falling, 7=>:falling_quickly, 8=>:unknown, 9=>:unavailable} }
27
+
28
+ context "given a valid trend" do
29
+ it "returns the expected trend symbol for all keys" do
30
+ trend_map.each do |k, v|
31
+ expect(described_class.parse_trend(k)).to eq v
32
+ end
33
+ end
34
+ it "returns the expected trend symbol for key 1" do
35
+ expect(described_class.parse_trend(1)).to eq :rising_quickly
36
+ end
37
+ end
38
+
39
+ context "given an invalid trend" do
40
+ it "raises an exception" do
41
+ expect { described_class.parse_trend("banana") }.to raise_error ArgumentError
42
+ end
43
+ end
44
+ end
45
+
46
+ describe ".parse_date" do
47
+ let(:unparsed_date) { "/Date(1500817726000)/" }
48
+
49
+ context "given a valid date" do
50
+ it "returns a DateTime" do
51
+ expect(described_class.parse_date(unparsed_date)).to be_a DateTime
52
+ end
53
+ it "returns the correct date" do
54
+ expect(described_class.parse_date(unparsed_date).new_offset("+0000").iso8601(0)).to eq "2017-07-23T13:48:46+00:00"
55
+ end
56
+ it "converts to the local timezone" do
57
+ expect(described_class.parse_date(unparsed_date).offset).to eq DateTime.now.offset
58
+ end
59
+ end
60
+ context "given an invalid date" do
61
+ it "raises an error" do
62
+ expect { described_class.parse_date("ajsfjasjdf") }.to raise_error ArgumentError
63
+ end
64
+ end
65
+ end
66
+
67
+ describe ".parse_all" do
68
+ context "when given an array of responses" do
69
+ let(:response) { [{"DT"=>"/Date(1500828526000-0700)/", "ST"=>"/Date(1500817726000)/", "Trend"=>4, "Value"=>84, "WT"=>"/Date(1500817726000)/"}] * 3 }
70
+ let(:parsed) { [{trend: :steady, date: DateTime.new(2017,7,23,9,48,46,Rational(-4,24)), value: 84}] * 3 }
71
+
72
+ it "returns an array" do
73
+ expect(described_class.parse_all(response)).to be_a Array
74
+ end
75
+ it "parses every element" do
76
+ expect(described_class.parse_all(response)).to eq parsed
77
+ end
78
+ end
79
+ end
80
+
81
+ end
@@ -0,0 +1,130 @@
1
+ require 'dexby/reader'
2
+ require 'dexby/connection'
3
+ require 'dexby/parse'
4
+
5
+ RSpec.describe Dexby::Reader do
6
+ let(:fake_connection_class) { class_double(Dexby::Connection) }
7
+ let(:fake_parser_class) { class_double(Dexby::Parse) }
8
+ let(:default_args) { ['user', 'pass', fake_connection_class, fake_parser_class] }
9
+ let(:subject) { described_class.new(*default_args) }
10
+
11
+ describe "class methods" do
12
+ describe ".new" do
13
+ context "without required user/pass" do
14
+ it "raises an error" do
15
+ expect { described_class.new }.to raise_error ArgumentError
16
+ end
17
+ end
18
+ context "with required user/pass" do
19
+ it "returns a Dexby::Reader" do
20
+ expect(described_class.new(*default_args)).to be_a Dexby::Reader
21
+ end
22
+ it "saves user/password" do
23
+ expect(subject.instance_variable_get(:@username)).to eq 'user'
24
+ expect(subject.instance_variable_get(:@password)).to eq 'pass'
25
+ end
26
+ it "has a nil session_id" do
27
+ expect(subject.instance_variable_get(:@session_id)).to be_nil
28
+ end
29
+ context "dependency injection" do
30
+ it "sets default dependencies" do
31
+ subject = described_class.new('user', 'pass')
32
+ expect(subject.instance_variable_get(:@connection_class)).to be Dexby::Connection
33
+ expect(subject.instance_variable_get(:@parser_class)).to be Dexby::Parse
34
+ end
35
+ it "sets overridden dependencies" do
36
+ expect(subject.instance_variable_get(:@connection_class)).to be fake_connection_class
37
+ expect(subject.instance_variable_get(:@parser_class)).to be fake_parser_class
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ describe "instance methods" do
45
+ describe "#connection" do
46
+ it "returns connection class" do
47
+ expect(subject.connection).to be fake_connection_class
48
+ end
49
+ end
50
+
51
+ describe "#parser" do
52
+ it "returns parser class" do
53
+ expect(subject.parser).to be fake_parser_class
54
+ end
55
+ end
56
+
57
+ describe "#read" do
58
+ context "without an existing session_id" do
59
+ before(:example) do
60
+ allow(fake_connection_class).to receive(:read).and_return([[],200])
61
+ allow(fake_parser_class).to receive(:parse_all).and_return([])
62
+ end
63
+ context "where login is successful" do
64
+ it "logs in and saves session_id" do
65
+ expect(fake_connection_class).to receive(:login).and_return(['banana', 200])
66
+ subject.read
67
+ expect(subject.instance_variable_get(:@session_id)).to eq 'banana'
68
+ end
69
+ end
70
+ context "where login fails" do
71
+ [500, 401, 302].each do |code|
72
+ it "raises exception for #{code}" do
73
+ expect(fake_connection_class).to receive(:login).and_return(['banana', code])
74
+ expect{ subject.read }.to raise_error StandardError
75
+ end
76
+ end
77
+ end
78
+ end
79
+ context "with a session_id" do
80
+ before(:example) do
81
+ subject.instance_variable_set(:@session_id, 'banana')
82
+ end
83
+ context "where reads succeed" do
84
+ before(:example) do
85
+ expect(fake_connection_class).to receive(:read).and_return([[],200])
86
+ allow(fake_parser_class).to receive(:parse_all).and_return([])
87
+ end
88
+ it "reads data" do
89
+ subject.read
90
+ end
91
+ it "parses the output" do
92
+ expect(fake_parser_class).to receive(:parse_all).and_return([])
93
+ subject.read
94
+ end
95
+ end
96
+ context "where reads return 401 then 200" do
97
+ before(:example) do
98
+ expect(fake_connection_class).to receive(:read).and_return([[],401],[[],200])
99
+ allow(fake_parser_class).to receive(:parse_all).and_return([])
100
+ end
101
+ it "calls login again" do
102
+ expect(fake_connection_class).to receive(:login).and_return(['banana',200])
103
+ subject.read
104
+ end
105
+ end
106
+ context "where reads return 401 repeatedly" do
107
+ before(:example) do
108
+ expect(fake_connection_class).to receive(:read).and_return([[],401],[[],401])
109
+ end
110
+ it "raises exception" do
111
+ allow(fake_connection_class).to receive(:login).and_return(['banana', 200])
112
+ expect{ subject.read }.to raise_error StandardError
113
+ end
114
+ it "attempts to login once" do
115
+ expect(fake_connection_class).to receive(:login).and_return(['banana', 200])
116
+ expect{ subject.read }.to raise_error StandardError
117
+ end
118
+ end
119
+ context "where reads return 500s" do
120
+ before(:example) do
121
+ expect(fake_connection_class).to receive(:read).and_return([[],500])
122
+ end
123
+ it "raises exception" do
124
+ expect{ subject.read }.to raise_error StandardError
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,100 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
65
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
67
+ config.disable_monkey_patching!
68
+
69
+ # This setting enables warnings. It's recommended, but in some cases may
70
+ # be too noisy due to issues in dependencies.
71
+ config.warnings = true
72
+
73
+ # Many RSpec users commonly either run the entire suite or an individual
74
+ # file, and it's useful to allow more verbose output when running an
75
+ # individual spec file.
76
+ if config.files_to_run.one?
77
+ # Use the documentation formatter for detailed output,
78
+ # unless a formatter has already been configured
79
+ # (e.g. via a command-line flag).
80
+ config.default_formatter = "doc"
81
+ end
82
+
83
+ # Print the 10 slowest examples and example groups at the
84
+ # end of the spec run, to help surface which specs are running
85
+ # particularly slow.
86
+ config.profile_examples = 10
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+ =end
100
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dexby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jesse Cantara
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-08-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: httparty
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - jcantara@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - dexby.gemspec
83
+ - lib/dexby.rb
84
+ - lib/dexby/connection.rb
85
+ - lib/dexby/parse.rb
86
+ - lib/dexby/reader.rb
87
+ - lib/dexby/version.rb
88
+ - spec/connection_spec.rb
89
+ - spec/dexby_spec.rb
90
+ - spec/parsing_spec.rb
91
+ - spec/reader_spec.rb
92
+ - spec/spec_helper.rb
93
+ homepage: https://github.com/jcantara/dexby
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.6.12
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Ruby API wrapper for Dexcom data
117
+ test_files:
118
+ - spec/connection_spec.rb
119
+ - spec/dexby_spec.rb
120
+ - spec/parsing_spec.rb
121
+ - spec/reader_spec.rb
122
+ - spec/spec_helper.rb