you_track 0.4.0 → 0.4.1

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: d654b31db68a4ca3c3cfa398cccf07eced13ec79
4
- data.tar.gz: 26c79fb2b4900eed1001c615799231edaaf09616
3
+ metadata.gz: 7731b376fb285bb8902965a614a92045d28fbb31
4
+ data.tar.gz: 87fd01be121a4aa47e2c7e1ae493d52f385360a0
5
5
  SHA512:
6
- metadata.gz: 0950583b556fc92462e59f7609ec3e98da2645552b9e51377398362036d68694f67445260a78038c2e80cfa93a29d9f4940c02f624bb563d5fc061eec66c9a7b
7
- data.tar.gz: 13d02d870e5e9f5c5dbef8d4c1eb78c0780b393c5515af8afb0cee1fae465f1ea69438dab008ec1f5f412e4bc8273272589b61a46d86bbfd61b4af22f6c292d7
6
+ metadata.gz: 2f60bda9c55406d193cbc4475a647e803582b848ab7756280054c9eab2bb894d1d89f9752ab3c23e1c4a5f6722c1e55c10f14c1a9bd25ac23903b75ab8242a34
7
+ data.tar.gz: b24214c9f606c529086faadabaeb1af681d558d2ae8e62c54b3d02bca809ef4520691bb5688cb08f8c0a45f9249c138c4c0e874bd7460cfc65999be2a65dafd7
@@ -35,15 +35,24 @@ class YouTrack::Client::Mock
35
35
  end
36
36
 
37
37
  def initialize(options={})
38
- @url = URI.parse(options[:url])
38
+ @url = URI.parse(options[:url])
39
39
  @username = options[:username]
40
- self.data[:users][@username] = {
41
- :email => @username,
42
- :full_name => Faker::Name.name,
43
- :last_created_project => SecureRandom.hex(2),
40
+
41
+ set_current_user
42
+ end
43
+
44
+ def set_current_user
45
+ self.data[:users][username] ||= {
46
+ "email" => "#{username}@example.org",
47
+ "full_name" => Faker::Name.name,
48
+ "last_created_project" => SecureRandom.hex(2),
44
49
  }
45
50
  end
46
51
 
52
+ def current_user
53
+ @current_user ||= users.current
54
+ end
55
+
47
56
  def response(options={})
48
57
  body = options[:response_body] || options[:body]
49
58
  method = options[:method] || :get
@@ -79,8 +88,4 @@ class YouTrack::Client::Mock
79
88
  Faraday::Response::RaiseError.new.on_complete(env) ||
80
89
  Faraday::Response.new(env)
81
90
  end
82
-
83
- def current_user
84
- @current_user ||= users.current
85
- end
86
91
  end
@@ -1,8 +1,8 @@
1
1
  class YouTrack::Client::User < YouTrack::Client::Model
2
- identity :id, aliases: ["fullName", "email"]
2
+ identity :id, aliases: ["email"]
3
3
 
4
+ attribute :name, alias: "fullName"
4
5
  attribute :last_created_project, aliases: ["lastCreatedProject"]
5
- attribute :email, aliases: ["email"]
6
6
 
7
7
  def admin? # just try to make a request to the admin api and see what happens
8
8
  return @admin if defined?(@admin) # i love how ||= doesn't work when a variable is false
@@ -8,7 +8,7 @@ class YouTrack::Client::GetCurrentUser < YouTrack::Client::Request
8
8
 
9
9
  def mock
10
10
  service.response(
11
- :body => find(:users, service.username)
11
+ :body => service.set_current_user,
12
12
  )
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module YouTrack
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: you_track
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane