fabricio 1.0.0 → 1.1.0

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: 0f69f4b0e8ac6ce3e2735769b7a9cd95ebbdef06
4
- data.tar.gz: 6bf96977f07fc9bb46e728339ecb49769be67b9f
3
+ metadata.gz: 4b9d171d28513a2fa291dcf4e6f50e65d8def451
4
+ data.tar.gz: 87abe59f0b503aaca15f2eda21742d1be692504c
5
5
  SHA512:
6
- metadata.gz: da6ef4233cfc75d8e11e4ac592cd12cf2f3deeb5f3455f6f151615046cb5003770828650e1f901863ef1d02e09225231a38d20ec1868199a8f4501ebfb4e58e6
7
- data.tar.gz: 65f858183434f2c19e3371920aab9a258b8915b395dfafe6493ec5a9de262904a8b1cd3fc8fdbdef91e48e5e3db16658c5f09a9f4dc6f3a3aa69b49f4fb17de1
6
+ metadata.gz: d506bdc4edd2cb8fabd9de86d4f6f2f47a763cbf1dadd8064c6699bc1a6dfd817098d746c35a7a2adbe43a9ca8def4df555cb9d9aad2522e2b4844ce69cc0ff0
7
+ data.tar.gz: 7b4788cfb94c26ee7aea2031f80ff71ccfb083137ba4cb0331c08438df70f3366fcfa87548c68a97f5a4a1b5533d5f6d4a2bafd8f973bcd4421eb79b374f39cd
data/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # Fabricio
2
2
 
3
- [![](https://travis-ci.org/etolstoy/fabricio.svg?branch=develop)](https://travis-ci.org/etolstoy/fabricio)
4
- [![Code Climate](https://codeclimate.com/github/etolstoy/fabricio/badges/gpa.svg)](https://codeclimate.com/github/etolstoy/fabricio)
5
- [![Test Coverage](https://codeclimate.com/github/etolstoy/fabricio/badges/coverage.svg)](https://codeclimate.com/github/etolstoy/fabricio/coverage)
3
+ [![Gem Version](https://badge.fury.io/rb/fabricio.svg)](https://badge.fury.io/rb/fabricio)
4
+ [![](https://travis-ci.org/strongself/fabricio.svg?branch=develop)](https://travis-ci.org/strongself/fabricio)
5
+ [![Code Climate](https://codeclimate.com/github/strongself/fabricio/badges/gpa.svg)](https://codeclimate.com/github/strongself/fabricio)
6
+ [![Test Coverage](https://codeclimate.com/github/strongself/fabricio/badges/coverage.svg)](https://codeclimate.com/github/strongself/fabricio/coverage)
6
7
 
7
8
  > pronounce as [f-ah-bree-see-oh]
8
9
 
9
- A simple gem that fetches mobile application statistics from [Fabric.io](http://fabric.io) using its ~~private~~ not publicly opened [API](https://github.com/etolstoy/fabricio/blob/develop/docs/api_reference.md).
10
+ A simple gem that fetches mobile application statistics from [Fabric.io](http://fabric.io) using its ~~private~~ not publicly opened [API](https://github.com/strongself/fabricio/blob/develop/docs/api_reference.md).
10
11
 
11
- There is a possibility that in some point of time it may break. Feel free to [post an issue](https://github.com/etolstoy/fabricio/issues) and we'll fix it ASAP.
12
+ There is a possibility that in some point of time it may break. Feel free to [post an issue](https://github.com/strongself/fabricio/issues) and we'll fix it ASAP.
12
13
 
13
14
  ## The Story Behind
14
15
 
@@ -45,6 +46,8 @@ Or install it yourself as:
45
46
  1. Create a `Fabricio::Client` object and configure it on initialization.
46
47
 
47
48
  ```ruby
49
+ require 'Fabricio'
50
+
48
51
  client = Fabricio::Client.new do |config|
49
52
  config.username = 'your_email'
50
53
  config.password = 'your_password'
@@ -112,6 +115,10 @@ Obtains application crashfree.
112
115
 
113
116
  > Fabric.io website uses the same calculations. However, mobile app behaves differently and shows another value.
114
117
 
118
+ #### `client.app.top_issues('app_id', start_timestamp, end_timestamp, 'build', count)`
119
+
120
+ Obtain top issues.
121
+
115
122
  #### `client.app.oomfree('app_id', 'start_timestamp', 'end_timestamp', 'builds')`
116
123
 
117
124
  Obtains application out-of-memory free for a number of builds.
@@ -134,8 +141,8 @@ Obtains an array of top versions for a given application.
134
141
 
135
142
  Fabric.io API:
136
143
 
137
- - [cURL requests](https://github.com/etolstoy/fabricio/blob/develop/docs/api_reference.md)
138
- - [Swagger](https://github.com/etolstoy/fabricio/blob/develop/docs/swagger-api.json)
144
+ - [cURL requests](https://github.com/strongself/fabricio/blob/develop/docs/api_reference.md)
145
+ - [Swagger](https://github.com/strongself/fabricio/blob/develop/docs/swagger-api.json)
139
146
 
140
147
  ## Authors
141
148
 
@@ -148,6 +148,43 @@ module Fabricio
148
148
  model
149
149
  end
150
150
 
151
+ # Returns a request model for obtaining top issues
152
+ #
153
+ # @param app_id [String]
154
+ # @param start_time [String] Timestamp of the start date
155
+ # @param end_time [String] Timestamp of the end date
156
+ # @param builds [Array] Multiple build versions. E.g. ['4.0.1 (38)']
157
+ # @param count [Int] Number of issue
158
+ # @return [Fabricio::Networking::RequestModel]
159
+ def top_issues_request_model(app_id, start_time, end_time, builds, count)
160
+ headers = {
161
+ 'Content-Type' => 'application/json'
162
+ }
163
+ builds_string = builds.map { |build|
164
+ "\"#{build}\""
165
+ }.join(',')
166
+
167
+ body = {
168
+ 'query' => "query TopIssues($externalId_0:String!,$type_1:IssueType!,$start_2:UnixTimestamp!,$end_3:UnixTimestamp!,$filters_4:IssueFiltersType!,$state_5:IssueState!) {project(externalId:$externalId_0) {crashlytics {_appDetails1JwAD1:appDetails(synthesizedBuildVersions:[#{builds_string}],type:$type_1,start:$start_2,end:$end_3,filters:$filters_4) {topCrashInsightsMatchers {groupKey}},_issues4Eg1Tv:issues(synthesizedBuildVersions:[#{builds_string}],eventType:$type_1,start:$start_2,end:$end_3,state:$state_5,first:#{count},filters:$filters_4) {edges {node {externalId,displayId,createdAt,resolvedAt,title,subtitle,state,type,impactLevel,isObfuscated,occurrenceCount,impactedDevices,notesCount,earliestBuildVersion {buildVersion {name}},latestBuildVersion {buildVersion {name}},id},cursor},pageInfo {hasNextPage,hasPreviousPage}}},id}}",
169
+ 'variables' => {
170
+ 'externalId_0' => app_id,
171
+ 'type_1' => 'all',
172
+ 'start_2' => start_time,
173
+ 'end_3' => end_time,
174
+ 'filters_4' => { 'osMinorVersion' => [], 'deviceModel' => [] },
175
+ 'state_5' => 'open'
176
+ }
177
+ }.to_json
178
+ model = Fabricio::Networking::RequestModel.new do |config|
179
+ config.type = :POST
180
+ config.base_url = FABRIC_GRAPHQL_API_URL
181
+ config.api_path = '?relayDebugName=TopIssues'
182
+ config.headers = headers
183
+ config.body = body
184
+ end
185
+ model
186
+ end
187
+
151
188
  # Returns a request model for obtaining the count of ooms
152
189
  #
153
190
  # @param app_id [String]
@@ -121,6 +121,20 @@ module Fabricio
121
121
  1 - crashes.to_f / sessions
122
122
  end
123
123
 
124
+ # Obtains top issues
125
+ #
126
+ # @param id [String] Application identifier
127
+ # @param start_time [String] Timestamp of the start date
128
+ # @param end_time [String] Timestamp of the end date
129
+ # @param build [String] The version of the build. E.g. '4.0.1 (38)'
130
+ # @param count [Int] Number of issue
131
+ # @return [Float]
132
+ def top_issues(id, start_time, end_time, builds, count)
133
+ request_model = @request_model_factory.top_issues_request_model(id, start_time, end_time, builds, count)
134
+ response = @network_client.perform_request(request_model)
135
+ JSON.parse(response.body)['data']['project']['crashlytics']['_issues4Eg1Tv']['edges'].map { |edge| edge['node'] }
136
+ end
137
+
124
138
  # Obtains application OOM-free (Out of Memory).
125
139
  #
126
140
  # @param id [String] Application identifier
@@ -1,3 +1,3 @@
1
1
  module Fabricio
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fabricio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Egor Tolstoy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-16 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webmock
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: codeclimate-test-reporter
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.0.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.0.0
97
97
  description:
@@ -101,11 +101,11 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - ".codeclimate.yml"
105
- - ".idea/runConfigurations/IRB_console__fabricio.xml"
106
- - ".rspec"
107
- - ".rubocop.yml"
108
- - ".travis.yml"
104
+ - .codeclimate.yml
105
+ - .idea/runConfigurations/IRB_console__fabricio.xml
106
+ - .rspec
107
+ - .rubocop.yml
108
+ - .travis.yml
109
109
  - CODE_OF_CONDUCT.md
110
110
  - Gemfile
111
111
  - LICENSE.txt
@@ -146,17 +146,17 @@ require_paths:
146
146
  - lib
147
147
  required_ruby_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ">="
149
+ - - '>='
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - ">="
154
+ - - '>='
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
158
  rubyforge_project:
159
- rubygems_version: 2.4.6
159
+ rubygems_version: 2.6.11
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: A simple gem that fetches mobile application statistics from Fabric.io API.