mavenlink 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +10 -3
  4. data/Gemfile.lock +38 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.rdoc +69 -0
  7. data/Rakefile +50 -24
  8. data/TODO +18 -0
  9. data/VERSION +1 -0
  10. data/lib/mavenlink.rb +2 -134
  11. data/lib/mavenlink/base.rb +184 -0
  12. data/lib/mavenlink/client.rb +202 -96
  13. data/mavenlink.gemspec +85 -19
  14. data/spec/mavenlink/base_spec.rb +223 -0
  15. data/spec/mavenlink/client_spec.rb +183 -0
  16. data/spec/spec_helper.rb +13 -25
  17. metadata +243 -232
  18. checksums.yaml +0 -7
  19. data/.gitignore +0 -11
  20. data/.ruby-gemset +0 -1
  21. data/.ruby-version +0 -1
  22. data/README.md +0 -241
  23. data/bin/mavenlink-console +0 -18
  24. data/doc/ml_logo_lb-primary.png +0 -0
  25. data/lib/config/specification.yml +0 -1665
  26. data/lib/mavenlink/account_invitation.rb +0 -4
  27. data/lib/mavenlink/account_membership.rb +0 -4
  28. data/lib/mavenlink/additional_item.rb +0 -4
  29. data/lib/mavenlink/assignment.rb +0 -5
  30. data/lib/mavenlink/attachment.rb +0 -11
  31. data/lib/mavenlink/backup_approver_association.rb +0 -4
  32. data/lib/mavenlink/concerns/custom_fieldable.rb +0 -9
  33. data/lib/mavenlink/concerns/indestructible.rb +0 -11
  34. data/lib/mavenlink/concerns/locked_record.rb +0 -30
  35. data/lib/mavenlink/cost_rate.rb +0 -4
  36. data/lib/mavenlink/custom_field.rb +0 -4
  37. data/lib/mavenlink/custom_field_choice.rb +0 -5
  38. data/lib/mavenlink/custom_field_value.rb +0 -4
  39. data/lib/mavenlink/errors.rb +0 -47
  40. data/lib/mavenlink/expense.rb +0 -4
  41. data/lib/mavenlink/expense_category.rb +0 -4
  42. data/lib/mavenlink/expense_report_submission.rb +0 -7
  43. data/lib/mavenlink/external_payment.rb +0 -4
  44. data/lib/mavenlink/external_reference.rb +0 -24
  45. data/lib/mavenlink/fixed_fee_item.rb +0 -4
  46. data/lib/mavenlink/holiday.rb +0 -4
  47. data/lib/mavenlink/holiday_calendar.rb +0 -4
  48. data/lib/mavenlink/holiday_calendar_association.rb +0 -4
  49. data/lib/mavenlink/holiday_calendar_membership.rb +0 -4
  50. data/lib/mavenlink/invoice.rb +0 -4
  51. data/lib/mavenlink/logger.rb +0 -62
  52. data/lib/mavenlink/model.rb +0 -279
  53. data/lib/mavenlink/organization.rb +0 -4
  54. data/lib/mavenlink/organization_membership.rb +0 -4
  55. data/lib/mavenlink/participation.rb +0 -4
  56. data/lib/mavenlink/post.rb +0 -4
  57. data/lib/mavenlink/project_template.rb +0 -4
  58. data/lib/mavenlink/project_template_assignment.rb +0 -4
  59. data/lib/mavenlink/railtie.rb +0 -7
  60. data/lib/mavenlink/rate_card.rb +0 -4
  61. data/lib/mavenlink/rate_card_role.rb +0 -4
  62. data/lib/mavenlink/rate_card_set.rb +0 -4
  63. data/lib/mavenlink/rate_card_set_version.rb +0 -30
  64. data/lib/mavenlink/rate_card_version.rb +0 -4
  65. data/lib/mavenlink/request.rb +0 -241
  66. data/lib/mavenlink/resolution.rb +0 -4
  67. data/lib/mavenlink/response.rb +0 -22
  68. data/lib/mavenlink/role.rb +0 -5
  69. data/lib/mavenlink/settings.rb +0 -11
  70. data/lib/mavenlink/skill.rb +0 -4
  71. data/lib/mavenlink/skill_category.rb +0 -4
  72. data/lib/mavenlink/skill_membership.rb +0 -4
  73. data/lib/mavenlink/specificators/association.rb +0 -13
  74. data/lib/mavenlink/specificators/attribute.rb +0 -13
  75. data/lib/mavenlink/specificators/base.rb +0 -24
  76. data/lib/mavenlink/specificators/validation.rb +0 -27
  77. data/lib/mavenlink/status_report.rb +0 -4
  78. data/lib/mavenlink/story.rb +0 -8
  79. data/lib/mavenlink/story_allocation_day.rb +0 -5
  80. data/lib/mavenlink/story_dependency.rb +0 -5
  81. data/lib/mavenlink/story_task.rb +0 -5
  82. data/lib/mavenlink/tag.rb +0 -5
  83. data/lib/mavenlink/time_adjustment.rb +0 -4
  84. data/lib/mavenlink/time_entry.rb +0 -4
  85. data/lib/mavenlink/time_off_entry.rb +0 -4
  86. data/lib/mavenlink/timesheet_submission.rb +0 -4
  87. data/lib/mavenlink/user.rb +0 -5
  88. data/lib/mavenlink/vendor.rb +0 -4
  89. data/lib/mavenlink/workspace.rb +0 -21
  90. data/lib/mavenlink/workspace_group.rb +0 -5
  91. data/lib/mavenlink/workspace_invoice_preference.rb +0 -4
  92. data/lib/mavenlink/workweek.rb +0 -4
  93. data/lib/mavenlink/workweek_membership.rb +0 -4
  94. data/spec/lib/mavenlink/account_membership_spec.rb +0 -8
  95. data/spec/lib/mavenlink/assignment_spec.rb +0 -17
  96. data/spec/lib/mavenlink/attachment_spec.rb +0 -30
  97. data/spec/lib/mavenlink/backup_approver_association_spec.rb +0 -9
  98. data/spec/lib/mavenlink/client_spec.rb +0 -187
  99. data/spec/lib/mavenlink/concerns/indestructible_spec.rb +0 -13
  100. data/spec/lib/mavenlink/concerns/locked_record_spec.rb +0 -28
  101. data/spec/lib/mavenlink/cost_rate_spec.rb +0 -9
  102. data/spec/lib/mavenlink/custom_field_value_spec.rb +0 -10
  103. data/spec/lib/mavenlink/expense_report_submission_spec.rb +0 -16
  104. data/spec/lib/mavenlink/expense_spec.rb +0 -23
  105. data/spec/lib/mavenlink/external_references_spec.rb +0 -144
  106. data/spec/lib/mavenlink/holiday_calendar_association_spec.rb +0 -8
  107. data/spec/lib/mavenlink/holiday_calendar_membership_spec.rb +0 -8
  108. data/spec/lib/mavenlink/holiday_spec.rb +0 -7
  109. data/spec/lib/mavenlink/invalid_request_error_spec.rb +0 -9
  110. data/spec/lib/mavenlink/invoice_spec.rb +0 -176
  111. data/spec/lib/mavenlink/model_spec.rb +0 -439
  112. data/spec/lib/mavenlink/post_spec.rb +0 -23
  113. data/spec/lib/mavenlink/rate_card_set_version_spec.rb +0 -119
  114. data/spec/lib/mavenlink/record_invalid_error_spec.rb +0 -16
  115. data/spec/lib/mavenlink/record_not_found_error_spec.rb +0 -9
  116. data/spec/lib/mavenlink/request_spec.rb +0 -381
  117. data/spec/lib/mavenlink/response_spec.rb +0 -50
  118. data/spec/lib/mavenlink/role_spec.rb +0 -9
  119. data/spec/lib/mavenlink/settings_spec.rb +0 -23
  120. data/spec/lib/mavenlink/skill_category_spec.rb +0 -7
  121. data/spec/lib/mavenlink/skill_membership_spec.rb +0 -9
  122. data/spec/lib/mavenlink/skill_spec.rb +0 -8
  123. data/spec/lib/mavenlink/specificators/association_spec.rb +0 -25
  124. data/spec/lib/mavenlink/specificators/attribute_spec.rb +0 -25
  125. data/spec/lib/mavenlink/specificators/validation_spec.rb +0 -39
  126. data/spec/lib/mavenlink/story_allocation_day_spec.rb +0 -64
  127. data/spec/lib/mavenlink/story_dependency_spec.rb +0 -16
  128. data/spec/lib/mavenlink/story_spec.rb +0 -69
  129. data/spec/lib/mavenlink/time_adjustment_spec.rb +0 -13
  130. data/spec/lib/mavenlink/time_entry_spec.rb +0 -43
  131. data/spec/lib/mavenlink/time_off_entry_spec.rb +0 -9
  132. data/spec/lib/mavenlink/user_spec.rb +0 -138
  133. data/spec/lib/mavenlink/workspace_group_spec.rb +0 -25
  134. data/spec/lib/mavenlink/workspace_spec.rb +0 -431
  135. data/spec/lib/mavenlink_spec.rb +0 -43
  136. data/spec/support/shared_examples.rb +0 -148
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink do
4
- subject { described_class }
5
-
6
- its(:adapter) { should_not be_nil }
7
- its(:client) { should_not be_nil }
8
- its(:default_settings) { should be_a Hash }
9
- its(:logger) { should be_a Logger }
10
- its(:specification) { should be_a BrainstemAdaptor::Specification }
11
-
12
- describe '.adapter=' do
13
- let(:adapter) { double('adapter') }
14
-
15
- specify do
16
- expect { Mavenlink.adapter = adapter }.to change(Mavenlink, :adapter).to(adapter)
17
- end
18
- end
19
-
20
- describe '.logger=' do
21
- let(:logger) { double('logger') }
22
-
23
- specify do
24
- expect { Mavenlink.logger = logger }.to change(Mavenlink, :logger).to(logger)
25
- end
26
- end
27
-
28
- describe '.oauth_token=' do
29
- specify do
30
- expect { Mavenlink.oauth_token = 'new token' }.to change { Mavenlink::Settings[:default][:oauth_token] }.from('token').to('new token')
31
- end
32
- end
33
-
34
- describe '.perform_validations=' do
35
- before do
36
- Mavenlink.perform_validations = false
37
- end
38
-
39
- specify do
40
- expect { Mavenlink.perform_validations = true }.to change { Mavenlink::Settings[:default][:perform_validations] }.to(true)
41
- end
42
- end
43
- end
@@ -1,148 +0,0 @@
1
- shared_context 'model' do |collection_name|
2
- let(:model) { described_class }
3
-
4
- let(:response) {
5
- {
6
- 'count' => 1,
7
- 'results' => [{'key' => collection_name, 'id' => '7'}],
8
- collection_name => {
9
- '7' => {'title' => 'My new record', 'id' => '7'}
10
- }
11
- }
12
- }
13
-
14
- before do
15
- stub_request :get, "/api/v1/#{collection_name}?only=7", response
16
- stub_request :get, "/api/v1/#{collection_name}?only=8", {'count' => 0, 'results' => []}
17
- stub_request :post, "/api/v1/#{collection_name}", response
18
- stub_request :delete, "/api/v1/#{collection_name}/4", {'count' => 0, 'results' => []} # TODO: replace with real one
19
- end
20
-
21
- describe 'class methods' do
22
- subject { model }
23
- its(:collection_name) { should == collection_name }
24
-
25
- describe '.scoped' do
26
- subject { model.scoped }
27
-
28
- it { should be_a Mavenlink::Request }
29
- its(:collection_name) { should == collection_name }
30
- end
31
-
32
- describe '.find' do
33
- specify do
34
- expect(model.find(7)).to be_a model
35
- end
36
-
37
- specify do
38
- expect(model.find(7).id).to eq('7')
39
- end
40
-
41
- specify do
42
- expect(model.find(8)).to be_nil
43
- end
44
- end
45
-
46
- describe '.models' do
47
- specify do
48
- expect(model.models).to be_empty
49
- end
50
-
51
- specify do
52
- expect(Mavenlink::Model.models).to include({collection_name => model})
53
- end
54
- end
55
-
56
- describe '.specification' do
57
- specify do
58
- expect(model.specification).to be_a Hash
59
- end
60
-
61
- specify do
62
- expect(model.specification).not_to be_empty
63
- end
64
- end
65
-
66
- describe '.attributes' do
67
- specify do
68
- expect(model.attributes).to be_an Array
69
- end
70
-
71
- specify do
72
- expect(model.attributes).not_to be_empty
73
- end
74
- end
75
-
76
- describe '.available_attributes' do
77
- specify do
78
- expect(model.available_attributes).to be_an Array
79
- end
80
-
81
- specify do
82
- expect(model.available_attributes).not_to be_empty
83
- end
84
- end
85
-
86
- describe '.create_attributes' do
87
- specify do
88
- expect(model.create_attributes).to be_an Array
89
- end
90
-
91
- specify do
92
- expect(model.create_attributes).not_to be_empty
93
- end
94
- end
95
-
96
- describe '.update_attributes' do
97
- specify do
98
- expect(model.update_attributes).to be_an Array
99
- end
100
- end
101
-
102
- describe '.wrap' do
103
- specify do
104
- expect(model.wrap(nil)).to be_a_new_record
105
- end
106
-
107
- context 'existing record' do
108
- let(:brainstem_record) do
109
- BrainstemAdaptor::Record.new(collection_name, '7', Mavenlink::Response.new(response))
110
- end
111
-
112
- specify do
113
- expect(model.wrap(brainstem_record)).not_to be_a_new_record
114
- end
115
-
116
- specify do
117
- expect(model.wrap(brainstem_record)).to be_a model
118
- end
119
- end
120
- end
121
- end
122
-
123
- describe '#initialize' do
124
- it 'accepts attributes' do
125
- expect(model.new(any_custom_key: 'value set')).to include(any_custom_key: 'value set')
126
- end
127
- end
128
-
129
- describe '#persisted?' do
130
- specify do
131
- expect(model.new).not_to be_persisted
132
- end
133
-
134
- specify do
135
- expect(model.new(id: 1)).to be_persisted
136
- end
137
- end
138
-
139
- describe '#new_record?' do
140
- specify do
141
- expect(model.new).to be_new_record
142
- end
143
-
144
- specify do
145
- expect(model.new(id: 1)).not_to be_new_record
146
- end
147
- end
148
- end