mvclient 0.0.2 → 0.0.3

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: 346159f60bb02d2432e4cec68c239e158e1d63b8
4
- data.tar.gz: c42cdef32bcd856b72dee4995ea3bdf636ab2fe1
3
+ metadata.gz: 7ea6a1b9366e1da7d0fac237aad1024c6b8fffc5
4
+ data.tar.gz: dd3d9817debf4ba0a6048df0ed790d5b21f9effa
5
5
  SHA512:
6
- metadata.gz: 4bc6dc00b2c7b965d6ecd9105f56c2698109d1653159d019c1c3873f2a4ee699143a540d578dd5ce3131d8858cf75f7a62d2d3fa6552a6c94972f65d0b8a0144
7
- data.tar.gz: f25306096e3f623d2e0d5546205e09d49204c0d67cc13d083abf901908c75514bd688f39235a6344609c7e7fa5ea01bb6acd380d6611797160a1e0e0faa99f70
6
+ metadata.gz: 0ecae15a3d1b599c37430e0042412a7ef65ac3101f9fde2bded4f47ba612ea44b6677bd7f73a3a11bb0dd6f6f1a81d7fe73642e3dc99934a722c469264df74b3
7
+ data.tar.gz: fe58bf261dcd226071644b99b807fac23810ec6fad17a653cccc895e42a1c30d337e21946b42665246cafb54bf231ab2250c525c5b1ffce035e41eac226e7d3f
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
- gem 'byebug'
3
- gem 'httparty', '~> 0'
4
- gem 'http-cookie', '~> 1'
2
+
3
+ gemspec
4
+
5
+ gem 'byebug', platforms: [:mri_20, :mri_21, :mri_22]
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'highline/import'
3
4
  require 'optparse'
4
- require_relative '../lib/mvclient'
5
+ require 'mvclient'
5
6
 
6
7
  USER_ID_REGEX = /\A\h{8}-\h{4}-user-\h{4}-\h{12}\z/
7
8
 
@@ -43,8 +44,12 @@ COMMANDS = {
43
44
  $options[:password] = password
44
45
  end
45
46
  end
46
- require_options(:username, :password)
47
- $client.login!($options[:username], $options[:password])
47
+ username = $options[:username]
48
+ username ||= ask("Enter your username: ")
49
+ password = $options[:password]
50
+ password ||= ask("Enter your password: ") { |q| q.echo = false }
51
+
52
+ $client.login!(username, password)
48
53
  nil
49
54
  },
50
55
 
@@ -1 +1 @@
1
- require_relative 'mvclient/client'
1
+ require 'mvclient/client'
@@ -2,7 +2,7 @@ require 'json'
2
2
  require 'httparty'
3
3
  require 'fileutils'
4
4
  require 'http-cookie'
5
- require_relative 'error'
5
+ require 'mvclient/error'
6
6
 
7
7
  module Motivosity
8
8
  class Auth
@@ -12,7 +12,14 @@ module Motivosity
12
12
  debug_output $stderr if ENV['MOTIVOSITY_DEBUG'].to_i == 1
13
13
 
14
14
  def initialize
15
- @cookies = HTTP::CookieJar.new(store: :mozilla, filename: File.expand_path("~/.motivosity-session"))
15
+ cookie_jar_path = File.expand_path("~/.motivosity-session")
16
+ # make sure to create the cookie jar as read/write to current user only
17
+ old_umask = File.umask(0177)
18
+ begin
19
+ @cookies = HTTP::CookieJar.new(store: :mozilla, filename: cookie_jar_path)
20
+ ensure
21
+ File.umask(old_umask)
22
+ end
16
23
  end
17
24
 
18
25
  def login!(username, password)
@@ -1,6 +1,6 @@
1
1
  require 'httparty'
2
2
  require 'json'
3
- require_relative 'auth'
3
+ require 'mvclient/auth'
4
4
 
5
5
  module Motivosity
6
6
  class Client
@@ -4,4 +4,4 @@ module Motivosity
4
4
  end
5
5
  class UnauthorizedError < Error; end
6
6
  class BalanceError < Error; end
7
- end
7
+ end
@@ -1,6 +1,9 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
1
4
  Gem::Specification.new do |s|
2
5
  s.name = 'mvclient'
3
- s.version = '0.0.2'
6
+ s.version = '0.0.3'
4
7
  s.date = '2015-04-09'
5
8
  s.summary = "Motivosity API Client"
6
9
  s.description = "A minimal Motivosity API v1 wrapper for Ruby, plus a command-line tool"
@@ -14,4 +17,5 @@ Gem::Specification.new do |s|
14
17
  s.required_ruby_version = '>= 1.9.3'
15
18
  s.add_dependency 'httparty', '~> 0'
16
19
  s.add_dependency 'http-cookie', '~> 1'
20
+ s.add_dependency 'highline', '~> 1.7'
17
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mvclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Stanley
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: highline
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
41
55
  description: A minimal Motivosity API v1 wrapper for Ruby, plus a command-line tool
42
56
  email: jstanley0@gmail.com
43
57
  executables: